From 7cfee35383e42f7cb550c2e3c16b1ddf474b5a5f Mon Sep 17 00:00:00 2001 From: fangxiang Date: Thu, 10 Feb 2022 17:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=AE=E5=BA=95=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=BD=AE=E9=A1=B6=E7=BD=AE?= =?UTF-8?q?=E5=BA=95=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 10 +++++- src/components/Window.vue | 28 ++++++++++++---- src/entities/WSProtocol.ts | 10 +++--- src/i18n/zh-CN/index.ts | 2 ++ src/pages/TopToolBar.vue | 60 ++++++++++++++++++++++++++-------- src/pages/WallPage.vue | 20 +++++------- 6 files changed, 93 insertions(+), 37 deletions(-) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 6052220..c95bbff 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -506,7 +506,15 @@ export default class ClientConnection { public focusIn(window_id: number) { this.ws?.send( JSON.stringify( - new NormalWindowRequestEntity(Protocol.Commands.kFocusWindow, window_id) + new NormalWindowRequestEntity(Protocol.Commands.kTopWindow, window_id) + ) + ); + } + + public lowerWindow(window_id: number) { + this.ws?.send( + JSON.stringify( + new NormalWindowRequestEntity(Protocol.Commands.kLowerWindow, window_id) ) ); } diff --git a/src/components/Window.vue b/src/components/Window.vue index a83493a..ed91bf6 100644 --- a/src/components/Window.vue +++ b/src/components/Window.vue @@ -59,6 +59,26 @@ > {{ $t("close all windwos") }} + + + {{ $t("top window") }} + + + + + {{ $t("lower window") }} + +
+ + + + + - - + {{ $store.state.fan_temp.toFixed(1) }} ℃ @@ -265,17 +290,26 @@ export default defineComponent({ }, stopPlan() { GlobalData.getInstance().getCurrentClient()?.stopCurrentRunningPlan(); - // $q.notify({ - // color: "positive", - // icon: "done", - // message: - // $t.t("send") + - // $t.t("stop plan") + - // $t.t("directives") + - // $t.t("success"), - // position: "top", - // timeout: 1000, - // }); + }, + topWindow() { + const window = $store.state.windows.find( + (element) => element && element.uuid == $store.state.selected_window + ); + if (window) { + GlobalData.getInstance() + .getCurrentClient() + ?.focusIn(window.window_id); + } + }, + lowerWindow() { + const window = $store.state.windows.find( + (element) => element && element.uuid == $store.state.selected_window + ); + if (window) { + GlobalData.getInstance() + .getCurrentClient() + ?.lowerWindow(window.window_id); + } }, logout() { SessionStorage.clear(); diff --git a/src/pages/WallPage.vue b/src/pages/WallPage.vue index e3bfe17..80d7867 100644 --- a/src/pages/WallPage.vue +++ b/src/pages/WallPage.vue @@ -15,7 +15,8 @@ @close_this_window="closeWindow" @close_other_windows="closeOtherWindows" @close_all_windows="closeAllWindows" - @window_fouse_in="windowFocusIn" + @top_window="topWindow" + @lower_window="lowerWindow" @dblclick="(evt) => windowDBClick(item.window_id)" @edit_volume="edit_volume" @mute_unmute="mute_unmute" @@ -494,11 +495,11 @@ export default defineComponent({ } } break; - case Protocol.Commands.kFocusWindow: + case Protocol.Commands.kTopWindow: { const temp = JSON.parse( notify.data - ) as Protocol.FocusWindowNotifyEntity; + ) as Protocol.TopWindowNotifyEntity; if (temp) { for (const window of $store.state.windows) { if (window && window.window_id != temp.new_window_id) { @@ -594,14 +595,6 @@ export default defineComponent({ if (wall.value && dom) { if (dom.classList.contains("wall_item_flag")) { // 开窗 - console.log(dom.offsetWidth); - console.log(dom.offsetHeight); - console.log(wall.value.clientWidth); - console.log(wall.value.clientHeight); - console.log(dom.offsetLeft / wall.value.clientWidth); - console.log(dom.offsetWidth / wall.value.clientWidth); - console.log(dom.offsetTop / wall.value.clientHeight); - console.log(dom.offsetHeight / wall.value.clientHeight); GlobalData.getInstance() .getCurrentClient() ?.openWindow( @@ -747,9 +740,12 @@ export default defineComponent({ } } }, - windowFocusIn(window_id: number) { + topWindow(window_id: number) { GlobalData.getInstance().getCurrentClient()?.focusIn(window_id); }, + lowerWindow(window_id: number) { + GlobalData.getInstance().getCurrentClient()?.lowerWindow(window_id); + }, closeOtherWindows(window_id: number) { for (const window of $store.state.windows) { if (window && window.window_id != window_id) {