1
0
forked from dyf/APP

修复蓝牙配对时,连接成功马上断开,再次连接提示正在连接中的问题

This commit is contained in:
liub
2026-05-20 14:18:28 +08:00
parent 958aa1374a
commit 6ec6003d3c
3 changed files with 13 additions and 9 deletions

View File

@ -624,6 +624,9 @@
this.$watch("formData.sta_PowerPercent", (newVal, oldVal) => { this.$watch("formData.sta_PowerPercent", (newVal, oldVal) => {
console.log("电量发生变化"); console.log("电量发生变化");
if(!newVal){
return;
}
if (newVal <= 20 && (this.formData.sta_system === 2 || this.formData.sta_system === 0)) { if (newVal <= 20 && (this.formData.sta_system === 2 || this.formData.sta_system === 0)) {
//电量在20%及以及下,且是未充电状态提醒 //电量在20%及以及下,且是未充电状态提醒
showPop({ showPop({

View File

@ -310,15 +310,12 @@
if (these.Status.isPageHidden) { if (these.Status.isPageHidden) {
return; return;
} }
// console.log("处理蓝牙断开连接"); console.log("处理蓝牙断开连接");
if(res.deviceId==this.item.deviceId){
these.item.deviceId = null;
these.refreshLinked(); these.refreshLinked();
setTimeout(() => {
hideLoading(these);
clearInterval(these.Status.intval); clearInterval(these.Status.intval);
}, 1500); }
}, pagePath); }, pagePath);

View File

@ -946,7 +946,9 @@ class BleHelper {
return false; return false;
}); });
this.updateCache(); this.updateCache();
if (f && f.device && f.device.id && this.data.available) { if (f && f.device && f.device.id && this.data.available) {
//已绑定过的设备尝试重连
let fdis = this.data.Disconnect.find(dis => { let fdis = this.data.Disconnect.find(dis => {
return dis === res.deviceId return dis === res.deviceId
}); //用户主动断开的,不再重连 }); //用户主动断开的,不再重连
@ -967,6 +969,9 @@ class BleHelper {
} }
}else{
//未绑定过的设备播放连接锁
delete this.data.connectingDevices[res.deviceId];
} }
if (this.cfg.bleDisposeCallback.length > 0) { if (this.cfg.bleDisposeCallback.length > 0) {
@ -1626,7 +1631,6 @@ class BleHelper {
} }
} }
if (this.data.platform == 'web') { if (this.data.platform == 'web') {
LinkedCallback(); LinkedCallback();
return Promise.resolve(true); return Promise.resolve(true);