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

feature: 处理wifi请求接口类型给错误的问题

Damon пре 7 месеци
родитељ
комит
7be37bfb72
2 измењених фајлова са 19 додато и 24 уклоњено
  1. 12 18
      pages/deviceList/deviceList.js
  2. 7 6
      pages/index/index.js

+ 12 - 18
pages/deviceList/deviceList.js

@@ -3,10 +3,6 @@ import dRequest from '../../request/deviceListRequest'
 import routeUtil from '../../utils/route_util'
 import route_constant from '../../utils/route_constant.js'
 Page({
-
-  /**
-   * 页面的初始数据
-   */
   data: {
     deviceList: [
 
@@ -17,20 +13,6 @@ Page({
     },
   },
 
-  deviceTap(e) {
-    console.log(e)
-    let device = e.currentTarget.dataset.device
-    if (!device) {
-      console.log("设备为空")
-      return;
-    }
-    let param = JSON.stringify(device)
-    routeUtil.jumpParam(route_constant.connectMode, param)
-    // routeUtil.jumpParam('/pages/piano/wallpaper/wallpaper', param)
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
   onLoad(options) {
     let _this = this
     let app = getApp()
@@ -64,4 +46,16 @@ Page({
 
   },
 
+  deviceTap(e) {
+    console.log(e)
+    let device = e.currentTarget.dataset.device
+    if (!device) {
+      console.log("设备为空")
+      return;
+    }
+    let param = JSON.stringify(device)
+    routeUtil.jumpParam(route_constant.connectMode, param)
+    // routeUtil.jumpParam('/pages/piano/wallpaper/wallpaper', param)
+  },
+
 })

+ 7 - 6
pages/index/index.js

@@ -256,10 +256,10 @@ Page({
               });
             }
           });
+
           // 更新信息
-          ///连上就调用2次
+          ///连上就调用2次 payloads.SrcDeviceName:AIrSMArT_7cdfa1fcbb24
           var isUpdate = false;
-          // payloads.SrcDeviceName:AIrSMArT_7cdfa1fcbb24
           var deviceList = that.data.deviceList;
           if (!strings.isEmpty(deviceList)) {
             for (var i = 0; i < deviceList.length; i++) {
@@ -268,7 +268,7 @@ Page({
                 var splitDeviceId = deviceId.split("BLUFI_");
                 if (splitDeviceId.length == 2) {
                   var index = payloads.SrcDeviceName.indexOf(splitDeviceId[1]);
-                  if (index !== -1 && deviceList[i].ProdModel != payloads.other.ProdModel && deviceList[i].devName != payloads.other.devName) {
+                  if (index !== -1 && (deviceList[i].ProdModel != payloads.other.ProdModel || deviceList[i].devName != payloads.other.devName)) {
                     isUpdate = true;
                     deviceList[i].ProdModel = payloads.other.ProdModel;
                     deviceList[i].devName = payloads.other.devName;
@@ -664,9 +664,11 @@ Page({
       return;
     };
 
-    console.log("gadsfqwwerqwerqweqr====" + JSON.stringify(that.data.deviceList[that.data.deviceListIndex]));
+    var deviceList = that.data.deviceList;
+    var deviceListIndex = that.data.deviceListIndex;
+    var device = deviceList[deviceListIndex];
     wx.navigateTo({
-      url: './../deviceWake/deviceWake?deviceId=' + that.data.deviceList[that.data.deviceListIndex].deviceId + "&clientType=" + that.data.deviceList[that.data.deviceListIndex].ProdModel,
+      url: './../deviceWake/deviceWake?deviceId=' + device.deviceId + "&clientType=" + device.ProdModel,
     });
   },
 
@@ -887,7 +889,6 @@ Page({
       deviceId: newDevice.deviceId,
       name: "猫王小王子OTR-X",
       state: "online",
-      ProdModel: 3,
       devName: "猫王小王子OTR-X",
       mac: newDevice.deviceId,
       image: "./../../img/min.png",