|
@@ -566,80 +566,16 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- deleteDevice(e) {
|
|
|
|
- wx.showModal({
|
|
|
|
- title: '确定删除?',
|
|
|
|
- success: function (res) {
|
|
|
|
- if (res.confirm) {
|
|
|
|
- const id = this.data.deviceList[e.currentTarget.dataset.index].deviceId;
|
|
|
|
- let name = _this.data.deviceListIndex !== null ? this.data.deviceList[_this.data.deviceListIndex].name : null;
|
|
|
|
- const deviceList = this.data.deviceList.filter((v, i) => {
|
|
|
|
- return id !== v.deviceId
|
|
|
|
- });
|
|
|
|
- // 取消订阅
|
|
|
|
- app.unsubscribe(`/AIrSMArT_${_this.data.deviceList[e.currentTarget.dataset.index].name.split("BLUFI_")[1]}/user/pub_response`);
|
|
|
|
-
|
|
|
|
- wx.setStorage({
|
|
|
|
- key: "devicelist",
|
|
|
|
- data: JSON.stringify(deviceList),
|
|
|
|
- success() {
|
|
|
|
-
|
|
|
|
- _this.setData({
|
|
|
|
- deviceList,
|
|
|
|
- thisDeviceMac: null
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // 当前没有设备
|
|
|
|
- if (deviceList.length === 0) {
|
|
|
|
- _this.setData({
|
|
|
|
- actionIndex: null,
|
|
|
|
- deviceListIndex: null,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (_this.data.deviceListIndex === null) {
|
|
|
|
- return
|
|
|
|
- };
|
|
|
|
- if (e.currentTarget.dataset.index === _this.data.deviceListIndex) {
|
|
|
|
- let index_ = null;
|
|
|
|
- deviceList.map((v, index) => {
|
|
|
|
- if (v.state === "online" && index_ === null) {
|
|
|
|
- index_ = index;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- if (index_ !== null) {
|
|
|
|
- _this.actionDevice(index_);
|
|
|
|
- } else {
|
|
|
|
- _this.setData({
|
|
|
|
- actionIndex: null,
|
|
|
|
- deviceListIndex: null,
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
- } else {
|
|
|
|
- deviceList.map((v, index) => {
|
|
|
|
- if (v.name === name) {
|
|
|
|
- _this.setData({
|
|
|
|
- deviceListIndex: index,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
goWake() {
|
|
goWake() {
|
|
if (this.data.deviceListIndex === null) {
|
|
if (this.data.deviceListIndex === null) {
|
|
return;
|
|
return;
|
|
};
|
|
};
|
|
|
|
+
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
url: './../deviceWake/deviceWake?deviceId=' + this.data.deviceList[this.data.deviceListIndex].deviceId + "&clientType=" + this.data.deviceList[this.data.deviceListIndex].ProdModel,
|
|
url: './../deviceWake/deviceWake?deviceId=' + this.data.deviceList[this.data.deviceListIndex].deviceId + "&clientType=" + this.data.deviceList[this.data.deviceListIndex].ProdModel,
|
|
});
|
|
});
|
|
-
|
|
|
|
},
|
|
},
|
|
|
|
+
|
|
goChnnel() {
|
|
goChnnel() {
|
|
wx.setStorage({
|
|
wx.setStorage({
|
|
key: "channelDeta",
|
|
key: "channelDeta",
|
|
@@ -650,17 +586,19 @@ Page({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
},
|
|
},
|
|
|
|
+
|
|
updata() {
|
|
updata() {
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
wx.getUpdateManager().applyUpdate()
|
|
wx.getUpdateManager().applyUpdate()
|
|
},
|
|
},
|
|
|
|
+
|
|
updataClone() {
|
|
updataClone() {
|
|
this.setData({
|
|
this.setData({
|
|
newVersion: false
|
|
newVersion: false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+
|
|
onUnload() {
|
|
onUnload() {
|
|
if (app.globalData.client === null) {
|
|
if (app.globalData.client === null) {
|
|
return;
|
|
return;
|
|
@@ -737,6 +675,72 @@ Page({
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ ///点击item
|
|
onTapIem() {},
|
|
onTapIem() {},
|
|
|
|
|
|
|
|
+ deleteDevice(e) {
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '确定删除?',
|
|
|
|
+ success: function (res) {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ const id = this.data.deviceList[e.currentTarget.dataset.index].deviceId;
|
|
|
|
+ let name = _this.data.deviceListIndex !== null ? this.data.deviceList[_this.data.deviceListIndex].name : null;
|
|
|
|
+ const deviceList = this.data.deviceList.filter((v, i) => {
|
|
|
|
+ return id !== v.deviceId
|
|
|
|
+ });
|
|
|
|
+ // 取消订阅
|
|
|
|
+ app.unsubscribe(`/AIrSMArT_${_this.data.deviceList[e.currentTarget.dataset.index].name.split("BLUFI_")[1]}/user/pub_response`);
|
|
|
|
+
|
|
|
|
+ wx.setStorage({
|
|
|
|
+ key: "devicelist",
|
|
|
|
+ data: JSON.stringify(deviceList),
|
|
|
|
+ success() {
|
|
|
|
+
|
|
|
|
+ _this.setData({
|
|
|
|
+ deviceList,
|
|
|
|
+ thisDeviceMac: null
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 当前没有设备
|
|
|
|
+ if (deviceList.length === 0) {
|
|
|
|
+ _this.setData({
|
|
|
|
+ actionIndex: null,
|
|
|
|
+ deviceListIndex: null,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (_this.data.deviceListIndex === null) {
|
|
|
|
+ return
|
|
|
|
+ };
|
|
|
|
+ if (e.currentTarget.dataset.index === _this.data.deviceListIndex) {
|
|
|
|
+ let index_ = null;
|
|
|
|
+ deviceList.map((v, index) => {
|
|
|
|
+ if (v.state === "online" && index_ === null) {
|
|
|
|
+ index_ = index;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (index_ !== null) {
|
|
|
|
+ _this.actionDevice(index_);
|
|
|
|
+ } else {
|
|
|
|
+ _this.setData({
|
|
|
|
+ actionIndex: null,
|
|
|
|
+ deviceListIndex: null,
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ deviceList.map((v, index) => {
|
|
|
|
+ if (v.name === name) {
|
|
|
|
+ _this.setData({
|
|
|
|
+ deviceListIndex: index,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
})
|
|
})
|