zhangjie 2 vuotta sitten
vanhempi
commit
829c1eadec

+ 31 - 11
src/modules/question/components/QuestionImportEdit.vue

@@ -121,8 +121,8 @@
 </template>
 
 <script>
-import paperRichTextJson from "../datas/paperRichText.json";
-import paperParseData from "../datas/paperParseData.json";
+// import paperRichTextJson from "../datas/paperRichText.json";
+// import paperParseData from "../datas/paperParseData.json";
 
 import { calcSum, deepCopy, objTypeOf, randomCode } from "@/plugins/utils";
 import QuestionImportPaperEdit from "./QuestionImportPaperEdit.vue";
@@ -198,11 +198,11 @@ export default {
     async visibleChange() {
       await this.getCourseProperty();
 
-      this.resetData({
-        richText: paperRichTextJson,
-        detailInfo: paperParseData,
-      });
-      // this.resetData(this.data);
+      // this.resetData({
+      //   richText: paperRichTextJson,
+      //   detailInfo: paperParseData,
+      // });
+      this.resetData(this.data);
 
       this.$nextTick(() => {
         this.registScrollEvent();
@@ -343,7 +343,7 @@ export default {
       let richText = this.$refs.RichTextEditor.emitJsonAction();
       richText.sections = richText.sections.filter(
         (item) =>
-          !item.attributes || item.attributes["class"] !== "remark-error"
+          !item.attributes || item.attributes["class"] !== "section-error"
       );
 
       const res = await questionImportParseRichText({
@@ -358,8 +358,17 @@ export default {
         questionInfoField
       );
       // console.log(cacheData);
-      this.paperData = this.assignCachePaperData(res.data, cacheData);
+      this.paperData = this.assignCachePaperData(
+        res.data.detailInfo,
+        cacheData
+      );
+      this.paperRichJson = this.transformRichText(deepCopy(res.data.richText));
+      this.transformDataInfo();
       this.questionKey = randomCode();
+
+      this.$nextTick(() => {
+        this.getRichTextIndexList();
+      });
     },
     getCachePaperInfo(paperData, cacheFields = []) {
       let cachePaperInfo = {};
@@ -796,7 +805,11 @@ export default {
     paperScrollEvent(e) {
       // e.preventDefault();
       // e.stopPropagation();
-      if (this.scrollType === "rich-text") return;
+      if (this.scrollType === "rich-text") {
+        this.lastPaperScrollTop =
+          document.getElementById("qe-part-paper").scrollTop;
+        return;
+      }
       this.scrollType = "paper";
       setTimeout(() => {
         this.scrollType = "";
@@ -865,13 +878,20 @@ export default {
         : Math.min(textScrollTop, richTextContainerDom.scrollTop);
     },
     richTextScrollEvent(e) {
-      if (this.scrollType === "paper") return;
+      if (this.scrollType === "paper") {
+        this.lastRichTextScrollTop =
+          this.$refs.RichTextEditor.$el.querySelector(
+            ".v-editor-container"
+          ).scrollTop;
+        return;
+      }
       this.scrollType = "rich-text";
       setTimeout(() => {
         this.scrollType = "";
       }, 100);
 
       const isScrollDown = e.target.scrollTop > this.lastRichTextScrollTop;
+      // console.log(isScrollDown, e.target.scrollTop, this.lastRichTextScrollTop);
       this.lastRichTextScrollTop = e.target.scrollTop;
       const offsetH = isScrollDown ? 150 : 0;
       const scrollTop = e.target.scrollTop + offsetH;

+ 8 - 8
src/modules/question/views/QuestionManage.vue

@@ -341,14 +341,14 @@ export default {
       this.$refs.QuestionEditDialog.open();
     },
     toImportQuestion() {
-      // this.$refs.QuestionImportDialog.open();
-      this.questionImportData = {
-        importData: {
-          courseId: 9,
-          courseName: "化学",
-        },
-      };
-      this.$refs.QuestionImportEdit.open();
+      this.$refs.QuestionImportDialog.open();
+      // this.questionImportData = {
+      //   importData: {
+      //     courseId: 9,
+      //     courseName: "化学",
+      //   },
+      // };
+      // this.$refs.QuestionImportEdit.open();
     },
     toViewQuestion(row) {
       this.curQuestion = row;