Browse Source

feature: 处理进入频道信息,各设备展示处理

Damon 7 tháng trước cách đây
mục cha
commit
43d01cdf88
2 tập tin đã thay đổi với 9 bổ sung5 xóa
  1. 7 2
      pages/deviceConnect2/deviceConnect2.js
  2. 2 3
      pages/index/index.js

+ 7 - 2
pages/deviceConnect2/deviceConnect2.js

@@ -1,5 +1,6 @@
 const app = getApp();
 let xBlufi = require("../../utils/blufi/xBlufi.js");
+import strings from '../../utils/strings.js';
 import lexin_devices from '../../utils/lexin/devices';
 Page({
 
@@ -84,11 +85,15 @@ Page({
       case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
         // 搜索到蓝牙
         if (options.result) {
-          if (options.data.filter((v) => v.name.indexOf(lexin_devices.leXin) !== -1).length > 0) {
+          var devicesList = options.data.filter((v) => {
+            return v.name.indexOf(lexin_devices.leXin) !== -1;
+          });
+
+          if (!strings.isEmpty(devicesList)) {
             ///过滤乐鑫设备
             that.setData({
               islanya: true,
-              devicesList: options.data.filter((v) => v.name.indexOf(lexin_devices.leXin) !== -1)
+              devicesList: devicesList,
             });
           }
         }

+ 2 - 3
pages/index/index.js

@@ -310,12 +310,12 @@ Page({
   onTapToChannel() {
     var that = this;
     var actionIndex = that.data.actionIndex;
-    if (!strings.isEmpty(actionIndex)) {
+    if (strings.isEmpty(actionIndex)) {
       return;
     }
     var channelData = that.getChannelData();
     if (channelData.length > actionIndex) {
-      wx.setStorageSync("channelDeta", channelData[that.data.actionIndex]);
+      wx.setStorageSync("channelDeta", channelData[actionIndex]);
       wx.navigateTo({
         url: './../channelDetails/channelDetails'
       });
@@ -426,7 +426,6 @@ Page({
     if (deviceListSelect === null || deviceList.length <= deviceListSelect) {
       return
     };
-
     var device = deviceList[deviceListSelect];
     wx.navigateTo({
       url: './../deviceWake/deviceWake?deviceId=' + device.deviceId + "&clientType=" + device.ProdModel,