|
@@ -1,4 +1,3 @@
|
|
|
-// pages/deviceWake/deviceWake.js
|
|
|
const app = getApp();
|
|
|
const {
|
|
|
formatNumber
|
|
@@ -6,15 +5,11 @@ const {
|
|
|
const {
|
|
|
deviceWakedetail
|
|
|
} = require('./../../utils/api.js');
|
|
|
-import lexin_devices from '../../utils/lexin/devices';
|
|
|
+
|
|
|
+import lexin_devices from '../../utils/lexin/devices.js';
|
|
|
import lexin_util from '../../utils/lexin/util.js';
|
|
|
|
|
|
-let _this = null
|
|
|
Page({
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面的初始数据
|
|
|
- */
|
|
|
data: {
|
|
|
nvabarData: {
|
|
|
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
@@ -69,16 +64,14 @@ Page({
|
|
|
deviceOther: null,
|
|
|
updataDeviceInfo: false,
|
|
|
repeatIndex: 0,
|
|
|
+ deviceId: "",
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
onLoad(options) {
|
|
|
- _this = this;
|
|
|
-
|
|
|
+ var that = this;
|
|
|
var clientType = options.clientType;
|
|
|
var deviceId = options.deviceId;
|
|
|
+ that.data.deviceId = deviceId;
|
|
|
var deviceMac = lexin_util.getDeviceMacId(deviceId);
|
|
|
// var deviceMac = `AIrSMArT_${deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
deviceWakedetail({
|
|
@@ -86,23 +79,23 @@ Page({
|
|
|
deviceMac: deviceMac,
|
|
|
}).then((res) => {
|
|
|
if (res && res.length > 0) {
|
|
|
- this.setData({
|
|
|
+ that.setData({
|
|
|
wakeName: res[0].audioName || null
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
- this.data.clientType = options.clientType
|
|
|
- this.data.deviceMac = lexin_util.getDeviceMacId(options.deviceId);
|
|
|
- // this.data.deviceMac = `AIrSMArT_${options.deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
+ 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({
|
|
|
type: "get_dev_info",
|
|
|
- DstDeviceName: this.data.deviceMac
|
|
|
+ DstDeviceName: that.data.deviceMac
|
|
|
});
|
|
|
|
|
|
// 赋值按钮回调
|
|
|
- this.setData({
|
|
|
+ that.setData({
|
|
|
twoButCallback: () => {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
toast_visible: false
|
|
|
})
|
|
|
}
|
|
@@ -110,13 +103,16 @@ Page({
|
|
|
},
|
|
|
|
|
|
onShow(options) {
|
|
|
+ var that = this;
|
|
|
+ var deviceMac = that.data.deviceMac;
|
|
|
app.PubMsg({
|
|
|
type: "get_dev_info",
|
|
|
- DstDeviceName: _this.data.deviceMac
|
|
|
+ DstDeviceName: deviceMac,
|
|
|
});
|
|
|
},
|
|
|
|
|
|
mqttCallback(type, option) {
|
|
|
+ var that = this;
|
|
|
let payloads = null;
|
|
|
if (option) {
|
|
|
payloads = JSON.parse(option.payload);
|
|
@@ -130,11 +126,11 @@ Page({
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
});
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
devicerStatus: false,
|
|
|
})
|
|
|
} else {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
devicerStatus: true,
|
|
|
})
|
|
|
}
|
|
@@ -142,7 +138,7 @@ Page({
|
|
|
case "message":
|
|
|
// 设备信息
|
|
|
if (payloads.type === "get_dev_info") {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
deviceOther: payloads.other,
|
|
|
updataDeviceInfo: true,
|
|
|
});
|
|
@@ -151,61 +147,60 @@ Page({
|
|
|
if (v.alarm_id === "0") {
|
|
|
v.action = "update";
|
|
|
// 休眠
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
alarm_id_0: v
|
|
|
});
|
|
|
|
|
|
// 定时时间
|
|
|
if (v.on_off_timestamp !== "") {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
alarm_id_0_time: v.on_off_timestamp
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 是否启用
|
|
|
if (v.enable === "1") {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
switch1Checked: true
|
|
|
})
|
|
|
} else {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
switch1Checked: false
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 重复
|
|
|
if (v.week_actives) {
|
|
|
- _this.setData({
|
|
|
- repeat0: _this.repeatText(v.week_actives),
|
|
|
+ that.setData({
|
|
|
+ repeat0: that.repeatText(v.week_actives),
|
|
|
})
|
|
|
}
|
|
|
|
|
|
} else if (v.alarm_id === "1") {
|
|
|
// 唤醒
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
alarm_id_1: v
|
|
|
});
|
|
|
// 定时时间
|
|
|
if (v.on_off_timestamp !== "") {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
time: v.on_off_timestamp
|
|
|
})
|
|
|
}
|
|
|
// 是否启用
|
|
|
if (v.enable === "1") {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
switch2Checked: true
|
|
|
})
|
|
|
} else {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
switch2Checked: false
|
|
|
})
|
|
|
}
|
|
|
// 重复
|
|
|
if (v.week_actives) {
|
|
|
- _this.setData({
|
|
|
- repeat: _this.repeatText(v.week_actives),
|
|
|
+ that.setData({
|
|
|
+ repeat: that.repeatText(v.week_actives),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -215,7 +210,7 @@ Page({
|
|
|
if (payloads.code === 200) {
|
|
|
app.PubMsg({
|
|
|
type: "get_dev_info",
|
|
|
- DstDeviceName: _this.data.deviceMac
|
|
|
+ DstDeviceName: that.data.deviceMac
|
|
|
});
|
|
|
} else {
|
|
|
wx.showModal({
|
|
@@ -237,14 +232,15 @@ Page({
|
|
|
|
|
|
// 休眠-选择时间
|
|
|
switch1Change(e) {
|
|
|
- let other = this.data.alarm_id_0;
|
|
|
+ var that = this;
|
|
|
+ let other = that.data.alarm_id_0;
|
|
|
if (e.detail.value) {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
switch1Checked: e.detail.value
|
|
|
});
|
|
|
const thisTime = Math.round(new Date() / 1000);
|
|
|
- other = this.setOther(other, 1);
|
|
|
- other.on_off_timestamp = _this.data.alarm_id_0_time;
|
|
|
+ other = that.setOther(other, 1);
|
|
|
+ other.on_off_timestamp = that.data.alarm_id_0_time;
|
|
|
|
|
|
// 有重复
|
|
|
if (other.week_actives && other.week_actives.filter((v) => v === 1).length > 0) {
|
|
@@ -254,39 +250,41 @@ Page({
|
|
|
other.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, '/'));
|
|
|
- other.current_timestamp = this.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
+ if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
|
|
|
+ const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
|
|
|
+ other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
};
|
|
|
app.PubMsg({
|
|
|
type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
+ DstDeviceName: that.data.deviceMac,
|
|
|
other
|
|
|
});
|
|
|
} else {
|
|
|
- _this.setData({
|
|
|
+ that.setData({
|
|
|
switch1Checked: e.detail.value
|
|
|
});
|
|
|
- other = this.setOther(other, 0);
|
|
|
+ other = that.setOther(other, 0);
|
|
|
app.PubMsg({
|
|
|
type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
+ DstDeviceName: that.data.deviceMac,
|
|
|
other
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
switch2Change(e) {
|
|
|
- _this.data.updataDeviceInfo = false;
|
|
|
- let other = _this.data.alarm_id_1;
|
|
|
+ var that = this;
|
|
|
+ that.data.updataDeviceInfo = false;
|
|
|
+ let other = that.data.alarm_id_1;
|
|
|
if (e.detail.value) {
|
|
|
- if (_this.data.deviceOther && _this.data.deviceOther.Power < 20) {
|
|
|
- _this.setData({
|
|
|
+ if (that.data.deviceOther && that.data.deviceOther.Power < 20) {
|
|
|
+ that.setData({
|
|
|
toast_visible: true,
|
|
|
});
|
|
|
};
|
|
|
// app.PubMsg({
|
|
|
// type: "get_dev_info",
|
|
|
- // DstDeviceName: _this.data.deviceMac
|
|
|
+ // DstDeviceName: that.data.deviceMac
|
|
|
// });
|
|
|
if (!other) {
|
|
|
wx.showToast({
|
|
@@ -295,8 +293,8 @@ Page({
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- other.on_off_timestamp = _this.data.time;
|
|
|
- other = this.setOther(other, 1);
|
|
|
+ other.on_off_timestamp = that.data.time;
|
|
|
+ other = that.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],
|
|
@@ -306,17 +304,17 @@ Page({
|
|
|
};
|
|
|
app.PubMsg({
|
|
|
type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
+ DstDeviceName: that.data.deviceMac,
|
|
|
other
|
|
|
});
|
|
|
|
|
|
// 不要循环发送,也不要改alarm_id_0.enable
|
|
|
// 循环查询
|
|
|
// const Interval = setInterval(() => {
|
|
|
- // if (_this.data.updataDeviceInfo) {
|
|
|
+ // if (that.data.updataDeviceInfo) {
|
|
|
// clearInterval(Interval);
|
|
|
- // other.on_off_timestamp = _this.data.time;
|
|
|
- // other = this.setOther(other, 1);
|
|
|
+ // other.on_off_timestamp = that.data.time;
|
|
|
+ // other = that.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";
|
|
@@ -325,15 +323,15 @@ Page({
|
|
|
// };
|
|
|
// app.PubMsg({
|
|
|
// type: "alert_set",
|
|
|
- // DstDeviceName: _this.data.deviceMac,
|
|
|
+ // DstDeviceName: that.data.deviceMac,
|
|
|
// other
|
|
|
// });
|
|
|
// 需打开休眠
|
|
|
- // if (_this.data.alarm_id_0.enable === "0") {
|
|
|
+ // if (that.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 alarm_id_0 = that.setOther(that.data.alarm_id_0, 1);
|
|
|
+ // alarm_id_0.on_off_timestamp = that.data.alarm_id_0_time;
|
|
|
|
|
|
// // 有重复
|
|
|
// if (alarm_id_0.week_actives.filter((v) => v === 1).length > 0) {
|
|
@@ -342,13 +340,13 @@ Page({
|
|
|
// 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");
|
|
|
+ // if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
|
|
|
+ // const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
|
|
|
+ // alarm_id_0.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
// };
|
|
|
// app.PubMsg({
|
|
|
// type: "alert_set",
|
|
|
- // DstDeviceName: _this.data.deviceMac,
|
|
|
+ // DstDeviceName: that.data.deviceMac,
|
|
|
// other: alarm_id_0
|
|
|
// });
|
|
|
// }
|
|
@@ -356,33 +354,37 @@ Page({
|
|
|
// }
|
|
|
// }, 500);
|
|
|
} else {
|
|
|
- other = this.setOther(other, 0);
|
|
|
+ other = that.setOther(other, 0);
|
|
|
app.PubMsg({
|
|
|
type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
+ DstDeviceName: that.data.deviceMac,
|
|
|
other
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
// bindPickerChange(e) {
|
|
|
- // let other = this.data.alarm_id_0;
|
|
|
+ // var that = this;
|
|
|
+ // let other = that.data.alarm_id_0;
|
|
|
// const thisTime = Math.round(new Date() / 1000);
|
|
|
- // other = this.setOther(other, 1);
|
|
|
- // other.on_off_timestamp = this.formatTime(thisTime + this.data.timeArray[e.detail.value].id, "h:m:s");
|
|
|
+ // other = that.setOther(other, 1);
|
|
|
+ // other.on_off_timestamp = that.formatTime(thisTime + that.data.timeArray[e.detail.value].id, "h:m:s");
|
|
|
// // 如果跨天了
|
|
|
- // if(parseInt(this.formatTime(thisTime + this.data.timeArray[e.detail.value].id, "D")) > parseInt(this.formatTime(thisTime, "D"))) {
|
|
|
- // const date = new Date(_this.formatTime(thisTime, "Y-M-D") + " 00:00:00");
|
|
|
- // other.current_timestamp = this.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
+ // if(parseInt(that.formatTime(thisTime + that.data.timeArray[e.detail.value].id, "D")) > parseInt(that.formatTime(thisTime, "D"))) {
|
|
|
+ // const date = new Date(that.formatTime(thisTime, "Y-M-D") + " 00:00:00");
|
|
|
+ // other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
// };
|
|
|
- // app.PubMsg({type: "alert_set", DstDeviceName: _this.data.deviceMac, other});
|
|
|
+ // app.PubMsg({type: "alert_set", DstDeviceName: that.data.deviceMac, other});
|
|
|
// },
|
|
|
+
|
|
|
bindTimeChange0: function (e) {
|
|
|
- this.setData({
|
|
|
+ var that = this;
|
|
|
+ that.setData({
|
|
|
alarm_id_0_time: e.detail.value + ":00"
|
|
|
});
|
|
|
- let other = this.data.alarm_id_0;
|
|
|
+ let other = that.data.alarm_id_0;
|
|
|
other.on_off_timestamp = e.detail.value + ":00";
|
|
|
- other = this.setOther(other, 1);
|
|
|
+ other = that.setOther(other, 1);
|
|
|
// 有重复
|
|
|
if (other.week_actives.filter((v) => v === 1).length > 0) {
|
|
|
// other.week_actives = [0,1,1,1,1,1,0],
|
|
@@ -392,71 +394,88 @@ Page({
|
|
|
};
|
|
|
// 如果跨天了
|
|
|
const thisTime = Math.round(new Date() / 1000);
|
|
|
- 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, '/'));
|
|
|
- other.current_timestamp = this.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
+ if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
|
|
|
+ const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
|
|
|
+ other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
};
|
|
|
app.PubMsg({
|
|
|
type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
+ DstDeviceName: that.data.deviceMac,
|
|
|
other
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
bindTimeChange: function (e) {
|
|
|
- this.setData({
|
|
|
+ var that = this;
|
|
|
+ that.setData({
|
|
|
time: e.detail.value + ":00"
|
|
|
});
|
|
|
- let other = this.data.alarm_id_1;
|
|
|
+ let other = that.data.alarm_id_1;
|
|
|
other.on_off_timestamp = e.detail.value + ":00";
|
|
|
- other = this.setOther(other, 1);
|
|
|
+ other = that.setOther(other, 1);
|
|
|
app.PubMsg({
|
|
|
type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
+ DstDeviceName: that.data.deviceMac,
|
|
|
other
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
setRepeat(arr) {
|
|
|
- let other = this.data.repeatIndex === "0" ? _this.data.alarm_id_0 : _this.data.alarm_id_1;
|
|
|
- other = this.setOther(other, 1);
|
|
|
+ var that = this;
|
|
|
+ let other = that.data.repeatIndex === "0" ? that.data.alarm_id_0 : that.data.alarm_id_1;
|
|
|
+ other = that.setOther(other, 1);
|
|
|
other.week_actives = arr;
|
|
|
other.weekly_repeat = arr.filter((v) => v === 1).length > 0 ? "1" : "0";
|
|
|
// 倒计时
|
|
|
- if (this.data.repeatIndex === "0") {
|
|
|
+ if (that.data.repeatIndex === "0") {
|
|
|
// 如果跨天了
|
|
|
const thisTime = Math.round(new Date() / 1000);
|
|
|
- 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, '/'));
|
|
|
- other.current_timestamp = this.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
+ if (!that.compareDate(that.data.alarm_id_0_time, that.formatTime(thisTime, "h:m:s"))) {
|
|
|
+ const date = new Date((that.formatTime(thisTime, "Y-M-D") + " 00:00:00").replace(/-/g, '/'));
|
|
|
+ other.current_timestamp = that.formatTime(date.getTime() / 1000 + 86400, "Y-M-D h:m:s");
|
|
|
};
|
|
|
}
|
|
|
app.PubMsg({
|
|
|
type: "alert_set",
|
|
|
- DstDeviceName: _this.data.deviceMac,
|
|
|
+ DstDeviceName: that.data.deviceMac,
|
|
|
other
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
goWakeList() {
|
|
|
+ var that = this;
|
|
|
+ var deviceId = that.data.deviceId;
|
|
|
+ var clientType = that.data.clientType;
|
|
|
+ // var deviceMac = that.data.deviceMac;
|
|
|
+ ///唤醒的设置特殊,智能这样用
|
|
|
+ var deviceMac = `AIrSMArT_${deviceId.split(lexin_devices.leXin)[1]}`;
|
|
|
wx.navigateTo({
|
|
|
- url: './../wakeList/wakeList?clientType=' + this.data.clientType + "&deviceMac=" + this.data.deviceMac,
|
|
|
+ url: './../wakeList/wakeList?clientType=' + clientType + "&deviceMac=" + deviceMac,
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
gorepeat(e) {
|
|
|
- this.data.repeatIndex = e.currentTarget.dataset.index;
|
|
|
- this.data.week_actives = e.currentTarget.dataset.index === "0" ? _this.data.alarm_id_0.week_actives : _this.data.alarm_id_1.week_actives;
|
|
|
+ var that = this;
|
|
|
+ that.data.repeatIndex = e.currentTarget.dataset.index;
|
|
|
+ that.data.week_actives = e.currentTarget.dataset.index === "0" ? that.data.alarm_id_0.week_actives : that.data.alarm_id_1.week_actives;
|
|
|
wx.navigateTo({
|
|
|
- url: './../repeat/repeat?week_actives=' + this.data.week_actives
|
|
|
+ url: './../repeat/repeat?week_actives=' + that.data.week_actives
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
setdeviceWakedetail() {
|
|
|
+ var that = this;
|
|
|
deviceWakedetail({
|
|
|
- clientType: this.data.clientType,
|
|
|
- deviceMac: this.data.deviceMac,
|
|
|
+ clientType: that.data.clientType,
|
|
|
+ deviceMac: that.data.deviceMac,
|
|
|
}).then((res) => {
|
|
|
- this.setData({
|
|
|
+ that.setData({
|
|
|
wakeName: res[0].audioName
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
/**
|
|
|
* 时间戳转化为年 月 日 时 分 秒
|
|
|
* number: 传入时间戳
|
|
@@ -481,8 +500,10 @@ Page({
|
|
|
}
|
|
|
return format;
|
|
|
},
|
|
|
+
|
|
|
// type: 0 关闭 1 开启
|
|
|
setOther(other, type) {
|
|
|
+ var that = this;
|
|
|
if (type === 0) {
|
|
|
other.enable = "0";
|
|
|
other.alarm_name = "close";
|
|
@@ -493,7 +514,7 @@ Page({
|
|
|
other.operation = "on";
|
|
|
}
|
|
|
const thisTime = Math.round(new Date() / 1000);
|
|
|
- other.current_timestamp = this.formatTime(thisTime, "Y-M-D h:m:s");
|
|
|
+ other.current_timestamp = that.formatTime(thisTime, "Y-M-D h:m:s");
|
|
|
other.action = "update",
|
|
|
other.song_uri = "-1";
|
|
|
other.version = 3;
|
|
@@ -507,8 +528,9 @@ Page({
|
|
|
var b = t2.split(":");
|
|
|
return date.setHours(a[0], a[1]) > date.setHours(b[0], b[1]);
|
|
|
},
|
|
|
- repeatText(arr) {
|
|
|
|
|
|
+ repeatText(arr) {
|
|
|
+ var that = this;
|
|
|
let text = "";
|
|
|
if (arr.toString() === [0, 1, 1, 1, 1, 1, 0].toString()) {
|
|
|
text = "工作日";
|
|
@@ -518,9 +540,9 @@ Page({
|
|
|
arr.map((v, index) => {
|
|
|
if (v === 1) {
|
|
|
if (text === "") {
|
|
|
- text = text + _this.data.week[index]
|
|
|
+ text = text + that.data.week[index]
|
|
|
} else {
|
|
|
- text = text + "、" + _this.data.week[index];
|
|
|
+ text = text + "、" + that.data.week[index];
|
|
|
}
|
|
|
}
|
|
|
});
|