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