Browse Source

修改答题权限

aaa 3 years ago
parent
commit
c29db3b773

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

@@ -34,7 +34,7 @@
         <div class="exam-question-describe">
           {{
             examQuestionList[answerIndex].questionContent ||
-              examQuestionList[answerIndex].content
+            examQuestionList[answerIndex].content
           }}
         </div>
         <!-- 答题列表 -->
@@ -42,9 +42,8 @@
         <div
           v-if="
             examQuestionList[answerIndex].type === questionType.TrueOrFalse ||
-              examQuestionList[answerIndex].type ===
-                questionType.singleChoice ||
-              examQuestionList[answerIndex].type === questionType.multipleChoice
+            examQuestionList[answerIndex].type === questionType.singleChoice ||
+            examQuestionList[answerIndex].type === questionType.multipleChoice
           "
           class="exam-question-options"
         >
@@ -55,7 +54,7 @@
               'exam-question-options-item': true,
               'exam-question-options-item-checked': answerValue.includes(item),
               'exam-question-options-false':
-                answerValue.includes(item) && answerStatus === 2
+                answerValue.includes(item) && answerStatus[answerIndex] === 2,
             }"
             @click="handleExamQuestionOptionsItemFun(item)"
           >
@@ -66,7 +65,7 @@
         <div
           v-if="examQuestionList[answerIndex].type === questionType.gapFilling"
           class="exam-question-gapFilling"
-          :class="{ 'exam-question-gapFilling-false': answerStatus === 2 }"
+          :class="{ 'exam-question-gapFilling-false': answerStatus[answerIndex] === 2 }"
         >
           <textarea
             v-for="(item, index) in examQuestionList[answerIndex]
@@ -74,7 +73,7 @@
             :key="index"
             :ref="'questionInputRef' + index"
             v-model="inputValue[index]"
-            :disabled="[1, 2].includes(answerStatus)"
+            :disabled="[1, 2].includes(answerStatus[answerIndex])"
             maxlength="200"
             rows="1"
             @change="handleExamQuestionOptionsItemFun(inputValue, index)"
@@ -123,7 +122,7 @@
           <div class="exam-question-single-button-box"></div>
           <div class="exam-question-single-button-box">
             <van-button
-              v-show="answerStatus === 0"
+              v-show="answerStatus[answerIndex] === 0"
               class="exam-question-button"
               type="primary"
               color="#0088e9"
@@ -134,7 +133,7 @@
           </div>
           <div class="exam-question-single-button-box">
             <van-button
-              v-show="answerStatus === 2"
+              v-show="answerStatus[answerIndex] === 2"
               class="exam-question-button"
               type="primary"
               color="#0088e9"
@@ -161,7 +160,7 @@
     <!-- 题目卡片 -->
     <div
       v-if="examQuestionList.length > 0"
-      v-show="answerStatus === 2"
+      v-show="answerStatus[answerIndex] === 2"
       class="exam-question-div"
     >
       <div class="exam-question-card">
@@ -203,7 +202,7 @@ export default {
         startTime: 0,
         endTime: 0
       }, // 答题的开始、结束时间
-      answerStatus: 0 // 当前答题状态: 0未作答 1已做答且正确 2已做答但错误
+      answerStatus: [] // 当前答题状态: 0未作答 1已做答且正确 2已做答但错误
     };
   },
   created() {
@@ -248,6 +247,9 @@ export default {
         .then(res => {
           if (res.data) {
             let httpResultData = [];
+            res.data.forEach(element => {
+              this.answerStatus.push(0);
+            });
             res.data.forEach((item, index) => {
               this.getExamQuestionsListFun(
                 item,
@@ -363,7 +365,6 @@ export default {
       if (this.answerIndex === index || !this.examQuestionList.length) {
         return;
       }
-      this.answerStatus = 0;
       this.answerIndex = index;
       switch (item.type) {
         case this.questionType.singleChoice:
@@ -382,7 +383,7 @@ export default {
     // 操作:作答了某个选项
     handleExamQuestionOptionsItemFun(value, index) {
       // 答错了的不允许修改
-      if (this.answerStatus === 2) {
+      if (this.answerStatus[this.answerIndex] === 2) {
         return;
       }
       let answerQuestionType = this.examQuestionList[this.answerIndex].type;
@@ -425,12 +426,12 @@ export default {
         return;
       }
       this.examQuestionList[this.answerIndex].userAnswer = this.answerValue;
-      this.answerStatus = this.getAnswerItemResultFun(
+      this.answerStatus[this.answerIndex] = this.getAnswerItemResultFun(
         this.examQuestionList[this.answerIndex]
       )
         ? 1
         : 2;
-      if (this.answerStatus === 1) {
+      if (this.answerStatus[this.answerIndex] === 1) {
         this.handleNextFun();
       }
     },

+ 0 - 7
src/views/home/answer/through/through-question-doing.vue

@@ -17,13 +17,6 @@
             <div class="through-question-head-left-txt">
               {{ examQuestionList[answerIndex].typeTxt || "undefind" }}
             </div>
-            <van-tag
-              plain
-              type="primary"
-              color="red"
-              v-if="answerRecruitId === 'daily-questions'"
-              >今日必答</van-tag
-            >
           </div>
           <div class="through-question-head-right">
             <span class="through-question-head-right-now">{{