Forráskód Böngészése

Merge branch 'develop/3.2.7' of http://60.205.190.38:9000/zhaoheqing/wxmini into develop/3.2.7

zeng.chen 5 hónapja
szülő
commit
50e8d6288c
2 módosított fájl, 22 hozzáadás és 16 törlés
  1. 17 14
      pages/index/index.js
  2. 5 2
      utils/lexin/message.js

+ 17 - 14
pages/index/index.js

@@ -79,7 +79,7 @@ Page({
 
     deviceMacId: null,
     deviceListSelect: null,
-    deviceList:[],
+    deviceList: [],
     // deviceList: [{
     //   "connectType": 3,
     //   // "mac": "AIrSMArT_861210052356337",
@@ -630,14 +630,16 @@ Page({
     } else if (device.state === "offline") {
 
       var deviceListSelect = that.getDeviceListSelect();
-      if (deviceListSelect != null && deviceList.length > deviceListSelect) {
+      if (deviceListSelect != null) {
+        if (deviceList.length > deviceListSelect) {
+          var currentDevice = deviceList[deviceListSelect];
+          console.log("断开连接0", currentDevice)
+          // 现断线第一个
+          // that.disconnectFirst()
+        }
         that.setData({
           deviceListSelect: null,
         });
-        var currentDevice = deviceList[deviceListSelect];
-        console.log("断开连接0", currentDevice)
-        // 现断线第一个
-        // that.disconnectFirst()
       }
       console.log("断开连接2", device)
 
@@ -651,17 +653,18 @@ Page({
     } else {
       var deviceList = that.getDeviceList();
       var deviceListSelect = that.getDeviceListSelect();
-      if (deviceListSelect != null && deviceList.length > deviceListSelect) {
+      if (deviceListSelect != null) {
+        if (deviceList.length > deviceListSelect) {
+          var currentDevice = deviceList[deviceListSelect];
+          if (currentDevice.connectType === 1) {
+            console.log("断开连接1", currentDevice)
+            await BtHelper.getInstance().disconnect(currentDevice);
+          }
+          // await time_util.delayMills(500);
+        }
         that.setData({
           deviceListSelect: null,
         });
-        var currentDevice = deviceList[deviceListSelect];
-        if (currentDevice.connectType === 1) {
-          console.log("断开连接1", currentDevice)
-          await BtHelper.getInstance().disconnect(currentDevice);
-
-        }
-        // await time_util.delayMills(500);
       }
 
       device.name = device.devName;

+ 5 - 2
utils/lexin/message.js

@@ -45,7 +45,7 @@ function getDeviceInfo(payloads) {
         var device = deviceList[i];
         var deviceId = device.deviceId;
         if (device.connectType != 3) {
-          continue
+          continue;
         }
         var mac = lexin_util.getMacByDeviceId(deviceId);
         var index = SrcDeviceName.indexOf(mac);
@@ -102,7 +102,10 @@ function getDeviceInfo(payloads) {
         var clientTypes = lexin_devices.clientTypes;
         for (var i = 0; i < clientTypes.length; i++) {
           if (clientTypes[i] == targetDevice.ProdModel) {
-            pages[0].refreshCurrentDevice(device);
+            var deviceListSelect = pages[0].getDeviceListSelect();
+            if (deviceListSelect == null) {
+              pages[0].refreshCurrentDevice(device);
+            }
             break;
           }
         }