Przeglądaj źródła

修改查询积分

aaa 4 lat temu
rodzic
commit
00f8f32963
2 zmienionych plików z 25 dodań i 5 usunięć
  1. 3 1
      src/api/modules/user.js
  2. 22 4
      src/views/home/person/page-person.vue

+ 3 - 1
src/api/modules/user.js

@@ -2,8 +2,10 @@
 export default {
   basePath: process.env.VUE_APP_JTXT_URL,
   apiList: {
-    // 查询根目录
+    // 查询今日积分
     JTXT_GET_USER_DAIYL_POINTS: "user/{userName}/daily-points",
+    // 查询总积分
+    JTXT_GET_USER_ALL_POINTS: "user/{userName}/points",
     //  查询考试历史
     JTXT_GET_USER_EXAMS_HISTORY: "exams/history",
     // 查询收藏

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

@@ -20,7 +20,7 @@
         <div class="todayScoreBox">
           <div class="flexRowStartCenter">
             <span class="todayScore">今日积分:</span>
-            <span class="todayScoreNum">50</span>
+            <span class="todayScoreNum">{{ todayPoints }}</span>
           </div>
         </div>
         <div style="height: 1rem"></div>
@@ -29,7 +29,7 @@
     <!-- 积分 -->
     <div class="all-score-box">
       <div class="allScoreCard">
-        <div class="allScore">总积分: 100</div>
+        <div class="allScore">总积分: {{ allPoints }}</div>
       </div>
     </div>
     <!-- 菜单 -->
@@ -58,6 +58,8 @@ export default {
   data() {
     return {
       maleAvatar,
+      todayPoints: 0,
+      allPoints: 0,
       avatarStyle: {
         "border-radius": "3rem",
         width: "1.8rem",
@@ -78,6 +80,7 @@ export default {
   },
   mounted() {
     this.getDailyPoints();
+    this.getAllPoints();
   },
   methods: {
     //   获取今日分数
@@ -88,8 +91,23 @@ export default {
       this.$_http
         .get(this.$pathParams(this.$_API.JTXT_GET_USER_DAIYL_POINTS, path))
         .then(res => {
-          this.contentObj = res.data;
-          console.log("--user--" + JSON.stringify(this.contentObj));
+          this.todayPoints = res.data;
+          console.log("--this.todayPoints--" + this.todayPoints);
+        })
+        .catch(() => {
+          this.$store.commit("toggleLoading", false);
+        });
+    },
+    //   查询总积分
+    getAllPoints() {
+      let path = {
+        userName: "testuser-zirKBELIlg"
+      };
+      this.$_http
+        .get(this.$pathParams(this.$_API.JTXT_GET_USER_ALL_POINTS, path))
+        .then(res => {
+          this.allPoints = res.data;
+          console.log("--user--" + this.allPoints);
         })
         .catch(() => {
           this.$store.commit("toggleLoading", false);