From 2c4311b58c4b9fbb9d85c354fb52ad35d5c4ea83 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 4 Nov 2024 10:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=90=E7=BB=B4=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E4=B8=AD=E5=BC=80=E5=90=AF=E5=8E=86=E5=8F=B2=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=90=8E=E5=86=8D=E5=BC=80=E5=90=AF=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BF=9E=E6=8E=A5=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/conf/webLog/LogChannel.java | 3 --- web_src/src/components/dialog/operationsFoShowLog.vue | 8 +++++++- web_src/src/components/operationsForRealLog.vue | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/webLog/LogChannel.java b/src/main/java/com/genersoft/iot/vmp/conf/webLog/LogChannel.java index efa3bc11..e999b271 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/webLog/LogChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/webLog/LogChannel.java @@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j; import javax.websocket.*; import javax.websocket.server.ServerEndpoint; import java.io.IOException; -import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -31,7 +30,6 @@ public class LogChannel { public void onOpen(Session session, EndpointConfig endpointConfig) { this.session = session; this.session.setMaxIdleTimeout(0); - System.out.println(); CHANNELS.put(this.session.getId(), this); log.info("[Web-Log] 连接已建立: id={}", this.session.getId()); @@ -41,7 +39,6 @@ public class LogChannel { public void onClose(CloseReason closeReason) { log.info("[Web-Log] 连接已断开: id={}, err={}", this.session.getId(), closeReason); - CHANNELS.remove(this.session.getId()); } diff --git a/web_src/src/components/dialog/operationsFoShowLog.vue b/web_src/src/components/dialog/operationsFoShowLog.vue index 0a4c483c..a64a860d 100755 --- a/web_src/src/components/dialog/operationsFoShowLog.vue +++ b/web_src/src/components/dialog/operationsFoShowLog.vue @@ -32,6 +32,7 @@ export default { filter: "", logData: "", websocket: null, + destroyedCallback: null }; }, watch: { @@ -61,7 +62,9 @@ export default { }, destroyed() { console.log('destroyed'); - window.websocket.close(); + if (this.destroyedCallback) { + this.destroyedCallback() + } }, methods: { initData: function () { @@ -101,6 +104,9 @@ export default { } window.websocket.onopen = e => { console.log(`conn open: ${e}`); + this.destroyedCallback = ()=>{ + window.websocket.close() + } } } }, diff --git a/web_src/src/components/operationsForRealLog.vue b/web_src/src/components/operationsForRealLog.vue index 30fa750e..23bacffe 100755 --- a/web_src/src/components/operationsForRealLog.vue +++ b/web_src/src/components/operationsForRealLog.vue @@ -18,8 +18,8 @@ export default { winHeight: window.innerHeight - 220, }; }, - created() { + console.log("removeUrl11 == " + this.removeUrl) }, methods: { getURl: function () {