|
@@ -475,6 +475,7 @@ export default {
|
|
|
zoomTimes: "",
|
|
|
// 设备分享权限判断
|
|
|
shareJudge: false,
|
|
|
+ fallingEventChange: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -1033,8 +1034,6 @@ export default {
|
|
|
"DATA",
|
|
|
topic,
|
|
|
(message, msgTopic) => {
|
|
|
- console.log(`接收到 ${msgTopic} 消息:`, message);
|
|
|
- // 处理消息
|
|
|
const dataMatch = msgTopic.match(
|
|
|
/^\/dev\/(.+)\/tracker_targets$/
|
|
|
);
|
|
@@ -1049,6 +1048,36 @@ export default {
|
|
|
if (this.unsubscribeFn) {
|
|
|
console.log(`✅ 已成功订阅主题: ${topic}`);
|
|
|
}
|
|
|
+
|
|
|
+ const topicTwo = `/dev/${this.clientId}/falling_event_change`;
|
|
|
+ this.fallingEventChange = MqttService.subscribe(
|
|
|
+ "DATA",
|
|
|
+ topicTwo,
|
|
|
+ (message, msgTopic) => {
|
|
|
+ const dataMatch = msgTopic.match(
|
|
|
+ /^\/dev\/(.+)\/falling_event_change$/
|
|
|
+ );
|
|
|
+ if (dataMatch && dataMatch[1] === this.clientId) {
|
|
|
+ const dataMessage = JSON.parse(message.toString());
|
|
|
+ console.log(dataMessage.falling, "dataMessage");
|
|
|
+ if (dataMessage.falling == 1) {
|
|
|
+ this.falling = dataMessage.falling;
|
|
|
+ this.lnbAction = "actionYellow";
|
|
|
+ } else if (
|
|
|
+ dataMessage.falling == 2 ||
|
|
|
+ dataMessage.falling == 3
|
|
|
+ ) {
|
|
|
+ this.falling = dataMessage.falling;
|
|
|
+ this.lnbAction = "actionRed";
|
|
|
+ } else {
|
|
|
+ this.lnbAction = "action8";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ if (this.unsubscribeFn) {
|
|
|
+ console.log(`✅ 已成功订阅主题: ${topicTwo}`);
|
|
|
+ }
|
|
|
},
|
|
|
onUnload() {
|
|
|
this.inactivityTimer = null;
|
|
@@ -1057,6 +1086,10 @@ export default {
|
|
|
this.unsubscribeFn();
|
|
|
this.unsubscribeFn = null;
|
|
|
}
|
|
|
+ if (this.fallingEventChange) {
|
|
|
+ this.fallingEventChange();
|
|
|
+ this.fallingEventChange = null;
|
|
|
+ }
|
|
|
// 关闭 DATA 连接
|
|
|
// MqttService.disconnectData();
|
|
|
},
|