Prechádzať zdrojové kódy

feature:增加首页点击的蓝牙判断

zeng.chen 8 mesiacov pred
rodič
commit
8ef57056dd
2 zmenil súbory, kde vykonal 15 pridanie a 3 odobranie
  1. 5 1
      pages/deviceDetail/detail.js
  2. 10 2
      pages/index/index.js

+ 5 - 1
pages/deviceDetail/detail.js

@@ -83,7 +83,11 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    let device = JSON.parse(options.param);
+    // let device = JSON.parse(options.param);
+    let device = getApp().globalData.mDeviceList[0];
+    if (device.connectType != '1') {
+      return
+    }
     device.clientType = device.clientType ?? device.ProdModel
 
     console.log("设备详情", device)

+ 10 - 2
pages/index/index.js

@@ -121,7 +121,7 @@ Page({
               that.addConnectBlueDevice(connectDevice);
             }
           })
-        } else {}
+        } else { }
       })
     }
   },
@@ -675,9 +675,12 @@ Page({
       return;
     }
 
+    if (item.connect != "1") {
+      return
+    }
     ///去蓝牙连接处理
     if (e.currentTarget.dataset.index === that.data.deviceListIndex) {
-      console.log(item)
+      // 蓝牙才能连接
       route_util.jumpParam('/pages/deviceDetail/detail', JSON.stringify(item))
     } else if (item.state === "offline") {
       console.log("去连接蓝牙")
@@ -934,6 +937,11 @@ Page({
     finalList = finalList.concat(onLineWifiList);
     finalList = finalList.concat(onLineNoWifiList);
 
+    let mDeviceList = []
+    mDeviceList = mDeviceList.concat(onLineWifiList);
+    mDeviceList = mDeviceList.concat(onLineNoWifiList);
+    getApp().globalData.mDeviceList = mDeviceList;
+
     ///区分离线wifi和蓝牙 wifi在前 离线在后
     var onNoLineWifiList = [];
     var onNoLineNoWifiList = [];