zhangjie 2 年之前
父節點
當前提交
e491538218
共有 1 個文件被更改,包括 15 次插入1 次删除
  1. 15 1
      src/modules/question/components/QuestionImportEdit.vue

+ 15 - 1
src/modules/question/components/QuestionImportEdit.vue

@@ -223,7 +223,7 @@ export default {
           this.transformRichImg(item.body);
         });
       }
-      // this.transformRichImg(question.quesAnswer);
+      question.quesAnswer = this.transformQuestionAnser(question.quesAnswer);
     },
     transformRichImg(richText) {
       if (isAnEmptyRichText(richText)) return;
@@ -237,6 +237,20 @@ export default {
         });
       });
     },
+    transformQuestionAnser(quesAnswer) {
+      let qAnswer = null;
+      try {
+        qAnswer = quesAnswer ? JSON.parse(quesAnswer) : null;
+      } catch (error) {
+        console.log(error);
+      }
+      if (!qAnswer || objTypeOf(qAnswer) !== "array") return quesAnswer;
+
+      qAnswer.forEach((item) => {
+        this.transformRichImg(item);
+      });
+      return JSON.stringify(qAnswer);
+    },
     initData() {
       this.paperData = [];
       this.paperRichJson = { sections: [] };