From fad3d3ad55fe3d24ac42c67f5f60e0d9765f5ecb Mon Sep 17 00:00:00 2001 From: lld <15027638633@163.com> Date: Fri, 26 Dec 2025 00:32:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E6=A3=9A=E9=80=BB=E8=BE=91=E5=AE=8C?= =?UTF-8?q?=E5=96=84=20=E6=8E=A5=E5=85=A5=E7=9C=9F=E5=AE=9E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/control/index.vue | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pages/control/index.vue b/pages/control/index.vue index 9b32ecd..45f59de 100644 --- a/pages/control/index.vue +++ b/pages/control/index.vue @@ -477,6 +477,7 @@ export default { this.value=1; } this.reset(); + this.disconnectMqtt(); }, reset() { @@ -551,12 +552,13 @@ export default { this.message = JSON.stringify({[type]: status}) console.info("指令:"+this.message+";大棚:"+this.publishTopic) // 控制设备 - // this.publishMessage(); - // // 设备回执 - // this.deviceType=type; + this.publishMessage(); + // 设备回执 + this.deviceType=type; + //todo - this.status[type] = this.status[type] === 0 ? 1 : 0; - this.show[type] = this.status[type] === 0 ? "运行" : "暂停"; + // this.status[type] = this.status[type] === 0 ? 1 : 0; + // this.show[type] = this.status[type] === 0 ? "运行" : "暂停"; } } @@ -601,7 +603,7 @@ export default { }, disconnectMqtt() { - if (this.client) { + if (this.client && this.connected) { this.client.end() this.connected = false this.addMessage('已断开MQTT连接') @@ -652,6 +654,16 @@ export default { this.handleCommandAck(msgData,this.deviceType); } + if (this.value!==1) { + var arr=['jbk',"jbg","jm1k","jm1g","jm2k","jm2g","jm3k","jm3g"] + const allKeysNumeric = Object.keys(msgData).some(key => arr.includes(key)); + if (allKeysNumeric) { + console.info(msgData) + this.status={...msgData} + console.info("imei: "+this.publishTopic+"copy: ",this.status) + } + } + }, addMessage(content) {