地图动态打点
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user