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: [] };