Browse Source

修改个人中心的相关报错

yellowtaotao 4 years ago
parent
commit
ce00966258
3 changed files with 28 additions and 27 deletions
  1. 20 21
      src/views/home/index.vue
  2. 4 4
      src/views/home/person/page-person.vue
  3. 4 2
      src/views/home/person/rank.vue

+ 20 - 21
src/views/home/index.vue

@@ -67,31 +67,30 @@ export default {
     };
   },
   created() {
-    this.$store.commit("updateUserItemStore", {
-      field: "userInfo",
-      value: {
-        id: "testuser-ztdxxDGdNj",
-        encodedPassword: "string",
-        userStatus: "suspended",
-        userName: "testuser-ztdxxDGdNj",
-        email: "test@gmail.com",
-        firstName: "一",
-        lastName: "张",
-        studyId: "U00000",
-        phone: "13060901234",
-        nickName: "小强"
-      }
-    });
-    this.activeTabName = 0;
-    this.currentComponents = this.tabbars[this.activeTabName].pageName;
+    this.initFun();
   },
   methods: {
+    initFun() {
+      this.$store.commit("updateUserItemStore", {
+        field: "userInfo",
+        value: {
+          id: "testuser-ztdxxDGdNj",
+          encodedPassword: "string",
+          userStatus: "suspended",
+          userName: "testuser-ztdxxDGdNj",
+          email: "test@gmail.com",
+          firstName: "一",
+          lastName: "张",
+          studyId: "U00000",
+          phone: "13060901234",
+          nickName: "小强"
+        }
+      });
+      this.activeTabName = 0;
+      this.currentComponents = this.tabbars[this.activeTabName].pageName;
+    },
     onChange(index) {
       this.currentComponents = this.tabbars[this.activeTabName].pageName;
-      // if (this.current !== pageName) {
-      //   this.current = pageName;
-      //   this.$router.replace({ name: "home", query: { page: pageName } });
-      // }
     }
   }
 };

+ 4 - 4
src/views/home/person/page-person.vue

@@ -12,7 +12,7 @@
             :error-icon="maleAvatar"
           />
           <div class="userName">
-            {{ userName }}
+            {{ userInfo.userName }}
           </div>
         </div>
         <div class="userCardLine"></div>
@@ -80,7 +80,7 @@ export default {
   },
   computed: {
     ...mapState({
-      user: state => state.user
+      userInfo: state => state.user.userInfo
     })
   },
   mounted() {
@@ -91,7 +91,7 @@ export default {
     //   获取今日分数
     getDailyPoints() {
       let path = {
-        userName: this.user.userInfo.userName
+        userName: this.userInfo.userName
       };
       this.$_http
         .get(this.$pathParams(this.$_API.JTXT_GET_USER_DAIYL_POINTS, path))
@@ -106,7 +106,7 @@ export default {
     //   查询总积分
     getAllPoints() {
       let path = {
-        userName: this.user.userInfo.userName
+        userName: this.userInfo.userName
       };
       this.$_http
         .get(this.$pathParams(this.$_API.JTXT_GET_USER_ALL_POINTS, path))

+ 4 - 2
src/views/home/person/rank.vue

@@ -49,7 +49,8 @@ export default {
       active: 0,
       rankList: [{ name: "魁首榜" }, { name: "跃进榜" }, { name: "失格榜" }],
       loading: false,
-      finished: false
+      finished: false,
+      favorites: []
     };
   },
   mounted() {
@@ -100,7 +101,8 @@ export default {
       }
       // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期
       return date.getFullYear() + seperator + nowMonth + seperator + strDate;
-    }
+    },
+    rootChange() {}
   }
 };
 </script>