This commit is contained in:
fengerli
2026-03-17 18:03:43 +08:00
parent 7512b7211c
commit 141267b25f

View File

@ -37,13 +37,25 @@
<text class="value">{{ deviceInfo.deviceName }}</text> <text class="value">{{ deviceInfo.deviceName }}</text>
</view> </view>
<view class="item"> <view class="item">
<text class="lbl">IMEI</text> <text class="lbl">设备IMEI</text>
<text class="value">{{ deviceInfo.deviceImei }}</text> <text class="value">{{ deviceInfo.deviceImei }}</text>
</view> </view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">蓝牙名称</text>
<text class="value valueFont">{{device.bluetoothName}}</text>
</view>
<view class="item" @click.top="bleStatuToggle">
<text class="lbl">蓝牙状态</text>
<text class="value" :class="formData.bleStatu?'green':'red'">{{device.getbleStatu}}</text>
</view>
<view class="item"> <view class="item">
<text class="lbl">设备状态</text> <text class="lbl">设备状态</text>
<text class="value">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus <text class="value"
=== 2 ? '故障' : '在线' }}</text> :class="deviceInfo.onlineStatus===0?'red':'green'">{{ deviceInfo.onlineStatus === 0 ? '离线': '在线' }}</text>
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="info-label" style="display: flex; align-items: center;">定位信息</text> <text class="info-label" style="display: flex; align-items: center;">定位信息</text>
@ -440,7 +452,7 @@
alarmStatus: null, alarmStatus: null,
detailPageUrl: "/pages/650/HBY650", detailPageUrl: "/pages/650/HBY650",
showConfirm: false, showConfirm: false,
deviceId:'' deviceId: ''
}, },
permissions: [], permissions: [],
audioData: { audioData: {
@ -589,30 +601,32 @@
these.fetchDeviceDetail(data.data.id) these.fetchDeviceDetail(data.data.id)
} else { } else {
this.activePermissions = data.data.permission ? data.data.permission.split(',') : []; this.activePermissions = data.data.permission ? data.data.permission.split(',') : [];
console.log(this.activePermissions,'this.activePermissions'); console.log(this.activePermissions, 'this.activePermissions');
these.fetchDeviceDetail(data.data.deviceId) these.fetchDeviceDetail(data.data.deviceId)
} }
// 尝试连接蓝牙
if (data.data.deviceMac) {
// 假设 deviceMac 是蓝牙的 deviceId
bleTool.LinkBlue(data.data.deviceMac).then(() => {
console.log("100J 蓝牙连接成功");
this.bleStateRecovry({
deviceId: data.data.deviceMac
});
}).catch(err => {
console.log("100J 蓝牙连接失败将使用4G", err);
});
}
}); });
this.createThrottledFunctions(); this.createThrottledFunctions();
// 注册蓝牙相关事件 // 注册蓝牙相关事件
bleTool.addReceiveCallback(this.bleValueNotify, "HBY100J"); bleTool.addReceiveCallback(this.bleValueNotify, "HBY100J");
bleTool.addDisposeCallback(this.bleStateBreak, "HBY100J"); bleTool.addDisposeCallback(this.bleStateBreak, "HBY100J");
bleTool.addRecoveryCallback(this.bleStateRecovry, "HBY100J"); bleTool.addRecoveryCallback(this.bleStateRecovry, "HBY100J");
bleTool.addStateBreakCallback(this.bleStateBreak, "HBY100J"); bleTool.addStateBreakCallback(this.bleStateBreak, "HBY100J");
bleTool.addStateRecoveryCallback(this.bleStateRecovry, "HBY100J"); bleTool.addStateRecoveryCallback(this.bleStateRecovry, "HBY100J");
// 尝试连接蓝牙
if (data.data.deviceMac) {
// 假设 deviceMac 是蓝牙的 deviceId
bleTool.LinkBlue(data.data.deviceMac).then(() => {
console.log("100J 蓝牙连接成功");
this.bleStateRecovry({deviceId: data.data.deviceMac});
}).catch(err => {
console.log("100J 蓝牙连接失败将使用4G", err);
});
}
}, },
onHide: function() { onHide: function() {
@ -990,7 +1004,7 @@
bleValueNotify: function(receive, device, path, recArr) { //订阅消息 bleValueNotify: function(receive, device, path, recArr) { //订阅消息
// 注意:这里 receive.deviceId 是蓝牙的 MAC 地址,而 this.formData.deviceId 是 4G 的 ID // 注意:这里 receive.deviceId 是蓝牙的 MAC 地址,而 this.formData.deviceId 是 4G 的 ID
// 所以这里需要修改判断逻辑,或者不判断直接解析 // 所以这里需要修改判断逻辑,或者不判断直接解析
// 尝试解析蓝牙上报的数据 // 尝试解析蓝牙上报的数据
if (receive.bytes) { if (receive.bytes) {
const parsedData = parseBleData(receive.bytes); const parsedData = parseBleData(receive.bytes);