Forráskód Böngészése

feature: 自动搜索时间长度处理

Damon 7 hónapja
szülő
commit
39dde83614
1 módosított fájl, 9 hozzáadás és 8 törlés
  1. 9 8
      pages/index/index.js

+ 9 - 8
pages/index/index.js

@@ -6,6 +6,7 @@ const {
 
 import timeUtil from '../../utils/time_util.js';
 import strings from '../../utils/strings.js';
+import store from '../../utils/store.js';
 import route_constant from '../../utils/route_constant.js';
 import route_util from '../../utils/route_util.js';
 import {
@@ -129,12 +130,11 @@ Page({
   onDeviceLoad() {
     var that = this;
     // BtHelper.getInstance().initBluetoothAdapter();
-    var l = wx.getStorageSync("deviceList");
+    var l = store.getStore("deviceList");
     if (!strings.isEmpty(l)) {
       try {
-        var list = JSON.parse(l);
-        that.updateDeviceList(list, true);
-      } catch (e) { }
+        that.updateDeviceList(l, true);
+      } catch (e) {}
       // that.tryConnectBle()
     }
 
@@ -820,7 +820,8 @@ Page({
     const deviceList = that.data.deviceList.filter((item, i) => {
       return id !== item.deviceId
     });
-    wx.setStorageSync("deviceList", JSON.stringify(deviceList));
+
+    store.setStore("deviceList", deviceList);
     that.setData({
       deviceList,
     });
@@ -847,7 +848,7 @@ Page({
       return id !== item.deviceId
     });
 
-    wx.setStorageSync("deviceList", JSON.stringify(deviceList));
+    store.setStore("deviceList", deviceList);
     that.setData({
       deviceList,
       thisDeviceMac: null
@@ -1039,8 +1040,8 @@ Page({
     });
     finalList = finalList.concat(onNoLineWifiList);
     finalList = finalList.concat(onNoLineBlueList);
-    // 更新缓存
-    wx.setStorageSync("deviceList", JSON.stringify(finalList));
+
+    store.setStore("deviceList", deviceList);
     that.setData({
       deviceList: finalList
     });