|
@@ -19,7 +19,6 @@ Page({
|
|
alarm_id_0_time: "00:00:00",
|
|
alarm_id_0_time: "00:00:00",
|
|
switch2Checked: false,
|
|
switch2Checked: false,
|
|
deviceMac: null,
|
|
deviceMac: null,
|
|
- devicerStatus: false, // false 已断开连接
|
|
|
|
alarm_id_0: {}, // 休眠
|
|
alarm_id_0: {}, // 休眠
|
|
alarm_id_1: {}, // 唤醒
|
|
alarm_id_1: {}, // 唤醒
|
|
timeindex: 1,
|
|
timeindex: 1,
|
|
@@ -69,11 +68,16 @@ Page({
|
|
|
|
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
var that = this;
|
|
var that = this;
|
|
- var clientType = options.clientType;
|
|
|
|
|
|
+
|
|
var deviceId = options.deviceId;
|
|
var deviceId = options.deviceId;
|
|
- that.data.deviceId = deviceId;
|
|
|
|
|
|
+ var clientType = options.clientType;
|
|
var deviceMac = lexin_util.getDeviceMacId(deviceId);
|
|
var deviceMac = lexin_util.getDeviceMacId(deviceId);
|
|
|
|
+
|
|
|
|
+ that.data.deviceId = deviceId;
|
|
|
|
+ that.data.deviceMac = deviceMac;
|
|
|
|
+ that.data.clientType = clientType;
|
|
// var deviceMac = `AIrSMArT_${deviceId.split(lexin_devices.leXin)[1]}`;
|
|
// var deviceMac = `AIrSMArT_${deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
|
+
|
|
deviceWakedetail({
|
|
deviceWakedetail({
|
|
clientType: clientType,
|
|
clientType: clientType,
|
|
deviceMac: deviceMac,
|
|
deviceMac: deviceMac,
|
|
@@ -84,12 +88,9 @@ Page({
|
|
});
|
|
});
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- that.data.clientType = options.clientType
|
|
|
|
- that.data.deviceMac = lexin_util.getDeviceMacId(options.deviceId);
|
|
|
|
- // that.data.deviceMac = `AIrSMArT_${options.deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
|
app.PubMsg({
|
|
app.PubMsg({
|
|
type: "get_dev_info",
|
|
type: "get_dev_info",
|
|
- DstDeviceName: that.data.deviceMac
|
|
|
|
|
|
+ DstDeviceName: deviceMac
|
|
});
|
|
});
|
|
|
|
|
|
// 赋值按钮回调
|
|
// 赋值按钮回调
|
|
@@ -117,22 +118,20 @@ Page({
|
|
if (option) {
|
|
if (option) {
|
|
payloads = JSON.parse(option.payload);
|
|
payloads = JSON.parse(option.payload);
|
|
};
|
|
};
|
|
- console.log(payloads)
|
|
|
|
|
|
+
|
|
switch (type) {
|
|
switch (type) {
|
|
case "message_onoffline":
|
|
case "message_onoffline":
|
|
if (payloads.state !== "online") {
|
|
if (payloads.state !== "online") {
|
|
- wx.showToast({
|
|
|
|
- title: '设备已断开连接',
|
|
|
|
- icon: 'none',
|
|
|
|
- duration: 2000
|
|
|
|
- });
|
|
|
|
- that.setData({
|
|
|
|
- devicerStatus: false,
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- that.setData({
|
|
|
|
- devicerStatus: true,
|
|
|
|
- })
|
|
|
|
|
|
+ var pages = getCurrentPages();
|
|
|
|
+ var deviceId = pages[0].getCurrentDeviceId();
|
|
|
|
+ var deviceMacId = lexin_util.getDeviceMacId(deviceId);
|
|
|
|
+ if (deviceMacId == that.data.deviceMac) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '设备已断开连接',
|
|
|
|
+ icon: 'none',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case "message":
|
|
case "message":
|