|
@@ -7,6 +7,7 @@ const {
|
|
|
deviceWakedetail
|
|
|
} = require('./../../utils/api.js');
|
|
|
import lexin_devices from '../../utils/lexin/devices';
|
|
|
+import lexin_util from '../../utils/lexin/util.js';
|
|
|
|
|
|
let _this = null
|
|
|
Page({
|
|
@@ -76,9 +77,13 @@ Page({
|
|
|
onLoad(options) {
|
|
|
_this = this;
|
|
|
|
|
|
+ var clientType = options.clientType;
|
|
|
+ var deviceId = options.deviceId;
|
|
|
+ var deviceMac = lexin_util.getDeviceMacId(deviceId);
|
|
|
+ // var deviceMac = `AIrSMArT_${deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
deviceWakedetail({
|
|
|
- clientType: options.clientType,
|
|
|
- deviceMac: `AIrSMArT_${options.deviceId.split(lexin_devices.leXin)[1]}`,
|
|
|
+ clientType: clientType,
|
|
|
+ deviceMac: deviceMac,
|
|
|
}).then((res) => {
|
|
|
if (res && res.length > 0) {
|
|
|
this.setData({
|
|
@@ -87,7 +92,8 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
this.data.clientType = options.clientType
|
|
|
- this.data.deviceMac = `AIrSMArT_${options.deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
+ this.data.deviceMac = lexin_util.getDeviceMacId(options.deviceId);
|
|
|
+ // this.data.deviceMac = `AIrSMArT_${options.deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
app.PubMsg({
|
|
|
type: "get_dev_info",
|
|
|
DstDeviceName: this.data.deviceMac
|
|
@@ -241,7 +247,7 @@ Page({
|
|
|
other.on_off_timestamp = _this.data.alarm_id_0_time;
|
|
|
|
|
|
// 有重复
|
|
|
- if (other.week_actives.filter((v) => v === 1).length > 0) {
|
|
|
+ if (other.week_actives && other.week_actives.filter((v) => v === 1).length > 0) {
|
|
|
// other.week_actives = [0,1,1,1,1,1,0],
|
|
|
other.weekly_repeat = "1";
|
|
|
} else {
|
|
@@ -285,67 +291,67 @@ Page({
|
|
|
if (!other) {
|
|
|
wx.showToast({
|
|
|
title: '设备已断开连接',
|
|
|
- icon:"none"
|
|
|
+ icon: "none"
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
other.on_off_timestamp = _this.data.time;
|
|
|
- other = this.setOther(other, 1);
|
|
|
- let week_actives = other.week_actives ?? []
|
|
|
- if (week_actives.filter((v) => v === 1).length > 0) {
|
|
|
- // other.week_actives = [0,1,1,1,1,1,0],
|
|
|
- other.weekly_repeat = "1";
|
|
|
- } else {
|
|
|
- other.weekly_repeat = "0";
|
|
|
- };
|
|
|
- app.PubMsg({
|
|
|
- type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
- other
|
|
|
- });
|
|
|
+ other = this.setOther(other, 1);
|
|
|
+ let week_actives = other.week_actives ?? []
|
|
|
+ if (week_actives.filter((v) => v === 1).length > 0) {
|
|
|
+ // other.week_actives = [0,1,1,1,1,1,0],
|
|
|
+ other.weekly_repeat = "1";
|
|
|
+ } else {
|
|
|
+ other.weekly_repeat = "0";
|
|
|
+ };
|
|
|
+ app.PubMsg({
|
|
|
+ type: "alert_set",
|
|
|
+ DstDeviceName: _this.data.deviceMac,
|
|
|
+ other
|
|
|
+ });
|
|
|
|
|
|
- // 不要循环发送,也不要改alarm_id_0.enable
|
|
|
+ // 不要循环发送,也不要改alarm_id_0.enable
|
|
|
// 循环查询
|
|
|
// const Interval = setInterval(() => {
|
|
|
// if (_this.data.updataDeviceInfo) {
|
|
|
// clearInterval(Interval);
|
|
|
- // other.on_off_timestamp = _this.data.time;
|
|
|
- // other = this.setOther(other, 1);
|
|
|
- // if (other.week_actives.filter((v) => v === 1).length > 0) {
|
|
|
- // // other.week_actives = [0,1,1,1,1,1,0],
|
|
|
- // other.weekly_repeat = "1";
|
|
|
- // } else {
|
|
|
- // other.weekly_repeat = "0";
|
|
|
- // };
|
|
|
- // app.PubMsg({
|
|
|
- // type: "alert_set",
|
|
|
- // DstDeviceName: _this.data.deviceMac,
|
|
|
- // other
|
|
|
- // });
|
|
|
- // 需打开休眠
|
|
|
- // if (_this.data.alarm_id_0.enable === "0") {
|
|
|
+ // other.on_off_timestamp = _this.data.time;
|
|
|
+ // other = this.setOther(other, 1);
|
|
|
+ // if (other.week_actives.filter((v) => v === 1).length > 0) {
|
|
|
+ // // other.week_actives = [0,1,1,1,1,1,0],
|
|
|
+ // other.weekly_repeat = "1";
|
|
|
+ // } else {
|
|
|
+ // other.weekly_repeat = "0";
|
|
|
+ // };
|
|
|
+ // app.PubMsg({
|
|
|
+ // type: "alert_set",
|
|
|
+ // DstDeviceName: _this.data.deviceMac,
|
|
|
+ // other
|
|
|
+ // });
|
|
|
+ // 需打开休眠
|
|
|
+ // if (_this.data.alarm_id_0.enable === "0") {
|
|
|
|
|
|
- // const thisTime = Math.round(new Date() / 1000);
|
|
|
- // const alarm_id_0 = this.setOther(_this.data.alarm_id_0, 1);
|
|
|
- // alarm_id_0.on_off_timestamp = _this.data.alarm_id_0_time;
|
|
|
+ // const thisTime = Math.round(new Date() / 1000);
|
|
|
+ // const alarm_id_0 = this.setOther(_this.data.alarm_id_0, 1);
|
|
|
+ // alarm_id_0.on_off_timestamp = _this.data.alarm_id_0_time;
|
|
|
|
|
|
- // // 有重复
|
|
|
- // if (alarm_id_0.week_actives.filter((v) => v === 1).length > 0) {
|
|
|
- // alarm_id_0.weekly_repeat = "1";
|
|
|
- // } else {
|
|
|
- // alarm_id_0.weekly_repeat = "0";
|
|
|
- // };;
|
|
|
- // // 如果跨天了
|
|
|
- // if (!this.compareDate(_this.data.alarm_id_0_time, this.formatTime(thisTime, "h:m:s"))) {
|
|
|
- // const date = new Date((_this.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
|
|
|
- // alarm_id_0.current_timestamp = this.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
- // };
|
|
|
- // app.PubMsg({
|
|
|
- // type: "alert_set",
|
|
|
- // DstDeviceName: _this.data.deviceMac,
|
|
|
- // other: alarm_id_0
|
|
|
- // });
|
|
|
- // }
|
|
|
+ // // 有重复
|
|
|
+ // if (alarm_id_0.week_actives.filter((v) => v === 1).length > 0) {
|
|
|
+ // alarm_id_0.weekly_repeat = "1";
|
|
|
+ // } else {
|
|
|
+ // alarm_id_0.weekly_repeat = "0";
|
|
|
+ // };;
|
|
|
+ // // 如果跨天了
|
|
|
+ // if (!this.compareDate(_this.data.alarm_id_0_time, this.formatTime(thisTime, "h:m:s"))) {
|
|
|
+ // const date = new Date((_this.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
|
|
|
+ // alarm_id_0.current_timestamp = this.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
+ // };
|
|
|
+ // app.PubMsg({
|
|
|
+ // type: "alert_set",
|
|
|
+ // DstDeviceName: _this.data.deviceMac,
|
|
|
+ // other: alarm_id_0
|
|
|
+ // });
|
|
|
+ // }
|
|
|
|
|
|
// }
|
|
|
// }, 500);
|