Browse Source

feature: 解决其他设备掉线,提示当前设备掉线的问题

Damon 7 tháng trước cách đây
mục cha
commit
6adc7324fb
2 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 3 3
      pages/deviceWake/deviceWake.js
  2. 2 1
      pages/index/index.js

+ 3 - 3
pages/deviceWake/deviceWake.js

@@ -75,6 +75,7 @@ Page({
 
     that.data.deviceId = deviceId;
     that.data.deviceMac = deviceMac;
+    console.log("gadfqwerqwerq===00===" + that.data.deviceMac);
     that.data.clientType = clientType;
     // var deviceMac = `AIrSMArT_${deviceId.split(lexin_devices.leXin)[1]}`;
 
@@ -122,9 +123,8 @@ Page({
     switch (type) {
       case "message_onoffline":
         if (payloads.state !== "online") {
-          var pages = getCurrentPages();
-          var deviceId = pages[0].getCurrentDeviceId();
-          var deviceMacId = lexin_util.getDeviceMacId(deviceId);
+          // option.payload: {"uuid":"AIrSMArT_7cdfa1fcbb24","state":"offline","userid":"1"}
+          var deviceMacId = payloads.uuid;
           if (deviceMacId == that.data.deviceMac) {
             wx.showToast({
               title: '设备已断开连接',

+ 2 - 1
pages/index/index.js

@@ -814,7 +814,8 @@ Page({
     if (deviceListSelect === null || deviceList.length <= deviceListSelect) {
       return "";
     };
-    return deviceList[deviceListSelect].deviceId;
+    var deviceId = deviceList[deviceListSelect].deviceId;
+    return deviceId;
   },
 
   ///设置设备相关信息