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

@ -109,7 +109,7 @@
</view>
</view>
<view class="mode fleft " :class="{active:Status.sendDisc}" v-on:click.stop="discern()">
<view class="mode fleft " :class="{active:Status.sendDisc}" v-on:click.stop="discern()">
<view class="leftImg">
<image class="img" src="/static/images/common/svg.png" mode="aspectFit"></image>
@ -324,7 +324,7 @@
apiType: 'listA'
}],
title: 'BJQ4877',
height:90
height: 90
},
ShowEditChannel: false,
@ -448,8 +448,8 @@
},
}
},
created() {
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
created() {
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
},
onUnload() {
console.log("页面卸载,释放资源");
@ -531,14 +531,7 @@
});
})
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
// console.log("找到设备了", v);
these.formData.deviceId = v.deviceId;
return true;
}
return false;
});
let f = these.getDevice();
if (!f) {
@ -1014,21 +1007,21 @@
this.Status.sendDisc = true;
let sendNextPacket = () => {
if(index>total){
if (index > total) {
this.Status.sendDisc = false;
return;
}
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
index++;
setTimeout(sendNextPacket,300);
setTimeout(sendNextPacket, 300);
}).catch(err => {
if (err.code == '10007') {
setTimeout(sendNextPacket, 800);
return;
}
if(index==0){
MsgError(err.msg,'',these);
if (index == 0) {
MsgError(err.msg, '', these);
}
this.Status.sendDisc = false;
});
@ -1122,7 +1115,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
}
},
@ -1271,12 +1264,23 @@
},
getDevice: function() {
console.log("LinkedList=", ble.data.LinkedList);
console.log("formData=", these.device);
let f = ble.data.LinkedList.find((v) => {
return v.macAddress == these.device.deviceMac;
let flag = v.macAddress == these.device.deviceMac;
if (!flag && v.device) {
flag = v.device.id == these.device.id;
}
if (flag) {
these.formData.deviceId = v.deviceId;
}
return flag;
});
// #ifdef WEB
f = {
deviceId: '123'
}
// #endif
return f;
},
@ -1614,7 +1618,8 @@
border-color: #aed600 !important;
}
.lampMode .mode.active .bigTxt,.lampMode .mode.active .smallTxt {
.lampMode .mode.active .bigTxt,
.lampMode .mode.active .smallTxt {
color: #aed600 !important;
}