|
@@ -319,6 +319,7 @@ export default {
|
|
|
messageFlag: true,
|
|
|
serviceNumberFlag: true,
|
|
|
voipFlag: true,
|
|
|
+ inactivityTimer: "",
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -452,8 +453,14 @@ export default {
|
|
|
|
|
|
try {
|
|
|
const data = JSON.parse(message.toString());
|
|
|
+ console.log(data, 9999);
|
|
|
const arr = data.targetPoints;
|
|
|
- // console.log(data, 99999);
|
|
|
+ clearTimeout(this.inactivityTimer);
|
|
|
+ this.inactivityTimer = setTimeout(() => {
|
|
|
+ this.targetPoints = {};
|
|
|
+ console.log("长时间没有点位,消除");
|
|
|
+ }, 1500);
|
|
|
+
|
|
|
// console.log("MQTT消息", arr);
|
|
|
this.left = arr[0];
|
|
|
this.top = arr[1];
|
|
@@ -463,7 +470,6 @@ export default {
|
|
|
if (item.length < 4) return;
|
|
|
const [x, y, z, id] = item;
|
|
|
currentIds.add(id);
|
|
|
-
|
|
|
if (!(id in this.targetPoints)) {
|
|
|
this.targetPoints[id] = {
|
|
|
x,
|
|
@@ -476,7 +482,6 @@ export default {
|
|
|
lastY: y,
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
// 去抖动
|
|
|
const dx = x - this.targetPoints[id].lastX;
|
|
|
const dy = y - this.targetPoints[id].lastY;
|
|
@@ -762,6 +767,7 @@ export default {
|
|
|
onUnload() {
|
|
|
if (this.mqttClient) this.mqttClient.end();
|
|
|
clearInterval(this.autoPlayinterval);
|
|
|
+ clearInterval(this.inactivityTimer);
|
|
|
},
|
|
|
onHide() {
|
|
|
if (this.mqttClient) this.mqttClient.end();
|