From 6b409f427295a304473a723f45aefd85e95b0e1e Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 1 Aug 2025 16:36:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=8A=A8=E6=80=81=E6=89=93?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/210/deviceControl/index.vue | 2 +- pages/6170/deviceControl/index.vue | 34 +-- pages/common/map/index.vue | 415 +++++++++++++++-------------- 3 files changed, 232 insertions(+), 219 deletions(-) diff --git a/pages/210/deviceControl/index.vue b/pages/210/deviceControl/index.vue index c33f86e..708c64d 100644 --- a/pages/210/deviceControl/index.vue +++ b/pages/210/deviceControl/index.vue @@ -702,7 +702,7 @@ this.mqttClient.connect(() => { console.log('MQTT 连接成功,开始订阅主题'); // 订阅来自设备的状态更新 - const statusTopic = `A/${this.itemInfo.id}`; + const statusTopic = `A/${this.itemInfo.deviceImei}`; this.mqttClient.subscribe(statusTopic, (payload) => { console.log(`收到来自 ${statusTopic} 的消息:`, payload); // uni.showModal({ diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index c4b1a12..8e33ff7 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -307,15 +307,23 @@ }, // *******定位****** gpsPosition(item) { + // 添加调试日志 uni.navigateTo({ url: '/pages/common/map/index', - events: { - ack: function(data) {} - }, success: (res) => { - res.eventChannel.emit('MapData', { - data: item - }); + // 确保使用深拷贝 + const mapData = { + deviceLocation: { + longitude: String(item.longitude), // 强制转为字符串 + latitude: String(item.latitude), + deviceImage: item.devicePic || '', + deviceName: item.deviceImei || '' + } + } + res.eventChannel.emit('MapData', JSON.parse(JSON.stringify(mapData))) + }, + fail: (err) => { + } }) }, @@ -661,12 +669,6 @@ }); } }) - // const topic = `device/command/${this.deviceID}/message`; - // this.mqttClient.publish(topic, this.messageToSend); - // uni.showToast({ - // title: '消息已发送', - // icon: 'success' - // }); }, // 统一处理返回方法 handleDeviceData(res, isFromShared = false) { @@ -745,7 +747,7 @@ this.mqttClient.connect(() => { console.log('MQTT 连接成功,开始订阅主题'); // 订阅来自设备的状态更新 - const statusTopic = `A/${this.deviceID}`; + const statusTopic = `A/${this.itemInfo.deviceImei}`; this.mqttClient.subscribe(statusTopic, (payload) => { console.log(`收到来自 ${statusTopic} 的消息:`, payload); // ✅ 发送全局事件通知主页面更新 @@ -928,12 +930,14 @@ color: rgba(255, 255, 255, 0.6); text-align: end; } + .locationGPS { - width:88%; + width: 88%; text-align: end; float: right; - line-height:50rpx; + line-height: 50rpx; } + .control-card { background-color: rgb(26, 26, 26); border-radius: 16rpx; diff --git a/pages/common/map/index.vue b/pages/common/map/index.vue index 74ea6b7..bf29939 100644 --- a/pages/common/map/index.vue +++ b/pages/common/map/index.vue @@ -1,67 +1,67 @@ \ No newline at end of file