From 71033c2f8e72afb14193213e2fe9099139f1445e Mon Sep 17 00:00:00 2001
From: Iruka <1017819588@qq.com>
Date: Thu, 28 Nov 2024 11:34:08 +0800
Subject: [PATCH] .
---
pages/index.vue | 41 ++++++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/pages/index.vue b/pages/index.vue
index 557a443..7aa7856 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -8,7 +8,9 @@
+
+
@@ -107,7 +109,7 @@
+ :class="[ mqttConnected ? 'font-green':'font-red' ]">
@@ -149,11 +151,10 @@
-
-
+
@@ -628,31 +629,33 @@
export default {
data() {
return {
+ user: store.state.user.user,
title: "",
+ ijs: getApp().ijs, // 首页公共js
+ dc: getApp().dc, // 设备控制公共代码
+ mqttshow: false, // h5端手动链接mqtt按钮显示
+ mqttConnected: false, // mqtt链接状态
+ isSticky: false, //吸顶状态
stateScreen: { // 吸顶筛选选中的项 值为 click
- all: "click",
+ all: null,
online: null,
offline: null
},
collapse: [],
- mqttshow: false,
- user: store.state.user.user,
- isSticky: false, //吸顶状态
value: false,
- ijs: getApp().ijs,
- dc: getApp().dc,
- mqtt: getApp().mqtt,
- isLandChange: false,
}
},
onLoad() {
console.error("onLoad")
+ // 监听mqtt链接状态
+ uni.$off("mqtt-connected");
+ uni.$on("mqtt-connected", (e) => {
+ this.mqttConnected = e;
+ });
+
this.ijs.getCompany(this.user.userId);
- // uni.$emit("mqtt-link", this.user.userId);
- // getApp().mqttLink(this.user.userId);
-
this.ijs.getWoList({
id: 10,
landName: "西安测试地块"
@@ -716,7 +719,10 @@
// 阀门状态筛选
valveStateScreen(type) {
- this.stateScreen[type]
+ const collapse = this.collapse;
+ if (this.stateScreen[type] == 'click') {
+ type = "";
+ }
this.dc.showType(type);
for (var key in this.stateScreen) {
if (key == type) {
@@ -728,6 +734,7 @@
this.$nextTick(() => {
setTimeout(() => {
this.$refs.collapseRef.init();
+ this.collapse = collapse;
}, 500)
})
},
@@ -748,9 +755,8 @@
handleCollapseChange(e) {
let collapse = [],
clickName = null;
- e.forEach(item => {
+ e.forEach((item, index) => {
if (item.status == "open") {
- collapse.push(item.name);
if (this.collapse.length) {
if (this.collapse.includes(item.name)) {
clickName = item.name;
@@ -758,6 +764,7 @@
} else {
clickName = item.name;
}
+ collapse.push(item.name);
}
});
this.collapse = collapse;