Kaynağa Gözat

提交设备详情bug

wangming 2 ay önce
ebeveyn
işleme
070cdf3cbb
1 değiştirilmiş dosya ile 8 ekleme ve 9 silme
  1. 8 9
      src/pagesA/deviceDetail/deviceDetail.vue

+ 8 - 9
src/pagesA/deviceDetail/deviceDetail.vue

@@ -445,6 +445,12 @@ export default {
             });
 
             client.on("message", (topic, message) => {
+                clearTimeout(this.inactivityTimer);
+                this.inactivityTimer = setTimeout(() => {
+                    this.targetPoints = {};
+                    console.log("长时间没有点位,消除");
+                }, 1500);
+
                 const match = topic.match(/^\/mps\/(.+)\/realtime_pos$/);
                 if (!match) return;
 
@@ -453,15 +459,8 @@ export default {
 
                 try {
                     const data = JSON.parse(message.toString());
-                    console.log(data, 9999);
+                    // console.log(data, 9999);
                     const arr = data.targetPoints;
-                    clearTimeout(this.inactivityTimer);
-                    this.inactivityTimer = setTimeout(() => {
-                        this.targetPoints = {};
-                        console.log("长时间没有点位,消除");
-                    }, 1500);
-
-                    // console.log("MQTT消息", arr);
                     this.left = arr[0];
                     this.top = arr[1];
                     if (arr.length > 0) {
@@ -495,7 +494,7 @@ export default {
                                 this.targetPoints[id].displayY = y;
                             }
                         });
-                        // console.log("🚀🚀🚀🚀targets", this.targetPoints);
+                        console.log("🚀🚀🚀🚀targets", this.targetPoints);
                     }
                 } catch (e) {
                     // console.error("MQTT消息解析失败", e);