Browse Source

修改积分和考试结束

aaa 3 years ago
parent
commit
b6b42e8371
2 changed files with 13 additions and 10 deletions
  1. 3 2
      src/views/home/exam/page-exam.vue
  2. 10 8
      src/views/home/person/user-manual.vue

+ 3 - 2
src/views/home/exam/page-exam.vue

@@ -18,7 +18,7 @@
                 item.examStatus === examStatesType.STARTED,
               'exam-item-states-red':
                 item.examStatus === examStatesType.EXAMOVER ||
-                item.examStatus === examStatesType.NOTEXAM
+                item.examStatus === examStatesType.NOTEXAM,
             }"
           >
             {{ item.examStatusTxt }}
@@ -141,6 +141,7 @@ export default {
       let curTime = Date.now();
       let startTimesCeconds = new Date(startTime).getTime();
       let endTimeCeconds = new Date(endTime).getTime();
+
       if (curTime >= startTimesCeconds) {
         if (curTime >= endTimeCeconds) {
           if (this.exam.examHistoryObj[exam.id]) {
@@ -180,7 +181,7 @@ export default {
         case this.examStatesType.STARTED:
         case this.examStatesType.STARTEXAMING:
         case this.examStatesType.NOTEXAM:
-          isCouldExam = true;
+          Toast("考试已结束");
           break;
         default:
           isCouldExam = true;

+ 10 - 8
src/views/home/person/user-manual.vue

@@ -34,7 +34,7 @@
               <div class="user-manual-item-left-schedule">
                 <van-progress
                   :percentage="
-                    formatePercentageFun(item.getPoints, item.totaPonits)
+                    formatePercentageFun(item.getPoints, item.totalPonits)
                   "
                   :show-pivot="false"
                 />
@@ -92,7 +92,7 @@ export default {
         },
         {
           name: "答题",
-          type: "LEARNING_COMPLETE",
+          type: "",
           rule: "1分/每答对一道非今日必答题目",
           isFinish: false,
           getPoints: 0,
@@ -102,7 +102,7 @@ export default {
         },
         {
           name: "专项答题",
-          type: "WEEKLY_QUESTION",
+          type: "SPECIAL_QUESTIONS",
           rule: "1分/每答对一道专项答题",
           isFinish: false,
           getPoints: 0,
@@ -139,7 +139,8 @@ export default {
         WEEKLY_QUESTIONS: 0, // 每周考试
         READ_5_MINS: 0, // 阅读时长
         READ_2_HOURS: 0, // 阅读时长
-        LEARNING_COMPLETE: 0 // 阅读完成
+        LEARNING_COMPLETE: 0, // 阅读完成
+        SPECIAL_QUESTIONS: 0 // 专项答题
       }
     };
   },
@@ -165,6 +166,7 @@ export default {
             res.data.forEach(element => {
               this.sumPointsObj[element.event] += element.delta;
             });
+            console.log("-------" + JSON.stringify(this.sumPointsObj));
             this.updateGetPoints();
           }
         })
@@ -208,17 +210,17 @@ export default {
         });
     },
     // 格式化已获得的积分/总积分的数
-    formatePercentageFun(getPoints, totaPonits) {
+    formatePercentageFun(getPoints, totalPonits) {
       if (
         (!getPoints && getPoints !== 0) ||
-        (!totaPonits && totaPonits !== 0)
+        (!totalPonits && totalPonits !== 0)
       ) {
         return 0;
       }
-      if (isNaN(getPoints) || isNaN(totaPonits)) {
+      if (isNaN(getPoints) || isNaN(totalPonits)) {
         return 0;
       }
-      return Math.round((getPoints / totaPonits) * 100) || 0;
+      return Math.round((getPoints / totalPonits) * 100) || 0;
     },
     // 操作:返回
     onClickLeft() {