1
0
forked from dyf/APP

Compare commits

..

2 Commits

4 changed files with 55 additions and 42 deletions

View File

@ -215,7 +215,7 @@
sta_leftFan: null, sta_leftFan: null,
sta_rightFan: null, sta_rightFan: null,
sta_channel: null, sta_channel: null,
sta_Ms: null, sta_Ms: 'S',
sta_PowerPercent: null, sta_PowerPercent: null,
sta_PowerTime: null, sta_PowerTime: null,
sta_system: null, sta_system: null,
@ -1010,10 +1010,11 @@
border-width: 5rpx; border-width: 5rpx;
border-color: #00000000; border-color: #00000000;
padding: 5rpx; padding: 5rpx;
height:130rpx !important;
} }
.lampMode .type .txt { .lampMode .type .txt {
color: rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.5);
background-color: #00000000; background-color: #00000000;
font-family: "PingFang SC"; font-family: "PingFang SC";
font-size: 50rpx; font-size: 50rpx;

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

@ -276,7 +276,7 @@
} }
console.log("处理蓝牙不可用"); console.log("处理蓝牙不可用");
hideLoading(these); hideLoading(these);
clearInterval(these.Status.intval);
these.PairEquip = []; these.PairEquip = [];
these.EquipMents = []; these.EquipMents = [];
uni.showToast({ uni.showToast({
@ -310,14 +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();
clearInterval(these.Status.intval);
setTimeout(() => { }
hideLoading(these);
}, 1500);
}, pagePath); }, pagePath);
@ -409,9 +407,12 @@
return; return;
} }
if ((receivData.str && (receivData.str.indexOf('mac address:') > -1 || receivData.str.indexOf( if (f.deviceId == this.item.deviceId) {//只处理本次连接的设备消息
if ((receivData.str && (receivData.str.indexOf('mac address:') > -1 || receivData
.str.indexOf(
'sta_address') > -1)) || 'sta_address') > -1)) ||
(receivData.bytes && receivData.bytes[0] === 0xFC && receivData.bytes.length >= 7)) { (receivData.bytes && receivData.bytes[0] === 0xFC && receivData.bytes.length >=
7)) {
if (f.macAddress && these.device) { if (f.macAddress && these.device) {
@ -428,6 +429,7 @@
}, 0); }, 0);
} }
} }
}
}, pagePath); }, pagePath);
} }
} }
@ -721,9 +723,9 @@
return false; return false;
}, },
Link: function(item) { Link: function(item) {
this.item.deviceId = item.deviceId;
showLoading(this, { showLoading(this, {
text: "正在连接:第1次" text: "正在连接..."
}); });
let index = 1; let index = 1;
@ -761,15 +763,18 @@
ble.LinkBlue(item.deviceId).then((res) => { ble.LinkBlue(item.deviceId).then((res) => {
this.tmpLink = [item]; this.tmpLink = [item];
console.log("连接成功"); console.log("连接成功");
ble.StopSearch(); these.item.deviceId = item.deviceId;
ble.StopSearch().catch(ex=>{});
resolve(res); resolve(res);
}).catch((ex) => { }).catch((ex) => {
if (index == total) { if (index == total) {
console.log("连接了N次都没连上"); console.log("连接了N次都没连上");
reject(ex); reject(ex);
updateLoading(this, { updateLoading(this, {
text: ex.msg text: ex.msg
}) });
this.item.deviceId =null;
return; return;
} }
index++; index++;

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);