Jelajahi Sumber

题型编辑修改

zhangjie 3 tahun lalu
induk
melakukan
816239e883

+ 38 - 2
src/assets/styles/pages.scss

@@ -295,7 +295,7 @@
 
     &-title {
       min-height: 42px;
-      line-height: 24px;
+      line-height: 20px;
       font-weight: 600;
       color: #313444;
       overflow-x: auto;
@@ -324,7 +324,7 @@
     }
 
     &-body {
-      line-height: 24px;
+      line-height: 20px;
       color: #6e7080;
       overflow-x: auto;
 
@@ -340,6 +340,8 @@
   }
 
   .paper-option {
+    line-height: 20px;
+
     p {
       display: inline;
     }
@@ -349,6 +351,13 @@
       height: 20px;
     }
   }
+  .paper-answer {
+    line-height: 20px;
+    > span {
+      display: inline-block;
+      vertical-align: top;
+    }
+  }
 
   .edit-paper-questions {
     > .edit-part {
@@ -681,3 +690,30 @@
     }
   }
 }
+
+// rich-text
+.rich-text {
+  display: inline-block;
+  vertical-align: top;
+  line-height: 20px;
+
+  img[data-is-answer-point] {
+    max-width: 100%;
+    max-height: 16px;
+    display: inline-block;
+    vertical-align: text-top;
+    border-bottom: 1px solid #000;
+  }
+  audio {
+    height: 20px;
+    display: inline-block;
+    vertical-align: top;
+    margin-left: 5px;
+    margin-right: 5px;
+  }
+}
+.question-answer {
+  display: inline-block;
+  vertical-align: top;
+  line-height: 20px;
+}

+ 7 - 12
src/components/RichText.vue

@@ -9,8 +9,10 @@ export default {
   name: "RichText",
   props: {
     textJson: {
-      type: String,
-      default: "{sections: []}",
+      type: [String, Object],
+      default() {
+        return { sections: [] };
+      },
     },
   },
   data() {
@@ -35,19 +37,12 @@ export default {
       return json;
     },
     renderVal(val) {
-      const jsonObj = this.getJson(val);
-      if (jsonObj) {
-        renderRichText(jsonObj, this.$el);
-      } else {
+      if (typeof textJson === "string") {
         this.$el.innerHTML = val;
+      } else {
+        renderRichText(val, this.$el);
       }
     },
   },
 };
 </script>
-
-<style>
-.rich-text {
-  display: inline-block;
-}
-</style>

+ 1 - 0
src/components/vEditor/VEditor.vue

@@ -199,6 +199,7 @@ export default {
   max-height: 16px;
   display: inline-block;
   vertical-align: text-top;
+  border-bottom: 1px solid #000;
 }
 
 .v-editor-body img.audio {

+ 78 - 0
src/modules/questions/component/QuestionAnswer.vue

@@ -0,0 +1,78 @@
+<template>
+  <div class="question-answer">
+    <template v-if="quesAnswer">
+      <div v-if="IS_SELECT_QUESTION || IS_BOOL_QUESTION">{{ quesAnswer }}</div>
+      <div v-else-if="IS_FILL_QUESTION">
+        <p v-for="(cont, cindex) in quesAnswer" :key="cindex">
+          <span style="margin-right: 5px">({{ cindex + 1 }})</span>
+          <rich-text :text-json="cont"></rich-text>
+        </p>
+      </div>
+      <rich-text
+        v-else-if="IS_TEXT_QUESTION"
+        :text-json="quesAnswer"
+      ></rich-text>
+      <div v-else></div>
+    </template>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "QuestionAnswer",
+  props: {
+    data: {
+      type: Object,
+      default() {
+        return {
+          questionType: "",
+          quesAnswer: "",
+        };
+      },
+    },
+  },
+  data() {
+    return {
+      optionNames: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+      quesAnswer: "",
+    };
+  },
+  computed: {
+    IS_SELECT_QUESTION() {
+      return (
+        this.data.questionType === "SINGLE_ANSWER_QUESTION" ||
+        this.data.questionType === "MULTIPLE_ANSWER_QUESTION"
+      );
+    },
+    IS_BOOL_QUESTION() {
+      return this.data.questionType === "BOOL_ANSWER_QUESTION";
+    },
+    IS_FILL_QUESTION() {
+      return this.data.questionType === "FILL_BLANK_QUESTION";
+    },
+    IS_TEXT_QUESTION() {
+      return this.data.questionType === "TEXT_ANSWER_QUESTION";
+    },
+  },
+  mounted() {
+    this.initData();
+  },
+  methods: {
+    initData() {
+      if (this.IS_SELECT_QUESTION) {
+        this.quesAnswer = JSON.parse(this.data.quesAnswer)
+          .map((item) => this.optionNames[item - 1])
+          .join("");
+      } else if (this.IS_BOOL_QUESTION) {
+        this.quesAnswer = this.data.quesAnswer === "true" ? "正确" : "错误";
+      } else if (this.IS_FILL_QUESTION) {
+        const answer = JSON.parse(this.data.quesAnswer);
+        this.quesAnswer = answer;
+      } else if (this.IS_TEXT_QUESTION) {
+        const answer = JSON.parse(this.data.quesAnswer);
+        this.quesAnswer = answer[0];
+      }
+    },
+  },
+};
+</script>

+ 3 - 0
src/modules/questions/views/EditOtherQuestion.vue

@@ -526,6 +526,8 @@ export default {
           this.prevAnswerPointCount = this.getAnswerPointCount(
             this.quesModel.quesBody
           );
+        } else {
+          this.quesAnswer = null;
         }
         this.initCourseProperty();
       });
@@ -538,6 +540,7 @@ export default {
     //查询所有课程属性名
     initCourseProperty() {
       var code = this.quesModel.course.code;
+      if (!code) return;
       this.$http
         .get(QUESTION_API + "/courseProperty/code/" + code)
         .then((response) => {

+ 134 - 38
src/modules/questions/views/EditPaper.vue

@@ -385,11 +385,11 @@
                     <rich-text :text-json="quesOption.optionBody"></rich-text>
                   </div>
                   <div v-if="!isNested(paperDetailUnit.questionType)">
-                    <div v-show="quesAnswerShow">
+                    <div v-show="quesAnswerShow" class="paper-answer">
                       <span>答案:</span>
-                      <rich-text
-                        :text-json="paperDetailUnit.question.quesAnswer"
-                      ></rich-text>
+                      <question-answer
+                        :data="paperDetailUnit.question"
+                      ></question-answer>
                     </div>
                   </div>
                 </div>
@@ -503,9 +503,10 @@
                       ></rich-text>
                     </div>
                   </div>
-                  <div v-show="quesAnswerShow">
+                  <div v-show="quesAnswerShow" class="paper-answer">
                     <span>答案:</span>
-                    <rich-text :text-json="subQuestion.quesAnswer"></rich-text>
+                    <question-answer :data="subQuestion"></question-answer>
+                    <!-- <rich-text :text-json="subQuestion.quesAnswer"></rich-text> -->
                   </div>
                 </div>
                 <div v-show="quesTagShow" class="edit-property">
@@ -802,11 +803,8 @@
         <el-form-item label="题目">
           <v-editor
             v-model="quesModel.quesBody"
-            :enable-answer-point="
-              quesModel.questionType == 'FILL_BLANK_QUESTION' ||
-              quesModel.questionType == 'CLOZE' ||
-              quesModel.questionType == 'BANKED_CLOZE'
-            "
+            :enable-answer-point="enableAnswerPoint"
+            @change="quesBodyChange"
           ></v-editor>
         </el-form-item>
         <el-form-item
@@ -883,7 +881,7 @@
               "
               class="option-body"
             >
-              <span v-html="quesOption.optionBody"></span>
+              <rich-text :text-json="quesOption.optionBody"></rich-text>
             </div>
             <div
               v-if="
@@ -917,15 +915,34 @@
           </el-button>
         </el-form-item>
         <!-- 答案 -->
-        <!-- 填空,简答 -->
-        <div
-          v-if="
-            quesModel.questionType == 'TEXT_ANSWER_QUESTION' ||
-            quesModel.questionType == 'FILL_BLANK_QUESTION'
-          "
-        >
-          <el-form-item label="答案">
-            <v-editor v-model="quesModel.quesAnswer"></v-editor>
+        <!-- 填空, -->
+        <div v-if="quesModel.questionType == 'FILL_BLANK_QUESTION'">
+          <el-form-item label="答案" prop="quesAnswer">
+            <div v-if="quesAnswer" class="option-list">
+              <div
+                v-for="(opt, index) of quesAnswer"
+                :key="index"
+                class="option-item"
+              >
+                <div class="option-item-info">
+                  <span>({{ index + 1 }})</span>
+                </div>
+                <v-editor
+                  :value="opt"
+                  class="option-item-body"
+                  @change="(val) => updateAnswerPoint(index, val)"
+                />
+              </div>
+            </div>
+          </el-form-item>
+        </div>
+        <!-- 简答 -->
+        <div v-if="quesModel.questionType === 'TEXT_ANSWER_QUESTION'">
+          <el-form-item label="答案" prop="quesAnswer">
+            <v-editor
+              v-model="quesAnswer"
+              @change="textAnswerChange"
+            ></v-editor>
           </el-form-item>
         </div>
         <!-- 单选或多选 -->
@@ -943,13 +960,17 @@
         <div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
           <el-row>
             <el-col>
-              <el-form-item label="答案" prop="quesAnswer">
-                <el-select v-model="quesModel.quesAnswer" placeholder="请选择">
+              <el-form-item label="答案">
+                <el-select
+                  v-model="quesAnswer"
+                  placeholder="请选择"
+                  @change="boolAnswerChange"
+                >
                   <el-option
                     v-for="op in options"
-                    :key="op"
-                    :label="op"
-                    :value="op"
+                    :key="op.value"
+                    :label="op.label"
+                    :value="op.value"
                   >
                   </el-option>
                 </el-select>
@@ -1191,13 +1212,24 @@ export default {
       questionTypes: QUESTION_TYPES,
       questionType: "",
       quesModel: { quesProperties: [] },
+      quesAnswer: null,
+      prevAnswerPointCount: 0,
       editpaperDetail: {},
       reduplicateQuestions: [],
       reduplicateGroup: [],
       reduplicateQuesColor: [],
       singleRightAnswer: "", //接收单选答案
       multipleRightAnswer: [], //接收多选答案
-      options: ["正确", "错误"],
+      options: [
+        {
+          value: 0,
+          label: "错误",
+        },
+        {
+          value: 1,
+          label: "正确",
+        },
+      ],
       duplicateLoading: false,
       dialogRadioFile: false,
       dialogAnswerFile: false,
@@ -1289,6 +1321,13 @@ export default {
       }
       return this.quesModel.quesAnswer;
     },
+    enableAnswerPoint() {
+      return (
+        this.quesModel.questionType == "FILL_BLANK_QUESTION" ||
+        this.quesModel.questionType == "CLOZE" ||
+        this.quesModel.questionType == "BANKED_CLOZE"
+      );
+    },
   },
   created() {
     let qt = sessionStorage.getItem("quesTagShow");
@@ -1885,18 +1924,21 @@ export default {
         this.quesModel.answerType = "DIVERSIFIED_TEXT";
       }
 
-      if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
-        this.quesModel.quesBody = this.quesModel.quesBody.replace(
-          /______/g,
-          "###"
-        );
-      }
-      if (this.isNested(this.quesModel.questionType)) {
-        this.quesModel.quesBody = this.quesModel.quesBody.replace(
-          /___([1-9][0-9]*)___/g,
-          "##$1##"
-        );
+      if (this.quesModel.questionType === "BOOL_ANSWER_QUESTION") {
+        this.quesAnswer = this.quesModel.quesAnswer === "true" ? 1 : 0;
+      } else if (this.quesModel.questionType === "TEXT_ANSWER_QUESTION") {
+        const answer = JSON.parse(this.quesModel.quesAnswer);
+        this.quesAnswer = answer[0];
+      } else if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
+        const answer = JSON.parse(this.quesModel.quesAnswer);
+        this.quesAnswer = answer;
+      } else {
+        this.quesAnswer = null;
       }
+      this.prevAnswerPointCount = this.getAnswerPointCount(
+        this.quesModel.quesBody
+      );
+
       this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
       this.openQuesDialog();
     },
@@ -1922,6 +1964,49 @@ export default {
         }
       }
     },
+    boolAnswerChange(val) {
+      this.quesModel.quesAnswer = val ? "true" : "false";
+    },
+    textAnswerChange(val) {
+      this.quesModel.quesAnswer = JSON.stringify([val]);
+    },
+    resetNumberAndSaveAnswerPoints(answer) {
+      this.quesAnswer = answer.map((element, index) => {
+        element.index = index + 1;
+        return element;
+      });
+      this.quesModel.quesAnswer = JSON.stringify(this.quesAnswer);
+    },
+    updateAnswerPoint(index, value) {
+      // console.log(index, this.question.answer[index]);
+      this.quesAnswer[index] = { ...value };
+      this.resetNumberAndSaveAnswerPoints(this.quesAnswer);
+    },
+    getAnswerPointCount(bodyJson) {
+      let count = 0;
+      bodyJson.sections.forEach((section) => {
+        section.blocks.forEach((block) => {
+          if (block.type === "cloze") count++;
+        });
+      });
+      return count;
+    },
+    quesBodyChange(quesBodyJson) {
+      this.quesModel.quesBody = quesBodyJson;
+
+      if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
+        let curPonitCount = this.getAnswerPointCount(quesBodyJson);
+        if (curPonitCount === this.prevAnswerPointCount) return;
+        this.prevAnswerPointCount = curPonitCount;
+
+        let newAnswer = [];
+        for (let i = 0; i < curPonitCount; i++) {
+          newAnswer.push(this.quesAnswer[i] || { sections: [] });
+        }
+
+        this.resetNumberAndSaveAnswerPoints(newAnswer);
+      }
+    },
     //打开修改试题编辑框
     openQuesDialog() {
       this.quesDialog = true;
@@ -2113,6 +2198,17 @@ export default {
         });
         return;
       }
+      if (this.enableAnswerPoint) {
+        const pointCount = this.getAnswerPointCount(this.quesModel.quesBody);
+        if (!pointCount) {
+          this.$notify({
+            message: "请插入答题点",
+            type: "error",
+          });
+          return;
+        }
+      }
+
       if (this.paper.paperType == "GENERATE") {
         this.$confirm(
           "试题内容修改,会影响所有关联试卷,是否确定进行?",

+ 135 - 34
src/modules/questions/views/EditPaperPendingTrial.vue

@@ -425,11 +425,11 @@
                     <rich-text :text-json="quesOption.optionBody"></rich-text>
                   </div>
                   <div v-if="!isNested(paperDetailUnit.questionType)">
-                    <div v-show="quesAnswerShow">
+                    <div v-show="quesAnswerShow" class="paper-answer">
                       <span>答案:</span>
-                      <rich-text
-                        :text-json="paperDetailUnit.question.quesAnswer"
-                      ></rich-text>
+                      <question-answer
+                        :data="paperDetailUnit.question"
+                      ></question-answer>
                     </div>
                   </div>
                 </div>
@@ -545,9 +545,9 @@
                       ></rich-text>
                     </div>
                   </div>
-                  <div v-show="quesAnswerShow">
+                  <div v-show="quesAnswerShow" class="paper-answer">
                     <span>答案:</span>
-                    <rich-text :text-json="subQuestion.quesAnswer"></rich-text>
+                    <question-answer :data="subQuestion"></question-answer>
                   </div>
                 </div>
                 <div v-show="quesTagShow" class="edit-property">
@@ -841,7 +841,11 @@
         </el-row>
         <!-- end by weiwenhai -->
         <el-form-item label="题目">
-          <v-editor v-model="quesModel.quesBody"></v-editor>
+          <v-editor
+            v-model="quesModel.quesBody"
+            :enable-answer-point="enableAnswerPoint"
+            @change="quesBodyChange"
+          ></v-editor>
         </el-form-item>
         <el-form-item
           v-for="(quesOption, optIndex) in quesModel.quesOptions"
@@ -917,7 +921,7 @@
               "
               class="option-body"
             >
-              <span v-html="quesOption.optionBody"></span>
+              <rich-text :text-json="quesOption.optionBody"></rich-text>
             </div>
             <div
               v-if="
@@ -951,15 +955,34 @@
           </el-button>
         </el-form-item>
         <!-- 答案 -->
-        <!-- 填空,简答 -->
-        <div
-          v-if="
-            quesModel.questionType == 'TEXT_ANSWER_QUESTION' ||
-            quesModel.questionType == 'FILL_BLANK_QUESTION'
-          "
-        >
-          <el-form-item label="答案">
-            <v-editor v-model="quesModel.quesAnswer"></v-editor>
+        <!-- 填空 -->
+        <div v-if="quesModel.questionType == 'FILL_BLANK_QUESTION'">
+          <el-form-item label="答案" prop="quesAnswer">
+            <div v-if="quesAnswer" class="option-list">
+              <div
+                v-for="(opt, index) of quesAnswer"
+                :key="index"
+                class="option-item"
+              >
+                <div class="option-item-info">
+                  <span>({{ index + 1 }})</span>
+                </div>
+                <v-editor
+                  :value="opt"
+                  class="option-item-body"
+                  @change="(val) => updateAnswerPoint(index, val)"
+                />
+              </div>
+            </div>
+          </el-form-item>
+        </div>
+        <!-- 简答 -->
+        <div v-if="quesModel.questionType === 'TEXT_ANSWER_QUESTION'">
+          <el-form-item label="答案" prop="quesAnswer">
+            <v-editor
+              v-model="quesAnswer"
+              @change="textAnswerChange"
+            ></v-editor>
           </el-form-item>
         </div>
         <!-- 单选或多选 -->
@@ -975,13 +998,17 @@
         </div>
         <!-- 判断 -->
         <div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
-          <el-form-item label="答案" prop="quesAnswer">
-            <el-select v-model="quesModel.quesAnswer" placeholder="请选择">
+          <el-form-item label="答案">
+            <el-select
+              v-model="quesAnswer"
+              placeholder="请选择"
+              @change="boolAnswerChange"
+            >
               <el-option
                 v-for="op in options"
-                :key="op"
-                :label="op"
-                :value="op"
+                :key="op.value"
+                :label="op.label"
+                :value="op.value"
               >
               </el-option>
             </el-select>
@@ -1242,13 +1269,24 @@ export default {
       questionTypes: QUESTION_TYPES,
       questionType: "",
       quesModel: { quesProperties: [] },
+      quesAnswer: null,
+      prevAnswerPointCount: 0,
       editpaperDetail: {},
       reduplicateQuestions: [],
       reduplicateGroup: [],
       reduplicateQuesColor: [],
       singleRightAnswer: "", //接收单选答案
       multipleRightAnswer: [], //接收多选答案
-      options: ["正确", "错误"],
+      options: [
+        {
+          value: 0,
+          label: "错误",
+        },
+        {
+          value: 1,
+          label: "正确",
+        },
+      ],
       duplicateLoading: false,
       dialogRadioFile: false,
       dialogAnswerFile: false,
@@ -1340,6 +1378,13 @@ export default {
       }
       return this.quesModel.quesAnswer;
     },
+    enableAnswerPoint() {
+      return (
+        this.quesModel.questionType == "FILL_BLANK_QUESTION" ||
+        this.quesModel.questionType == "CLOZE" ||
+        this.quesModel.questionType == "BANKED_CLOZE"
+      );
+    },
   },
   created() {
     let qt = sessionStorage.getItem("quesTagShow");
@@ -1980,18 +2025,21 @@ export default {
         this.quesModel.answerType = "DIVERSIFIED_TEXT";
       }
 
-      if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
-        this.quesModel.quesBody = this.quesModel.quesBody.replace(
-          /______/g,
-          "###"
-        );
-      }
-      if (this.isNested(this.quesModel.questionType)) {
-        this.quesModel.quesBody = this.quesModel.quesBody.replace(
-          /___([1-9][0-9]*)___/g,
-          "##$1##"
-        );
+      if (this.quesModel.questionType === "BOOL_ANSWER_QUESTION") {
+        this.quesAnswer = this.quesModel.quesAnswer === "true" ? 1 : 0;
+      } else if (this.quesModel.questionType === "TEXT_ANSWER_QUESTION") {
+        const answer = JSON.parse(this.quesModel.quesAnswer);
+        this.quesAnswer = answer[0];
+      } else if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
+        const answer = JSON.parse(this.quesModel.quesAnswer);
+        this.quesAnswer = answer;
+      } else {
+        this.quesAnswer = null;
       }
+      this.prevAnswerPointCount = this.getAnswerPointCount(
+        this.quesModel.quesBody
+      );
+
       this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
       this.openQuesDialog();
     },
@@ -2017,6 +2065,49 @@ export default {
         }
       }
     },
+    boolAnswerChange(val) {
+      this.quesModel.quesAnswer = val ? "true" : "false";
+    },
+    textAnswerChange(val) {
+      this.quesModel.quesAnswer = JSON.stringify([val]);
+    },
+    resetNumberAndSaveAnswerPoints(answer) {
+      this.quesAnswer = answer.map((element, index) => {
+        element.index = index + 1;
+        return element;
+      });
+      this.quesModel.quesAnswer = JSON.stringify(this.quesAnswer);
+    },
+    updateAnswerPoint(index, value) {
+      // console.log(index, this.question.answer[index]);
+      this.quesAnswer[index] = { ...value };
+      this.resetNumberAndSaveAnswerPoints(this.quesAnswer);
+    },
+    getAnswerPointCount(bodyJson) {
+      let count = 0;
+      bodyJson.sections.forEach((section) => {
+        section.blocks.forEach((block) => {
+          if (block.type === "cloze") count++;
+        });
+      });
+      return count;
+    },
+    quesBodyChange(quesBodyJson) {
+      this.quesModel.quesBody = quesBodyJson;
+
+      if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
+        let curPonitCount = this.getAnswerPointCount(quesBodyJson);
+        if (curPonitCount === this.prevAnswerPointCount) return;
+        this.prevAnswerPointCount = curPonitCount;
+
+        let newAnswer = [];
+        for (let i = 0; i < curPonitCount; i++) {
+          newAnswer.push(this.quesAnswer[i] || { sections: [] });
+        }
+
+        this.resetNumberAndSaveAnswerPoints(newAnswer);
+      }
+    },
     //打开修改试题编辑框
     openQuesDialog() {
       this.quesDialog = true;
@@ -2218,6 +2309,16 @@ export default {
         });
         return;
       }
+      if (this.enableAnswerPoint) {
+        const pointCount = this.getAnswerPointCount(this.quesModel.quesBody);
+        if (!pointCount) {
+          this.$notify({
+            message: "请插入答题点",
+            type: "error",
+          });
+          return;
+        }
+      }
       if (this.paper.paperType == "GENERATE") {
         this.$confirm(
           "试题内容修改,会影响所有关联试卷,是否确定进行?",

+ 9 - 5
src/modules/questions/views/QuestionInfo.vue

@@ -48,10 +48,14 @@
             </el-form-item>
           </template>
           <el-form-item label="答案" label-width="50px">
-            <rich-text
+            <question-answer
+              class="paper-question-body"
+              :data="subQuestionModel"
+            ></question-answer>
+            <!-- <rich-text
               class="paper-question-body"
               :text-json="subQuestionModel.quesAnswer"
-            ></rich-text>
+            ></rich-text> -->
           </el-form-item>
         </div>
       </template>
@@ -60,10 +64,10 @@
         v-if="!quesModel.subQuestions || !quesModel.subQuestions.length"
         label="答案"
       >
-        <rich-text
+        <question-answer
           class="paper-question-body padding-top-6"
-          :text-json="quesModel.quesAnswer"
-        ></rich-text>
+          :data="quesModel"
+        ></question-answer>
       </el-form-item>
 
       <div class="line-seperator"></div>

+ 6 - 6
src/modules/questions/views/QuestionPreview.vue

@@ -61,10 +61,10 @@
             </el-form-item>
           </template>
           <el-form-item label="答案">
-            <rich-text
+            <question-answer
               class="paper-question-body"
-              v-html="subQuestionModel.quesAnswer"
-            ></rich-text>
+              :data="subQuestionModel"
+            ></question-answer>
           </el-form-item>
         </div>
       </template>
@@ -73,10 +73,10 @@
         v-if="!quesModel.subQuestions || !quesModel.subQuestions.length"
         label="答案"
       >
-        <rich-text
+        <question-answer
           class="paper-question-body"
-          :text-json="quesModel.quesAnswer"
-        ></rich-text>
+          :data="quesModel"
+        ></question-answer>
       </el-form-item>
     </el-form>
   </el-dialog>

+ 3 - 3
src/modules/questions/views/ViewPaper.vue

@@ -391,11 +391,11 @@
           </div>
         </el-form-item>
         <el-form-item v-if="!isNested(quesModel.questionType)" label="答案">
-          <rich-text
+          <question-answer
             class="paper-question-body"
             style="padding-top: 6px"
-            :text-json="quesModel.quesAnswer"
-          ></rich-text>
+            :data="quesModel"
+          ></question-answer>
         </el-form-item>
       </el-form>
       <div slot="footer">