1
0
forked from dyf/APP

修复有时候蓝牙配对成功依然提示未连接的异常

This commit is contained in:
liub
2026-05-20 10:58:55 +08:00
parent 7ed3813e7c
commit 7f56e46ace
19 changed files with 1031 additions and 914 deletions

View File

@ -58,7 +58,7 @@
</view>
<view class="list searchList">
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
v-show="item.name.indexOf(search)>-1">
v-show="item.name.toLowerCase().indexOf(search.toLowerCase())>-1">
<view class="before" v-if="item.isTarget"></view>
<view class="leftImg ">
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="heightFix">
@ -131,7 +131,7 @@
var ble = null;
var these = null;
var eventChannel = null;
var sortTime=null;
export default {
data() {
return {
@ -362,15 +362,18 @@
device.isTarget = true;
}
if (device.name) {
device.name = device.name.replace(/^JQZM-/i, '').replace(/^HBY102J-/i, '');
device.name = device.name.replace(/^HBY102J-/i, '');
}
these.EquipMents.push(device);
}
}
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
clearTimeout(sortTime);
sortTime=setTimeout(()=>{
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI);
},500);
}, pagePath);
@ -632,9 +635,9 @@
}
hideLoading(these);
these.device.bleId=deviceId;
eventChannel.emit('BindOver', these.device);
ble.updateCache();
eventChannel.emit('BindOver', these.device);
uni.navigateBack();
}
@ -642,7 +645,8 @@
if (f && f.macAddress) {
if (!these.device || !these.device.deviceMac) { //走服务端验证
console.error("走服务端验证")
console.error("理论上永远不会走这里,走服务端验证");
console.error("我TM太相信理论了");
request({
url: '/app/device/getDeviceInfoByDeviceMac',
method: 'GET',
@ -650,8 +654,6 @@
deviceMac: f.macAddress
}
}).then(res => {
if (res && res.code == 200) {
let data = res.data;
@ -701,17 +703,7 @@
clearInterval(this.Status.intval)
this.Status.intval = null;
this.Status.time = null;
f = ble.data.LinkedList.find(v => {
if (v.deviceId == deviceId) {
v.device = these.device;
return true;
}
return false;
});
if (!(f && f.macAddress)) {
deviceInvalid()
return;
}
deviceInvalid();
return;
}