Browse Source

fix:修改黑胶连接成功的更新列表方法

zeng.chen 2 tháng trước cách đây
mục cha
commit
0f0e8782f2
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      pages/pageA/index/index.js

+ 8 - 2
pages/pageA/index/index.js

@@ -233,7 +233,7 @@ Page({
         console.log("自动连接成功", isConnected)
         if (isConnected) {
           device.state = 'online';
-          that.addBlueDevice(device);
+          that.updateDeviceList(device);
           that.stopIntervalId1();
         } else {
           device.state = 'offline';
@@ -270,6 +270,7 @@ Page({
         case "message_onoffline":
           constant.lexinConnect.searchOnlineDevice(payloads, function (list) {
             that.updateDeviceList(list, false, false);
+            that.stopIntervalId1()
           }, function () {
             var indexPage = that.data.indexPage;
             that.setData({
@@ -277,6 +278,7 @@ Page({
               deviceListSelect: null,
               indexPage: indexPage == 1 ? 0 : indexPage,
             });
+            that.startBleTimer();
           }, function () {
             var indexPage = that.data.indexPage;
             that.setData({
@@ -284,6 +286,8 @@ Page({
               deviceListSelect: null,
               indexPage: indexPage == 1 ? 0 : indexPage,
             });
+            that.startBleTimer();
+
           });
           break;
 
@@ -770,7 +774,9 @@ Page({
       return;
     }
     console.log("断开连接--", event.commonValue, event.deviceId);
-    if (event.deviceId === device.deviceId && event.commonValue === "offline" && !_this.data._hasShowModal) {
+    var selectDev = _this.getCurrentDevice()
+    var isSelect = selectDev == null || (selectDev != null) && selectDev.deviceId === event.deviceId
+    if (isSelect && selectDev.deviceId === event.deviceId && event.deviceId === device.deviceId && event.commonValue === "offline" && !_this.data._hasShowModal) {
       _this.data._hasShowModal = true
       wx.showModal({
         title: '提示',