|
@@ -292,7 +292,16 @@ Page({
|
|
|
case "message_onoffline":
|
|
|
constant.lexinConnect.searchOnlineDevice(payloads, function (list) {
|
|
|
that.updateDeviceList(list, false, false);
|
|
|
- that.stopIntervalId1()
|
|
|
+ let hasOnline = that.data.deviceList.find(item => {
|
|
|
+ return item.state === 'online';
|
|
|
+ });
|
|
|
+ if (hasOnline) {
|
|
|
+ console.log("停止蓝牙监听1:",)
|
|
|
+ that.stopIntervalId1()
|
|
|
+ } else {
|
|
|
+ console.log("开启蓝牙监听1:",)
|
|
|
+ that.startBleTimer(true, false);
|
|
|
+ }
|
|
|
}, function () {
|
|
|
var indexPage = that.data.indexPage;
|
|
|
that.setData({
|
|
@@ -300,9 +309,7 @@ Page({
|
|
|
deviceListSelect: null,
|
|
|
indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
});
|
|
|
- console.log("开启蓝牙监听1:",)
|
|
|
|
|
|
- that.startBleTimer(true, false);
|
|
|
}, function () {
|
|
|
var indexPage = that.data.indexPage;
|
|
|
that.setData({
|
|
@@ -310,10 +317,6 @@ Page({
|
|
|
deviceListSelect: null,
|
|
|
indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
});
|
|
|
- console.log("开启蓝牙监听2:",)
|
|
|
-
|
|
|
- that.startBleTimer(true, false);
|
|
|
-
|
|
|
});
|
|
|
break;
|
|
|
|