|
@@ -493,7 +493,7 @@ Page({
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: {
|
|
data: {
|
|
|
"entity_id": item.entity_id,
|
|
"entity_id": item.entity_id,
|
|
|
- "skip_condition":true,
|
|
|
|
|
|
|
+ "skip_condition": true,
|
|
|
},
|
|
},
|
|
|
header: {
|
|
header: {
|
|
|
'content-type': 'application/json', // 默认值
|
|
'content-type': 'application/json', // 默认值
|
|
@@ -1585,6 +1585,7 @@ Page({
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
console.log('listSwitchTemp=' + JSON.stringify(listSwitchTemp));
|
|
console.log('listSwitchTemp=' + JSON.stringify(listSwitchTemp));
|
|
|
|
|
+ listSwitchTemp = that.checkTVList(listSwitchTemp);
|
|
|
that.setData({
|
|
that.setData({
|
|
|
listSwitch: listSwitchTemp,
|
|
listSwitch: listSwitchTemp,
|
|
|
listAromatherapyMachine: listAromatherapyMachineTemp,
|
|
listAromatherapyMachine: listAromatherapyMachineTemp,
|
|
@@ -2252,7 +2253,7 @@ Page({
|
|
|
let entity_id = e.currentTarget.dataset.id;
|
|
let entity_id = e.currentTarget.dataset.id;
|
|
|
let list = this.data.listClimate;//这里是将需要循环的数组赋值给list
|
|
let list = this.data.listClimate;//这里是将需要循环的数组赋值给list
|
|
|
let indexS = Number(e.currentTarget.dataset.index);
|
|
let indexS = Number(e.currentTarget.dataset.index);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 将本地缓存数据渲染到对应修改的案例
|
|
// 将本地缓存数据渲染到对应修改的案例
|
|
|
list.forEach(function (value, index, array) {
|
|
list.forEach(function (value, index, array) {
|
|
|
if (index == indexS) {
|
|
if (index == indexS) {
|
|
@@ -2931,7 +2932,7 @@ Page({
|
|
|
// obj.microphone.mute = resData[i].attributes.microphone.mute;
|
|
// obj.microphone.mute = resData[i].attributes.microphone.mute;
|
|
|
// obj.speaker.mute = resData[i].attributes.speaker.mute;
|
|
// obj.speaker.mute = resData[i].attributes.speaker.mute;
|
|
|
// console.log('media-player-miot-obj=='+obj);
|
|
// console.log('media-player-miot-obj=='+obj);
|
|
|
- if (obj.entity_id && obj.state && checkState(obj.state) && obj.friendly_name && obj.domain ) {
|
|
|
|
|
|
|
+ if (obj.entity_id && obj.state && checkState(obj.state) && obj.friendly_name && obj.domain) {
|
|
|
listMiotMediaPlayerTemp.push(obj);
|
|
listMiotMediaPlayerTemp.push(obj);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -3069,6 +3070,7 @@ Page({
|
|
|
// }
|
|
// }
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
|
|
+ listSwitchTemp = that.checkTVList(listSwitchTemp);
|
|
|
that.setData({
|
|
that.setData({
|
|
|
// status_beep: that.getEntityState(res.data,'switch.xiaomi_pro3_02bd_left_switch_service'), //实验室主灯
|
|
// status_beep: that.getEntityState(res.data,'switch.xiaomi_pro3_02bd_left_switch_service'), //实验室主灯
|
|
|
// status_led: that.getEntityState(res.data,'light.deerma_jsq2g_392f_indicator_light'), //加湿器 Indicator Light
|
|
// status_led: that.getEntityState(res.data,'light.deerma_jsq2g_392f_indicator_light'), //加湿器 Indicator Light
|
|
@@ -3615,6 +3617,7 @@ Page({
|
|
|
// }
|
|
// }
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
|
|
+ listSwitchTemp = that.checkTVList(listSwitchTemp);
|
|
|
|
|
|
|
|
that.setData({
|
|
that.setData({
|
|
|
// status_beep: that.getEntityState(res.data,'switch.xiaomi_pro3_02bd_left_switch_service'), //实验室主灯
|
|
// status_beep: that.getEntityState(res.data,'switch.xiaomi_pro3_02bd_left_switch_service'), //实验室主灯
|
|
@@ -3714,6 +3717,29 @@ Page({
|
|
|
console.log(`myFunctionToTest 执行时间为: ${executionTime} 毫秒`);
|
|
console.log(`myFunctionToTest 执行时间为: ${executionTime} 毫秒`);
|
|
|
return true;
|
|
return true;
|
|
|
},
|
|
},
|
|
|
|
|
+ checkTVList(items = []) {
|
|
|
|
|
+ // 创建一个新数组来存放不包含"电视"的对象
|
|
|
|
|
+ let newItems = [];
|
|
|
|
|
+ // 存放包含"电视"的对象
|
|
|
|
|
+ let tvItems = [];
|
|
|
|
|
+
|
|
|
|
|
+ // 遍历原数组
|
|
|
|
|
+ items.forEach(item => {
|
|
|
|
|
+ // 检查name是否包含"电视"
|
|
|
|
|
+ if (item.friendly_name.includes("电视")) {
|
|
|
|
|
+ tvItems.push(item);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ newItems.push(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 将包含"电视"的对象添加到新数组的末尾
|
|
|
|
|
+ newItems.push(...tvItems);
|
|
|
|
|
+
|
|
|
|
|
+ // 如果需要,用新数组替换原数组
|
|
|
|
|
+ items = newItems;
|
|
|
|
|
+ return items;
|
|
|
|
|
+ },
|
|
|
imageLoad: function () {
|
|
imageLoad: function () {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
isLoading: false,
|
|
isLoading: false,
|