Pārlūkot izejas kodu

提交报警设备

wangming 2 mēneši atpakaļ
vecāks
revīzija
9fd54c7ef6

+ 3 - 1
src/components/component/alarModel.vue

@@ -459,7 +459,9 @@ export default {
                     if (err) {
                         console.error("订阅失败", err);
                     } else {
-                        console.log(`成功订阅设备主题: device/mps`);
+                        console.log(
+                            `成功订阅设备主题: /mps/wx_${userId}/notice`
+                        );
                     }
                 });
             });

+ 2 - 1
src/pages/home/home.vue

@@ -141,8 +141,9 @@ export default {
             });
         },
         goDeviceShare() {
+            uni.setStorageSync("shareStatus", "authorized");
             uni.navigateTo({
-                url: "/pagesA/shareList/shareList?shareStatus=" + 0,
+                url: "/pagesA/shareList/shareList",
             });
         },
         getperSonInfo() {

+ 2 - 1
src/pagesA/my/my.vue

@@ -67,8 +67,9 @@ export default {
             });
         },
         gotoShare() {
+            uni.setStorageSync("shareStatus", "all");
             uni.navigateTo({
-                url: "/pagesA/shareList/shareList?shareStatus=" + "all",
+                url: "/pagesA/shareList/shareList",
             });
         },
         goLogout() {

+ 20 - 12
src/pagesA/shareList/shareList.vue

@@ -69,7 +69,7 @@ export default {
     data() {
         return {
             shareList: [],
-            status: 0,
+            status: null,
         };
     },
     methods: {
@@ -77,12 +77,23 @@ export default {
             this.$http
                 .post("wap/share/queryDevShare", {
                     userId: uni.getStorageSync("userId"),
-                    state: this.status,
+                    state: null,
                 })
                 .then((res) => {
-                    this.shareList = res.data.data;
-                    if (this.shareList && this.status != null) {
-                        this.status = null;
+                    if (res.data.data) {
+                        this.shareList = res.data.data;
+                        if (this.shareList && this.status != null) {
+                            const hasStatusZero = this.shareList.some(
+                                (item) => item.state === 0
+                            );
+                            console.log(hasStatusZero);
+                            if (!hasStatusZero) {
+                                this.state = null;
+                                this.getShareList();
+                            }
+                        }
+                    } else {
+                        this.state = null;
                         this.getShareList();
                     }
                 });
@@ -146,19 +157,16 @@ export default {
                 });
         },
     },
+    onShow() {
+        this.getShareList();
+    },
+
     onPullDownRefresh() {
         this.getShareList();
         setTimeout(() => {
             uni.stopPullDownRefresh();
         }, 1000);
     },
-    onLoad(option) {
-        this.status = option.shareStatus;
-        if (this.status == "all") {
-            this.status = null;
-        }
-        this.getShareList();
-    },
 };
 </script>