Quellcode durchsuchen

1. 批改时主观题自动弹出批改页面 2. 客观题显示正确与否和实际得分

dusenyao vor 1 Jahr
Ursprung
Commit
08e1d19bd6
1 geänderte Dateien mit 38 neuen und 1 gelöschten Zeilen
  1. 38 1
      src/views/exercise_questions/answer/index.vue

+ 38 - 1
src/views/exercise_questions/answer/index.vue

@@ -5,6 +5,14 @@
         <i class="el-icon-arrow-left"></i>
         <span>返回</span>
       </div>
+      <div v-if="isAnnotations && is_objective" class="user-answer-info">
+        <template v-if="user_answer.answer_status === 1">
+          <span class="answer-status right"><SvgIcon icon-class="cross" />回答正确</span>
+        </template>
+        <template v-else-if="user_answer.answer_status === 2">
+          <span class="answer-status error"><SvgIcon icon-class="check-mark" />回答错误</span>
+        </template>
+      </div>
       <div class="question-info">
         <el-popover
           v-if="!isStart && !isSubmit"
@@ -269,6 +277,10 @@ export default {
         score_item: 1,
         score_type: 'aggregate',
       }, // 题目信息
+      // 用户答案
+      user_answer: {
+        answer_status: 0,
+      },
     };
   },
   computed: {
@@ -494,7 +506,7 @@ export default {
       GetQuestionInfo_AnswerRecord({
         answer_record_id: this.answer_record_id,
         question_id: this.questionList[this.curQuestionIndex].id,
-      }).then(({ question, user_answer: { is_fill_answer, content, is_objective }, remark }) => {
+      }).then(({ question, user_answer: { is_fill_answer, content, is_objective, answer_status }, remark }) => {
         // 批注
         this.remark = remark;
 
@@ -509,6 +521,7 @@ export default {
         }
 
         this.is_objective = this.isEnable(is_objective);
+        this.user_answer.answer_status = answer_status;
 
         // 如果已经填写过答案,直接显示答案
         if (is_fill_answer === 'true') {
@@ -555,6 +568,11 @@ export default {
             );
           });
         }
+
+        // 在有批注且为主观题时,弹出批注框
+        if (this.isAnnotations && !this.is_objective) {
+          this.isPopover = true;
+        }
       });
     },
     // 提交答题
@@ -670,6 +688,25 @@ export default {
       cursor: pointer;
     }
 
+    .user-answer-info {
+      .answer-status {
+        display: flex;
+        column-gap: 8px;
+        align-items: center;
+        padding: 8px 16px;
+        color: #fff;
+        border-radius: 40px;
+
+        &.right {
+          background-color: #3acb85;
+        }
+
+        &.error {
+          background-color: #e65656;
+        }
+      }
+    }
+
     .question-info {
       display: flex;
       column-gap: 12px;