From 40a1705c0742f932608e0fcf84cd6500e837ce9a Mon Sep 17 00:00:00 2001 From: fangxiang Date: Fri, 22 Apr 2022 14:45:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpad=E7=AB=AF=E9=A2=84?= =?UTF-8?q?=E6=A1=88=E8=BF=90=E8=A1=8C=E6=97=B6=E8=BF=98=E8=83=BD=E5=BC=80?= =?UTF-8?q?=E7=AA=97=E7=9A=84BUG=E5=B9=B6=E6=B7=BB=E5=8A=A0=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/zh-CN/index.ts | 1 + src/pad/ContentWall.vue | 288 +++++++++++++++++++++------------------- src/pages/WallPage.vue | 10 ++ 3 files changed, 161 insertions(+), 138 deletions(-) diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 8da55b1..5db221b 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -476,4 +476,5 @@ export default { "the current browser does not support full screen": "当前浏览器不支持全屏", _SOFT_PAD_LOGIN_TITLE_: "软件管理平台", welcome: "欢迎", + "plan running! can't open window!": "预案正在运行!不能开窗!", }; diff --git a/src/pad/ContentWall.vue b/src/pad/ContentWall.vue index 0b6fc8a..b10777e 100644 --- a/src/pad/ContentWall.vue +++ b/src/pad/ContentWall.vue @@ -608,160 +608,172 @@ export default defineComponent({ } const onDropSignalSourceOrPolliong = (evt: _IDropToWall) => { - if (evt && evt.data) { - // const x = - // evt.pos.x - - // (wall.value.parentElement?.offsetLeft ?? 0) - - // wall_content.value.offsetLeft; - // const y = - // evt.pos.y - - // (wall.value.parentElement?.offsetTop ?? 0) - - // wall_content.value.offsetTop; + if (!plan_running.value) { + if (evt && evt.data) { + // const x = + // evt.pos.x - + // (wall.value.parentElement?.offsetLeft ?? 0) - + // wall_content.value.offsetLeft; + // const y = + // evt.pos.y - + // (wall.value.parentElement?.offsetTop ?? 0) - + // wall_content.value.offsetTop; - let dom = document.elementFromPoint( - evt.pos.x, - evt.pos.y - ) as HTMLElement; + let dom = document.elementFromPoint( + evt.pos.x, + evt.pos.y + ) as HTMLElement; - const signal_sources = GlobalData.getInstance().signal_source.filter( - (item) => (item as any)?.uuid == evt.data.uuid - ); + const signal_sources = GlobalData.getInstance().signal_source.filter( + (item) => (item as any)?.uuid == evt.data.uuid + ); - // 有可能是窗口的子节点收到了拖拽信息,需要找到真正的窗口节点来判断 - if (dom) { - const temp = find_parent_dom(dom, ["wall_item_flag", "window_flag"]); - if (temp) { - dom = temp; - } - } - - if (dom) { - if (dom.classList.contains("wall_item_flag")) { - // 开窗 - // 不知道为什么有1像素的差别 - const x = dom.offsetLeft / wall_content.value.clientWidth; - const y = dom.offsetTop / wall_content.value.clientHeight; - const width = dom.offsetWidth / wall_content.value.clientWidth; - const height = dom.offsetHeight / wall_content.value.clientHeight; - - switch (evt.type) { - case "polling": - GlobalData.getInstance() - .getCurrentClient() - ?.openPolling( - new Protocol.OpenPollingRequestEntity( - evt.data.uuid, - x, - y, - width, - height - ) - ); - break; - case "signal_source" /**OpenPollingRequestEntity */: - if (signal_sources.length) { - const signal_source = signal_sources[0]; - if (signal_source) { - GlobalData.getInstance() - .getCurrentClient() - ?.openWindow( - new Protocol.OpenWindowRequestEntity( - signal_source.uuid, - x, - y, - width, - height - ) - ); - } - } - break; + // 有可能是窗口的子节点收到了拖拽信息,需要找到真正的窗口节点来判断 + if (dom) { + const temp = find_parent_dom(dom, [ + "wall_item_flag", + "window_flag", + ]); + if (temp) { + dom = temp; } - } else if (dom.classList.contains("window_flag")) { - // 拖拽信号源替换窗口 后面还有一处替换窗口 - const rep_uuid = dom.getAttribute("uuid"); - if (rep_uuid) { - let window = $store.state.windows.find( - (item) => item.uuid == rep_uuid - ); - if (window) { - let client = GlobalData.getInstance().getCurrentClient(); - if (client) { - let x = window.x; - let y = window.y; - let width = window.width; - let height = window.height; + } - client.closeWindow(window.window_id); - const open_window_request = - new Protocol.OpenPollingRequestEntity( - evt.data.uuid, - x, - y, - width, - height + if (dom) { + if (dom.classList.contains("wall_item_flag")) { + // 开窗 + // 不知道为什么有1像素的差别 + const x = dom.offsetLeft / wall_content.value.clientWidth; + const y = dom.offsetTop / wall_content.value.clientHeight; + const width = dom.offsetWidth / wall_content.value.clientWidth; + const height = dom.offsetHeight / wall_content.value.clientHeight; + + switch (evt.type) { + case "polling": + GlobalData.getInstance() + .getCurrentClient() + ?.openPolling( + new Protocol.OpenPollingRequestEntity( + evt.data.uuid, + x, + y, + width, + height + ) ); - open_window_request.muted = window.muted; - open_window_request.volume = window.volume; - open_window_request.paused = window.paused; - open_window_request.play_speed = window.play_speed; - - setTimeout(() => { - if (!window) { - return; + break; + case "signal_source" /**OpenPollingRequestEntity */: + if (signal_sources.length) { + const signal_source = signal_sources[0]; + if (signal_source) { + GlobalData.getInstance() + .getCurrentClient() + ?.openWindow( + new Protocol.OpenWindowRequestEntity( + signal_source.uuid, + x, + y, + width, + height + ) + ); } - switch (evt.type) { - case "polling": - { - const open_polling_request = - new Protocol.OpenPollingRequestEntity( - evt.data.uuid, - x, - y, - width, - height - ); - open_polling_request.muted = window.muted; - open_polling_request.volume = window.volume; - open_polling_request.paused = window.paused; - open_polling_request.play_speed = window.play_speed; - GlobalData.getInstance() - .getCurrentClient() - ?.openPolling(open_polling_request); - } + } + break; + } + } else if (dom.classList.contains("window_flag")) { + // 拖拽信号源替换窗口 后面还有一处替换窗口 + const rep_uuid = dom.getAttribute("uuid"); + if (rep_uuid) { + let window = $store.state.windows.find( + (item) => item.uuid == rep_uuid + ); + if (window) { + let client = GlobalData.getInstance().getCurrentClient(); + if (client) { + let x = window.x; + let y = window.y; + let width = window.width; + let height = window.height; - break; - case "signal_source": - { - if (signal_sources.length) { - const signal_source = signal_sources[0]; - if (signal_source) { - const open_window_request = - new Protocol.OpenWindowRequestEntity( - signal_source.uuid, - x, - y, - width, - height - ); - open_window_request.muted = window.muted; - open_window_request.volume = window.volume; - open_window_request.paused = window.paused; - open_window_request.play_speed = - window.play_speed; - client?.openWindow(open_window_request); + client.closeWindow(window.window_id); + const open_window_request = + new Protocol.OpenPollingRequestEntity( + evt.data.uuid, + x, + y, + width, + height + ); + open_window_request.muted = window.muted; + open_window_request.volume = window.volume; + open_window_request.paused = window.paused; + open_window_request.play_speed = window.play_speed; + + setTimeout(() => { + if (!window) { + return; + } + switch (evt.type) { + case "polling": + { + const open_polling_request = + new Protocol.OpenPollingRequestEntity( + evt.data.uuid, + x, + y, + width, + height + ); + open_polling_request.muted = window.muted; + open_polling_request.volume = window.volume; + open_polling_request.paused = window.paused; + open_polling_request.play_speed = window.play_speed; + GlobalData.getInstance() + .getCurrentClient() + ?.openPolling(open_polling_request); + } + + break; + case "signal_source": + { + if (signal_sources.length) { + const signal_source = signal_sources[0]; + if (signal_source) { + const open_window_request = + new Protocol.OpenWindowRequestEntity( + signal_source.uuid, + x, + y, + width, + height + ); + open_window_request.muted = window.muted; + open_window_request.volume = window.volume; + open_window_request.paused = window.paused; + open_window_request.play_speed = + window.play_speed; + client?.openWindow(open_window_request); + } } } - } - break; - } - }, 50); + break; + } + }, 50); + } } } } } } + } else { + $q.notify({ + type: "warning", + message: $t.t("plan running! can't open window!"), + position: "top", + timeout: 1500, + }); } }; diff --git a/src/pages/WallPage.vue b/src/pages/WallPage.vue index 735432c..9170354 100644 --- a/src/pages/WallPage.vue +++ b/src/pages/WallPage.vue @@ -708,6 +708,16 @@ export default defineComponent({ target.classList.remove("drag-enter"); } + if (plan_running.value) { + $q.notify({ + type: "warning", + message: $t.t("plan running! can't open window!"), + position: "top", + timeout: 1500, + }); + return; + } + const type = e.dataTransfer?.getData("type"); const uuid = e.dataTransfer?.getData("uuid"); if (uuid && uuid.length > 0 && type && type.length > 0) {