From a31a05f1b17ea7abdca460fb8a0dd22cb6b3fc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Mon, 9 Jun 2025 10:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9C=8B=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/App.vue b/src/App.vue index 8286cc0..7be2d03 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,6 +10,7 @@ import ThemePicker from "@/components/ThemePicker"; import AlmModal from "@/components/AlmModal"; +let timeInterval = null; export default { name: "App", components: {ThemePicker, AlmModal}, @@ -47,6 +48,9 @@ export default { } }, mounted() { + timeInterval = setInterval(() => { + this.selectOffLineDevice() + }) console.log('App mounted - 初始化全局WebSocket连接') this.initGlobalWebSocket() @@ -58,6 +62,8 @@ export default { beforeDestroy() { console.log('App beforeDestroy - 清理WebSocket连接') this.cleanup() + timeInterval && clearInterval(timeInterval) + timeInterval = null }, methods: { // 初始化全局WebSocket连接 @@ -362,6 +368,7 @@ export default { }, selectOffLineDevice() { Object.keys(this.isOnline).forEach(key => { + // console.log(key, new Date().getTime() - this.isOnline[key]) if (new Date().getTime() - this.isOnline[key] > (1000 * 60 * 30)) { this.$confirm(`设备${key}已离线`, '设备离线', { cancelButtonText: '关闭',