|
@@ -747,13 +747,38 @@ Page({
|
|
title: '确定删除?',
|
|
title: '确定删除?',
|
|
success: function (res) {
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
- if (element.ProdModel == "MW-2AX(WIFI-N)") {}
|
|
|
|
|
|
+ if (that.data.deviceList[e.currentTarget.dataset.index].ProdModel != "MW-2AX(WIFI-N)") {
|
|
|
|
+ const id = that.data.deviceList[e.currentTarget.dataset.index].deviceId;
|
|
|
|
+ const deviceList = that.data.deviceList.filter((item, i) => {
|
|
|
|
+ return id !== item.deviceId
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ wx.setStorage({
|
|
|
|
+ key: "devicelist",
|
|
|
|
+ data: JSON.stringify(deviceList),
|
|
|
|
+ success() {
|
|
|
|
+ that.setData({
|
|
|
|
+ deviceList,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 当前没有设备
|
|
|
|
+ if (deviceList.length === 0) {
|
|
|
|
+ that.setData({
|
|
|
|
+ deviceListIndex: null,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
const id = that.data.deviceList[e.currentTarget.dataset.index].deviceId;
|
|
const id = that.data.deviceList[e.currentTarget.dataset.index].deviceId;
|
|
let name = that.data.deviceListIndex !== null ? that.data.deviceList[that.data.deviceListIndex].name : null;
|
|
let name = that.data.deviceListIndex !== null ? that.data.deviceList[that.data.deviceListIndex].name : null;
|
|
- const deviceList = that.data.deviceList.filter((v, i) => {
|
|
|
|
- return id !== v.deviceId
|
|
|
|
|
|
+
|
|
|
|
+ const deviceList = that.data.deviceList.filter((item, i) => {
|
|
|
|
+ return id !== item.deviceId
|
|
});
|
|
});
|
|
|
|
+
|
|
// 取消订阅
|
|
// 取消订阅
|
|
app.unsubscribe(`/AIrSMArT_${that.data.deviceList[e.currentTarget.dataset.index].name.split("BLUFI_")[1]}/user/pub_response`);
|
|
app.unsubscribe(`/AIrSMArT_${that.data.deviceList[e.currentTarget.dataset.index].name.split("BLUFI_")[1]}/user/pub_response`);
|
|
|
|
|
|
@@ -761,7 +786,6 @@ Page({
|
|
key: "devicelist",
|
|
key: "devicelist",
|
|
data: JSON.stringify(deviceList),
|
|
data: JSON.stringify(deviceList),
|
|
success() {
|
|
success() {
|
|
-
|
|
|
|
that.setData({
|
|
that.setData({
|
|
deviceList,
|
|
deviceList,
|
|
thisDeviceMac: null
|
|
thisDeviceMac: null
|
|
@@ -778,6 +802,7 @@ Page({
|
|
if (that.data.deviceListIndex === null) {
|
|
if (that.data.deviceListIndex === null) {
|
|
return
|
|
return
|
|
};
|
|
};
|
|
|
|
+
|
|
if (e.currentTarget.dataset.index === that.data.deviceListIndex) {
|
|
if (e.currentTarget.dataset.index === that.data.deviceListIndex) {
|
|
let index_ = null;
|
|
let index_ = null;
|
|
deviceList.map((v, index) => {
|
|
deviceList.map((v, index) => {
|