Forráskód Böngészése

改bug:供应商数量图表偶发不显示问题

single 9 hónapja
szülő
commit
d5fb29e4c4

+ 6 - 2
src/pages/index/components/home-chart.vue

@@ -2,7 +2,7 @@
  * @Author: PoJun
  * @Date: 2023-12-19 14:57:48
  * @LastEditors: XuanJi
- * @LastEditTime: 2024-05-21 04:07:59
+ * @LastEditTime: 2024-05-21 11:32:29
  * @Message: 柱形图
 -->
 <template>
@@ -90,10 +90,14 @@ export default {
         times: {
             immediate: true,
             handler: function () {
-                this.init();
+
+                    this.init();
             },
         },
     },
+    onLoad() {
+        console.log(this.showChart);
+    }
 };
 </script>
 

+ 28 - 12
src/pages/index/index.vue

@@ -2,7 +2,7 @@
  * @Author: PoJun
  * @Date: 2023-05-15 19:59:55
  * @LastEditors: XuanJi
- * @LastEditTime: 2024-05-21 10:36:13
+ * @LastEditTime: 2024-05-21 12:51:31
  * @Message: Nothing
 -->
 <template>
@@ -100,18 +100,16 @@ export default {
             score: 0,
         };
     },
-    onLoad() {
-        checkAppUpdate();
-    },
+
     onShow() {
-        this.times++;
-        this.showChart = true;
+        if (this.vuex_userInfo) {
+            this.showChart = true;
+            this.times++;
+        } else {
+            this.showChart = false;
+        }
         console.log("show");
     },
-    onHide() {
-        console.log("hide");
-        // this.showChart = false;
-    },
     methods: {
         toLogin() {
             if (!this.vuex_userInfo) {
@@ -123,10 +121,28 @@ export default {
         toAppeal() {
             uni.$uv.route("/subpkg/home/representations");
         },
+        methodToTrigger() {
+            // console.log("登录成功后触发");
+            this.showChart = false;
+        },
     },
     async onLoad() {
-        const res = await getMySupplierInfo();
-        this.score = res.mark;
+        checkAppUpdate();
+        console.log("首页onload");
+        if (this.vuex_userInfo) {
+            this.showChart = true;
+            if (this.vuex_userInfo.attr.BusinessRole == "supplier") {
+                const res = await getMySupplierInfo();
+                this.score = res.mark;
+            }
+        } else {
+            this.showChart = false;
+        }
+        uni.$on("triggerMethod", this.methodToTrigger);
+    },
+    onUnload() {
+        console.log("首页unload");
+        uni.$off("triggerMethod", this.methodToTrigger);
     },
 };
 </script>

+ 3 - 2
src/pages/login/index.vue

@@ -1,8 +1,8 @@
 <!--
  * @Author: PoJun
  * @Date: 2023-09-28 10:38:11
- * @LastEditors: PoJun
- * @LastEditTime: 2024-03-04 10:46:40
+ * @LastEditors: XuanJi
+ * @LastEditTime: 2024-05-21 12:32:25
  * @Message: 登录页面
 -->
 <template>
@@ -110,6 +110,7 @@ export default {
             const data = await wechatLogin(this.auth.name, this.auth.password, "Password");
             uni.setStorageSync("vuex_token", data.token);
             this.$store.commit("$updateLoginInfo", data);
+            uni.$emit('triggerMethod');
             // #ifdef APP-PLUS
             // await updateClientInfo(this.clientInfo.clientid);
             // #endif