Преглед изворни кода

feature: 修复连接蓝牙自动连接wifi设备

Damon пре 7 месеци
родитељ
комит
43e7fa01aa
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      pages/index/index.js

+ 6 - 1
pages/index/index.js

@@ -371,7 +371,7 @@ Page({
     var deviceList = that.data.deviceList;
     if (!strings.isEmpty(deviceList)) {
       for (var i = 0; i < deviceList.length; i++) {
-        if (deviceList[i].connectType == 3) {
+        if (deviceList[i].connectType == 3 && device.state == "online") {
           let topic = `/AIrSMArT_${deviceList[i].deviceId.split("BLUFI_")[1]}/status/onoffline`;
           app.subscribe(topic);
         }
@@ -632,6 +632,10 @@ Page({
     };
 
     var device = deviceList[deviceListSelect];
+    if (device.connectType != 3 || device.state != "online") {
+      return;
+    }
+
     var tempDeviceId = device.deviceId;
     ///删除当前选中这个
     deviceList.splice(deviceListSelect, 1);
@@ -666,6 +670,7 @@ Page({
     };
 
     var device = deviceList[deviceListSelect];
+    console.log("gasdfasdfqweqrwq====" + device.ProdModel);
     wx.navigateTo({
       url: './../deviceWake/deviceWake?deviceId=' + device.deviceId + "&clientType=" + device.ProdModel,
     });