浏览代码

feature: 处理蓝牙添加设备丢失设备的问题

332777428@qq.com 6 月之前
父节点
当前提交
b64d435d5a
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 6 7
      utils/lexin/add.js

+ 6 - 7
utils/lexin/add.js

@@ -13,13 +13,12 @@ function addBlueDevice(device) {
   // 同一个设备处理
   var pages = getCurrentPages();
   var deviceList = pages[0].getDeviceList();
-  var tempList = deviceList.filter((v) => v.deviceId === device.deviceId);
-  const strings = require('../strings');
-  if (!strings.isEmpty(tempList)) {
-    deviceList = tempList.filter((v) => v.deviceId !== device.deviceId);
-  }
+  var finalList = deviceList.filter((v) => {
+    return v.deviceId != device.deviceId;
+  });
+
   /// 添加到第一个
-  deviceList.unshift({
+  finalList.unshift({
     connectType: 1,
     devName: device.name,
     state: "online",
@@ -30,7 +29,7 @@ function addBlueDevice(device) {
     clientType: device.clientType || device.ProdModel,
     imageUrl: device.imageUrl,
   });
-  return deviceList;
+  return finalList;
 };
 
 // 新添加Wifi设备  猫王小王子OTR-X