dusenyao преди 1 година
родител
ревизия
909073d6c9
променени са 1 файла, в които са добавени 15 реда и са изтрити 20 реда
  1. 15 20
      src/views/exercise_questions/answer/index.vue

+ 15 - 20
src/views/exercise_questions/answer/index.vue

@@ -110,7 +110,6 @@
 import { secondFormatConversion } from '@/utils/transform';
 import {
   GetExerciseQuestionIndexList,
-  GetQuestionInfo,
   GetShareRecordInfo,
   StartAnswer,
   FillQuestionAnswer,
@@ -193,7 +192,6 @@ export default {
   },
   watch: {
     curQuestionIndex() {
-      this.getQuestionInfo();
       this.getQuestionInfo_AnswerRecord();
     },
   },
@@ -293,20 +291,6 @@ export default {
         },
       );
     },
-    // 获取题目信息
-    getQuestionInfo() {
-      GetQuestionInfo({ question_id: this.questionList[this.curQuestionIndex].id })
-        .then(({ question }) => {
-          if (!question.content) return;
-
-          this.currentQuestion = JSON.parse(question.content);
-          this.curQuestionPage =
-            this.questionList.length === 0 || this.curQuestionIndex < 0
-              ? ''
-              : this.previewComponents[this.questionList[this.curQuestionIndex].type];
-        })
-        .catch(() => {});
-    },
     preQuestion() {
       if (this.curQuestionIndex === 0) return;
       this.curQuestionIndex -= 1;
@@ -351,13 +335,23 @@ export default {
       });
     },
     getQuestionInfo_AnswerRecord() {
-      if (!this.questionList[this.curQuestionIndex].isFill) return;
-
       GetQuestionInfo_AnswerRecord({
         answer_record_id: this.answer_record_id,
         question_id: this.questionList[this.curQuestionIndex].id,
-      }).then(({ user_answer: { is_fill_answer, content }, remark }) => {
+      }).then(({ question, user_answer: { is_fill_answer, content }, remark }) => {
+        // 批注
         this.remark = remark;
+
+        // 题目内容
+        if (question.content) {
+          this.currentQuestion = JSON.parse(question.content);
+          this.curQuestionPage =
+            this.questionList.length === 0 || this.curQuestionIndex < 0
+              ? ''
+              : this.previewComponents[this.questionList[this.curQuestionIndex].type];
+        }
+
+        // 答案
         if (is_fill_answer === 'false') return;
         this.$refs.exercise?.[0].showAnswer(
           this.answer_mode === 1 && !this.isTeacherAnnotations,
@@ -414,10 +408,11 @@ export default {
       const index = this.annotations.file_id_list.findIndex((item) => Object.hasOwn(item, file.uid));
       this.annotations.file_id_list.splice(index, 1);
     },
+    // 填写批注
     fillQuestionAnswerRemark() {
       FillQuestionAnswerRemark({
         answer_record_id: this.answer_record_id,
-        file: this.questionList[this.curQuestionIndex].id,
+        question_id: this.questionList[this.curQuestionIndex].id,
         file_id_list: this.annotations.file_id_list.map((item) => item[Object.keys(item)[0]]),
         score: this.annotations.score,
         remark: this.annotations.remark,