浏览代码

Merge branch 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile

* 'master' of ssh://gogs.zfire.top:2222/zfire-front/recycle-mobile:
  feat:修改
  feat: 刷新数量
Moss 1 年之前
父节点
当前提交
09b61b1ffb
共有 3 个文件被更改,包括 9 次插入4 次删除
  1. 7 3
      src/App.vue
  2. 1 1
      src/common/utils/util.js
  3. 1 0
      src/pages/login/indexs.vue

+ 7 - 3
src/App.vue

@@ -35,7 +35,10 @@
         this.updateUserInfo();
       });
 
-      this.updateUserInfo();
+      if (this.$store.state.user.token) {
+        this.updateUserInfo();
+      }
+
       // #endif
 
       uni.getSystemInfo({
@@ -72,8 +75,9 @@
           if (getUserValTimeId) {
             clearTimeout(getUserValTimeId)
           }
-          getUserInfo()
-          getUserValTimeId = setTimeout(getUserVal, 2000)
+          getUserInfo().then(res => {
+            getUserValTimeId = setTimeout(getUserVal, 2000)
+          })
         })()
       },
       // #endif

+ 1 - 1
src/common/utils/util.js

@@ -14,7 +14,7 @@ export const getUserInfo = () => {
         // tab数字角标
         uni.setTabBarBadge({
           index: 2,
-          text: data.unread + ""
+          text: data.unread ? data.unread + "" : ""
         })
         uni.setStorageSync('recycle_mobile_user', data);
         resolve(data);

+ 1 - 0
src/pages/login/indexs.vue

@@ -112,6 +112,7 @@
               this.$store.commit("user/set_name", res.data.name)
               this.$store.commit("user/set_avatar", res.data.avatar)
               this.$store.commit("user/set_userId", res.data.baseUserId)
+              uni.$emit("updateUserInfo")
               this.$navToPage({
                 url: "/pages/index/index"
               }, "switchTab")