Jelajahi Sumber

提交健康雷达分享确认列表

wangming 2 bulan lalu
induk
melakukan
76c9c44c3b
3 mengubah file dengan 91 tambahan dan 29 penghapusan
  1. 75 21
      src/pages/home/home.vue
  2. 2 2
      src/pagesA/my/my.vue
  3. 14 6
      src/pagesA/shareList/shareList.vue

+ 75 - 21
src/pages/home/home.vue

@@ -81,7 +81,17 @@
             <image src="../../static/linkService.png" mode="" />
             <button open-type="contact">联系客服</button>
         </view>
-        <view class="bot_version"> v3.0.1 </view>
+        <view class="bot_version"> v3.0.3 </view>
+
+        <view class="shareInfo" @click="goDeviceShare()" v-if="shareNum > 0">
+            <image src="../../static/ln_small.png" class="shareImage"></image>
+            <text class="shareTitle"
+                >您有<text class="shareNum">{{ shareNum }}</text
+                >个设备待授权</text
+            >
+        </view>
+
+        <!-- <view> </view> -->
         <alarModel />
     </view>
 </template>
@@ -129,24 +139,45 @@ export default {
                 url: "/pagesA/loginNew/loginNew",
             });
         },
-    },
-    onLoad() {},
-    onShow() {
-        if (uni.getStorageSync("userId")) {
+        goDeviceShare() {
+            uni.navigateTo({
+                url: "/pagesA/shareList/shareList?shareStatus=" + 0,
+            });
+        },
+        getperSonInfo() {
             this.$http
                 .get("wap/home/homeInfo", {
                     userId: uni.getStorageSync("userId"),
                 })
                 .then((res) => {
                     if (res.data.data) {
-                        const { groupNum, shareNum, devNum, warnNum } =
-                            res.data.data;
+                        const { groupNum, devNum, warnNum } = res.data.data;
                         this.groupNum = groupNum;
-                        this.shareNum = shareNum;
                         this.devNum = devNum;
                         this.warnNum = warnNum;
                     }
                 });
+        },
+        getShareNum() {
+            // uni.showLoading({
+            //     title: "雷能守护中...",
+            // });
+            this.$http
+                .post("wap/share/queryDevShare", {
+                    userId: uni.getStorageSync("userId"),
+                    state: 0,
+                })
+                .then((res) => {
+                    uni.hideLoading();
+                    this.shareNum = res.data.data?.length || 0;
+                });
+        },
+    },
+    onLoad() {},
+    onShow() {
+        if (uni.getStorageSync("userId")) {
+            this.getperSonInfo();
+            this.getShareNum();
         }
         // 配置服务器
         let selectedService = uni.getStorageSync("sercviceChoice");
@@ -337,17 +368,40 @@ export default {
     justify-content: center;
     align-items: center;
 }
-// .headerInfo {
-//     position: fixed;
-//     top: 40rpx;
-//     left: 0;
-//     width: 750rpx;
-//     height: 105rpx;
-//     background: linear-gradient(
-//         90deg,
-//         rgba(255, 97, 97, 0) 0%,
-//         #6ddea7 50.44%,
-//         rgba(255, 97, 97, 0) 100%
-//     );
-// }
+
+.shareInfo {
+    width: 100%;
+    padding: 3rpx 0;
+    padding-left: 70rpx;
+    color: #ffffff;
+    display: flex;
+    align-items: center;
+    font-size: 28rpx;
+    position: absolute;
+    top: 210rpx;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    background: linear-gradient(
+        to right,
+        #6f4e37 0%,
+        rgba(210, 180, 140, 0.3) 100%
+    );
+    .shareImage {
+        width: 60rpx;
+        height: 60rpx;
+        border-radius: 50%;
+        margin-left: 10rpx;
+    }
+    .shareTitle {
+        margin-left: 20rpx;
+        font-size: 28rpx;
+        color: #ffffff;
+        letter-spacing: 4rpx;
+    }
+    .shareNum {
+        font-weight: bold;
+        font-size: 28rpx;
+        color: #ffffff;
+    }
+}
 </style>

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

@@ -68,7 +68,7 @@ export default {
         },
         gotoShare() {
             uni.navigateTo({
-                url: "/pagesA/shareList/shareList",
+                url: "/pagesA/shareList/shareList?shareStatus=" + "all",
             });
         },
         goLogout() {
@@ -79,7 +79,7 @@ export default {
                     if (res.confirm) {
                         uni.clearStorageSync();
                         uni.reLaunch({
-                            url: "/pagesA/loginNew/loginNew",
+                            url: "/pages/home/home",
                         });
                     } else if (res.cancel) {
                     }

+ 14 - 6
src/pagesA/shareList/shareList.vue

@@ -69,20 +69,23 @@ export default {
     data() {
         return {
             shareList: [],
+            status: 0,
         };
     },
     methods: {
         getShareList() {
             this.$http
-                .get("wap/share/queryDevShare", {
+                .post("wap/share/queryDevShare", {
                     userId: uni.getStorageSync("userId"),
+                    state: this.status,
                 })
                 .then((res) => {
-                    if (res.data.data) {
-                        this.shareList = res.data.data;
+                    this.shareList = res.data.data;
+                    if (this.shareList && this.status != null) {
+                        this.status = null;
+                        this.getShareList();
                     }
-                })
-                .catch((err) => {});
+                });
         },
         acceptDevice(item) {
             let shareConfirmParam = {
@@ -149,7 +152,12 @@ export default {
             uni.stopPullDownRefresh();
         }, 1000);
     },
-    onShow() {
+    onLoad(option) {
+        console.log("shareList onLoad", option);
+        this.status = option.shareStatus;
+        if (this.status == "all") {
+            this.status = null;
+        }
         this.getShareList();
     },
 };