Browse Source

修改积分逻辑

aaa 3 years ago
parent
commit
a2c00253bd

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

@@ -7,7 +7,11 @@ export default {
     // 查询今日积分
     JTXT_GET_USER_DAIYL_POINTS: "user/{userName}/daily-points",
     // 查询总积分
-    JTXT_GET_USER_ALL_POINTS: "user/{userName}/points",
+    JTXT_GET_USER_ALL_POINTS: "user/{userName}/total-points",
+    // 查询学习积分
+    JTXT_GET_USER_LEARN_POINTS: "user/{userName}/learning-points",
+    // 查询考试积分
+    JTXT_GET_USER_EXAM_POINTS: "user/{userName}/exam-points",
     //  查询考试历史
     JTXT_GET_USER_EXAMS_HISTORY: "exams/history",
     // 查询收藏

+ 32 - 3
src/views/home/person/exam-history.vue

@@ -5,14 +5,18 @@
       <div class="exam-history-grades-div">
         <div class="exam-history-name-description">考试积分</div>
         <div class="exam-history-grades">
-          {{ this.user.userInfo.examPoints || 0 }}
+          {{ userExamPonits }}
         </div>
         <div class="exam-history-description" @click="clickExamRule">
           积分说明
         </div>
         <div class="exam-history-class-box">
-          <div class="exam-history-class-item">专项考试积分:0</div>
-          <div class="exam-history-class-item">普通考试积分:0</div>
+          <div class="exam-history-class-item">
+            专项考试积分:{{ specialExamPoints }}
+          </div>
+          <div class="exam-history-class-item">
+            普通考试积分:{{ generalExamPoints }}
+          </div>
         </div>
       </div>
 
@@ -55,6 +59,9 @@ export default {
   data() {
     return {
       loading: false,
+      userExamPonits: 0,
+      generalExamPoints: 0,
+      specialExamPoints: 0,
       userManualType: {
         ONE: 1,
         TWO: 2,
@@ -65,6 +72,7 @@ export default {
   },
   mounted() {
     this.getExamHistory();
+    this.getExamPoints();
   },
   computed: {
     ...mapState({
@@ -72,6 +80,27 @@ export default {
     })
   },
   methods: {
+    //   查询总积分
+    getExamPoints() {
+      let path = {
+        userName: this.user.userInfo.userName
+      };
+      this.$_http
+        .get(this.$pathParams(this.$_API.JTXT_GET_USER_EXAM_POINTS, path))
+        .then(res => {
+          console.log("----" + JSON.stringify(res));
+          if (res.data.GENERAL_EXAM) {
+            this.generalExamPoints = res.data.GENERAL_EXAM;
+          }
+          if (res.data.SPECIAL_EXAM) {
+            this.specialExamPoints = res.data.SPECIAL_EXAM;
+          }
+          this.userExamPonits = this.generalExamPoints + this.specialExamPoints;
+        })
+        .catch(() => {
+          this.$store.commit("toggleLoading", false);
+        });
+    },
     // 格式化已获得的积分/总积分的数
     formatePercentageFun(getPoints, totaPonits) {
       if (

+ 18 - 16
src/views/home/person/user-manual.vue

@@ -5,7 +5,7 @@
       <div class="user-manual-grades-div">
         <div class="user-manual-name-description">学习积分</div>
         <div class="user-manual-grades">
-          {{ this.user.userInfo.totalLearningPoints }}
+          {{ this.userLearnPonits }}
         </div>
         <div class="user-manual-description" @click="clickLearnRule">
           积分说明
@@ -90,16 +90,16 @@ export default {
           rightButton: "去看看",
           router: ""
         },
-        {
-          name: "答题",
-          type: "",
-          rule: "1分/每答对一道非今日必答题目",
-          isFinish: false,
-          getPoints: 0,
-          totalPonits: 10,
-          rightButton: "去答题",
-          router: ""
-        },
+        // {
+        //   name: "答题",
+        //   type: "",
+        //   rule: "1分/每答对一道非今日必答题目",
+        //   isFinish: false,
+        //   getPoints: 0,
+        //   totalPonits: 10,
+        //   rightButton: "去答题",
+        //   router: ""
+        // },
         {
           name: "专项答题",
           type: "SPECIAL_QUESTIONS",
@@ -131,7 +131,7 @@ export default {
           router: ""
         }
       ],
-      userTotalPonits: 0, // 用户的总积分
+      userLearnPonits: 0, // 用户的总积分
       todayEarnPoints: 0, // 今日已累计的积分
       sumPointsObj: {
         LOGIN: 0, // 登录
@@ -140,13 +140,15 @@ export default {
         READ_5_MINS: 0, // 阅读时长
         READ_2_HOURS: 0, // 阅读时长
         LEARNING_COMPLETE: 0, // 阅读完成
-        SPECIAL_QUESTIONS: 0 // 专项答题
+        SPECIAL_QUESTIONS: 0, // 专项答题
+        MANDATORY_LEARNING_COMPLETE: 0 // 今日必读
       }
     };
   },
   mounted() {
     this.getEvents();
     this.getDailyPoints();
+    this.getLearnPoints();
   },
   computed: {
     ...mapState({
@@ -196,14 +198,14 @@ export default {
         });
     },
     //   查询总积分
-    getAllPoints() {
+    getLearnPoints() {
       let path = {
         userName: this.user.userInfo.userName
       };
       this.$_http
-        .get(this.$pathParams(this.$_API.JTXT_GET_USER_ALL_POINTS, path))
+        .get(this.$pathParams(this.$_API.JTXT_GET_USER_LEARN_POINTS, path))
         .then(res => {
-          this.userTotalPonits = res.data || 0;
+          this.userLearnPonits = res.data || 0;
         })
         .catch(() => {
           this.$store.commit("toggleLoading", false);