注释日志
parent
5d170cb580
commit
b15f58e90e
|
|
@ -551,11 +551,11 @@ export default {
|
|||
confirmText: '确定',
|
||||
success: (res) =>{
|
||||
if (res.confirm) {
|
||||
console.info("操作功能:【"+type+"】,变更状态为:"+ status)
|
||||
// console.info("操作功能:【"+type+"】,变更状态为:"+ status)
|
||||
|
||||
// // 组装消息
|
||||
this.message = JSON.stringify({[type]: status})
|
||||
console.info("指令:"+this.message+";大棚:"+this.publishTopic)
|
||||
// console.info("指令:"+this.message+";大棚:"+this.publishTopic)
|
||||
// 控制设备
|
||||
this.publishMessage();
|
||||
// 设备回执
|
||||
|
|
@ -568,7 +568,7 @@ export default {
|
|||
}
|
||||
}
|
||||
})
|
||||
console.info(this.status)
|
||||
// console.info(this.status)
|
||||
},
|
||||
connectMqtt() {
|
||||
const options = {
|
||||
|
|
@ -616,7 +616,7 @@ export default {
|
|||
},
|
||||
|
||||
publishMessage() {
|
||||
console.info("开始发布消息",this.connected,this.publishTopic,this.message)
|
||||
// console.info("开始发布消息",this.connected,this.publishTopic,this.message)
|
||||
if (!this.connected || !this.publishTopic || !this.message) {
|
||||
uni.showToast({
|
||||
title: '控制设备失败',
|
||||
|
|
@ -655,7 +655,7 @@ export default {
|
|||
// console.info("回执消息:"+msgData)
|
||||
// 3. 区分“回执”和“其他内容”
|
||||
if (msgData.prop && "suc" in msgData) {
|
||||
console.info("处理回执消息")
|
||||
// console.info("处理回执消息")
|
||||
// 👉 这是“指令回执”
|
||||
this.handleCommandAck(msgData,this.deviceType);
|
||||
} else {
|
||||
|
|
@ -669,7 +669,7 @@ export default {
|
|||
|
||||
// 处理指令回执的函数
|
||||
handleCommandAck(ackData,type) {
|
||||
console.info("回执消息11111:"+ackData)
|
||||
// console.info("回执消息11111:"+ackData)
|
||||
// 拿到指令字段(如jm2k)和执行状态(suc)
|
||||
const commandField = Object.keys(ackData.prop)[0]; // 这里是"jm2k"
|
||||
const commandValue = ackData.prop[commandField]; // 这里是0
|
||||
|
|
@ -690,7 +690,7 @@ export default {
|
|||
// 处理其他内容的函数
|
||||
handleOtherContent(msgData) {
|
||||
// 业务逻辑:处理传感器数据、设备状态等
|
||||
console.log("收到其他内容:", msgData);
|
||||
// console.log("收到其他内容:", msgData);
|
||||
// 例如:更新温湿度显示、设备在线状态等
|
||||
|
||||
// 设备状态展示
|
||||
|
|
@ -698,9 +698,9 @@ export default {
|
|||
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)
|
||||
// console.info(msgData)
|
||||
this.status={...msgData}
|
||||
console.info("imei: "+this.publishTopic+"copy: ",this.status)
|
||||
// console.info("imei: "+this.publishTopic+"copy: ",this.status)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue