aaa 3 years ago
parent
commit
9c5e18aa65

+ 1 - 1
public/index.html

@@ -18,7 +18,7 @@
   <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
   <link rel="icon" type="image/x-icon" href="favicon.ico" />
   <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
-  <title>京学堂</title>
+  <title>京学堂</title>
 </head>
 
 <body>

+ 1 - 1
src/common/permission.js

@@ -10,7 +10,7 @@ NProgress.configure({ showSpinner: false });
 router.beforeEach(async (to, from, next) => {
   let title = "";
   const isCorrect = document.title.includes("test");
-  title = isCorrect ? document.title : "京学堂";
+  title = isCorrect ? document.title : "京学堂";
   document.title = title;
   NProgress.start();
   next();

+ 6 - 6
src/views/home/answer/page-answer-recruit-result.vue

@@ -3,9 +3,9 @@
     <van-nav-bar title="答题" left-arrow @click-left="handleBackFun" />
     <div class="exam-item-result-div">
       <div class="exam-item-result-title">本次答对题目数</div>
-      <div class="exam-item-result-grade">{{ grades }}</div>
+      <div class="exam-item-result-grade">{{ rightNum }}</div>
       <div>正确率:{{ accuracyVal }}</div>
-      <!-- <div>积分+{{ grades }}</div> -->
+      <!-- <div>积分+{{ rightNum }}</div> -->
       <div class="exam-item-detial-button-box">
         <van-button
           class="exam-item-detial-button"
@@ -34,12 +34,12 @@ export default {
   components: {},
   data() {
     return {
-      grades: 0,
+      rightNum: 0,
       allQuestionsNum: 0
     };
   },
   created() {
-    this.grades = this.$route.params.grades || 0;
+    this.rightNum = this.$route.params.rightNum || 0;
     this.allQuestionsNum = this.$route.params.allQuestionsNum || 0;
     this.setLanXinNavigator();
   },
@@ -53,12 +53,12 @@ export default {
     }),
     accuracyVal() {
       let that = this;
-      if (isNaN(that.grades) || isNaN(that.allQuestionsNum)) {
+      if (isNaN(that.rightNum) || isNaN(that.allQuestionsNum)) {
         return "-";
       }
       return that.allQuestionsNum <= 0
         ? "0%"
-        : Math.round((that.grades / that.allQuestionsNum) * 10000) / 100.0 +
+        : Math.round((that.rightNum / that.allQuestionsNum) * 10000) / 100.0 +
             "%";
     }
   },

+ 16 - 13
src/views/home/answer/page-answer-recruit.vue

@@ -585,17 +585,19 @@ export default {
       let curTime = new Date();
       this.answerTime.endTime = curTime; // 赋值开始时间
       this.$store.commit("toggleLoading", true);
-      let grades = this.getUserExamAllPointsFun(); // 方法:计算成绩
+      let res = this.getUserExamAllPointsFun(); // 方法:计算成绩
+      let grades = res.grades;
+      let num = res.num;
       let answers = this.getUserExamAllAnswersFun(); // 方法:获取当前用户所有题目作答的答案
       if (this.answerRecruitId === "weekly-questions") {
-        this.weeklyExamsEnd(grades, answers);
+        this.weeklyExamsEnd(grades, num, answers);
       } else if (this.answerRecruitId === "special-questions") {
-        this.specialExamEnd(grades, answers);
+        this.specialExamEnd(grades, num, answers);
       } else {
-        this.normalExamsEnd(grades, answers);
+        this.normalExamsEnd(grades, num, answers);
       }
     },
-    normalExamsEnd(grades, answers) {
+    normalExamsEnd(grades, num, answers) {
       let params = {
         userId: this.userInfo.userName,
         examId: this.answerRecruitId,
@@ -617,7 +619,7 @@ export default {
             name: "answerRecruitResult",
             params: {
               allQuestionsNum: this.examQuestionList.length,
-              grades: grades
+              rightNum: num
             }
           });
         })
@@ -628,7 +630,7 @@ export default {
           this.$router.back();
         });
     },
-    weeklyExamsEnd(grades, answers) {
+    weeklyExamsEnd(grades, num, answers) {
       let params = {
         userName: this.userInfo.userName,
         weeklyQuestionId: this.questionId,
@@ -650,7 +652,7 @@ export default {
             name: "answerRecruitResult",
             params: {
               allQuestionsNum: this.examQuestionList.length,
-              grades: grades
+              grades: num
             }
           });
         })
@@ -661,7 +663,7 @@ export default {
           this.$router.back();
         });
     },
-    specialExamEnd(grades, answers) {
+    specialExamEnd(grades, num, answers) {
       let params = {
         userName: this.userInfo.userName,
         specialQuestionId: this.questionId,
@@ -683,7 +685,7 @@ export default {
             name: "answerRecruitResult",
             params: {
               allQuestionsNum: this.examQuestionList.length,
-              grades: grades
+              grades: num
             }
           });
         })
@@ -696,14 +698,15 @@ export default {
     },
     // 方法:计算成绩
     getUserExamAllPointsFun() {
-      let grades = 0;
+      let result = { "grades": 0, "num": 0 };
       this.examQuestionList.forEach(item => {
         let isSure = this.getAnswerItemResultFun(item);
         if (isSure) {
-          grades++; // 默认每题一分
+          result.grades += item.points; // 默认每题一分
+          result.num += 1;
         }
       });
-      return grades;
+      return result;
     },
     // 方法:获取题目的答案
     getUserExamAllAnswersFun() {

+ 8 - 5
src/views/home/answer/through/through-question-doing.vue

@@ -455,7 +455,9 @@ export default {
       let curTime = new Date();
       this.answerTime.endTime = curTime; // 赋值开始时间
       this.$store.commit("toggleLoading", true);
-      let grades = this.getUserExamAllPointsFun(); // 方法:计算成绩
+      let res = this.getUserExamAllPointsFun(); // 方法:计算成绩
+      let grades = res.grades;
+      let num = res.num;
       let answers = this.getUserExamAllAnswersFun(); // 方法:获取当前用户所有题目作答的答案
       let params = {
         userId: this.userInfo.userName,
@@ -478,7 +480,7 @@ export default {
             name: "throughQuestionEnd",
             params: {
               allQuestionsNum: this.examQuestionList.length,
-              grades: grades
+              rightNum: num
             }
           });
         })
@@ -491,14 +493,15 @@ export default {
     },
     // 方法:计算成绩
     getUserExamAllPointsFun() {
-      let grades = 0;
+      let result = { "grades": 0, "num": 0 };
       this.examQuestionList.forEach(item => {
         let isSure = this.getAnswerItemResultFun(item);
         if (isSure) {
-          grades++; // 默认每题一分
+          result.grades += item.points; // 默认每题一分
+          result.num += 1;
         }
       });
-      return grades;
+      return result;
     },
     // 方法:获取题目的答案
     getUserExamAllAnswersFun() {

+ 6 - 15
src/views/home/exam/page-exam-item-doing.vue

@@ -534,7 +534,8 @@ export default {
       //   history.pushState(null, null, document.URL);
       // });
       this.$store.commit("toggleLoading", true);
-      let grades = this.getUserExamAllPointsFun(); // 方法:计算成绩
+      let res = this.getUserExamAllPointsFun(); // 方法:计算成绩
+      let grades = res.grades;
       let answers = this.getUserExamAllAnswersFun(); // 方法:获取当前用户所有题目作答的答案
       let params = {
         userId: this.userInfo.userName,
@@ -567,25 +568,15 @@ export default {
     },
     // 方法:计算成绩
     getUserExamAllPointsFun() {
-      let grades = 0;
+      let result = { "grades": 0, "num": 0 };
       this.examQuestionList.forEach((item, index) => {
-        // let sureNum = 0;
-        // item.finalAnswer.forEach(it => {
-        //   item.userAnswer.forEach(answerItem => {
-        //     if (it === answerItem) {
-        //       sureNum++;
-        //     }
-        //   });
-        // });
-        // if (sureNum === item.finalAnswer.length) {
-        //   grades++; // 默认每题一分
-        // }
         let isSure = this.getAnswerItemResultFun(item);
         if (isSure) {
-          grades++; // 默认每题一分
+          result.grades += item.points; // 默认每题一分
+          result.num += 1;
         }
       });
-      return grades;
+      return result;
     },
     // 方法:判断当前题目是否正确
     getAnswerItemResultFun(item) {

+ 11 - 1
src/views/home/exam/page-exam.vue

@@ -69,7 +69,8 @@ export default {
   computed: {
     ...mapState({
       exam: state => state.exam,
-      chooseEngneeringWork: state => state.user.chooseEngneeringWork
+      chooseEngneeringWork: state => state.user.chooseEngneeringWork,
+      user: state => state.user
     })
   },
   watch: {
@@ -88,6 +89,14 @@ export default {
   },
   destroyed () {
   },
+  activated () {
+    console.log("aaaaaaaaaaa");
+    this.examList = [];
+    this.examPage = 0;
+    this.examSize = 10;
+
+    this.getExamListFun();
+  },
   methods: {
     scrollExamBox(e) {
       if (this.canExamFlag && e.srcElement.scrollTop + e.srcElement.offsetHeight > e.srcElement.scrollHeight - 100) {
@@ -103,6 +112,7 @@ export default {
       this.$store.commit("toggleLoading", true);
       let params = {
         engineertypeid: this.chooseEngneeringWork.id,
+        username: this.user.userInfo.userName,
         page: this.examPage,
         size: this.examSize
       };

+ 2 - 2
src/views/home/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="home-box">
     <van-nav-bar
-      title="京学堂"
+      title="京学堂"
       left-text=""
       right-text=""
       bind:click-left=""
@@ -104,7 +104,7 @@ export default {
     // 设置蓝信navigator
     setLanXinNavigator() {
       lx.ui.setNavigationBarTitle({
-        title: "京学堂"
+        title: "京学堂"
       });
     },
     // 初始化