Jelajahi Sumber

气泡列表添加课文内容列

natasha 1 Minggu lalu
induk
melakukan
64ab31d3ee

+ 1 - 1
src/components/RichText.vue

@@ -131,7 +131,7 @@ export default {
       default: false,
     },
     itemIndex: {
-      type: Number,
+      type: [Number, String],
       default: null,
     },
     isTitle: {

+ 3 - 0
src/views/book/courseware/create/components/question/article/Article.vue

@@ -671,6 +671,7 @@ export default {
               notesColor: '#8206BF',
               id: '',
               isRich: true,
+              matchNotes: sItem.text,
             },
           };
           sentArr.push(obj);
@@ -774,6 +775,7 @@ export default {
                     notesColor: '#8206BF',
                     id: '',
                     isRich: true,
+                    matchNotes: sItem.text,
                   },
                 };
                 sentArr.push(obj);
@@ -1400,6 +1402,7 @@ export default {
                   notesColor: '#8206BF',
                   id: '',
                   isRich: true,
+                  matchNotes: itemss.chs,
                 };
               } else {
                 itemss.matchNotesObj = obj;

+ 2 - 1
src/views/book/courseware/create/components/question/article/Notes.vue

@@ -19,7 +19,8 @@
           <el-input v-model="scope.row.number" />
         </template>
       </el-table-column> -->
-      <el-table-column fixed prop="con" label="内容">
+      <el-table-column fixed prop="matchNotes" label="课文内容" width="120px"> </el-table-column>
+      <el-table-column fixed prop="con" label="气泡">
         <template slot-scope="scope">
           <RichText
             v-if="property.isGetContent"

+ 3 - 0
src/views/book/courseware/create/components/question/dialogue_article/Article.vue

@@ -1094,6 +1094,7 @@ export default {
               notesColor: '#8206BF',
               id: '',
               isRich: true,
+              matchNotes: sItem.text,
             },
           };
           sentArr.push(obj);
@@ -1205,6 +1206,7 @@ export default {
                     notesColor: '#8206BF',
                     id: '',
                     isRich: true,
+                    matchNotes: sItem.text,
                   },
                 };
                 sentArr.push(obj);
@@ -1844,6 +1846,7 @@ export default {
                   notesColor: '#8206BF',
                   id: '',
                   isRich: true,
+                  matchNotes: itemss.chs,
                 };
               } else {
                 itemss.matchNotesObj = obj;

+ 47 - 5
src/views/book/courseware/create/components/question/table/Table.vue

@@ -107,7 +107,7 @@
       <div class="option-list">
         <div v-for="(item, i) in data.option_list" :key="i" class="table-node">
           <el-color-picker v-model="data.rows_bg_list[i]" />
-          <div v-for="li in item" :key="li.mark" class="table-item">
+          <div v-for="(li, j) in item" :key="li.mark" class="table-item">
             <!-- eslint-disable max-len -->
             <RichText
               v-if="property.isGetContent"
@@ -117,6 +117,7 @@
               :font-family="data?.unified_attrib?.font"
               :font-color="data?.unified_attrib?.text_color"
               :inline="true"
+              :itemIndex="i + '#' + j"
               toolbar="fontselect fontsizeselect forecolor backcolor | underline | bold italic strikethrough alignleft aligncenter alignright image media link"
               @handleRichTextBlur="handleBlurCon"
             />
@@ -269,6 +270,7 @@ export default {
       activeCell: null,
       editCellFlag: false,
       statusList: ['normal', 'tick', 'cross'],
+      editContentIndex: '', // 编辑内容的单元格索引
     };
   },
   watch: {
@@ -403,7 +405,7 @@ export default {
       });
     },
     // 识别文本
-    identifyText() {
+    identifyText(editIndex) {
       let text = '';
       this.data.has_identify = 'true';
       this.data.option_list.forEach((item, index) => {
@@ -448,6 +450,11 @@ export default {
         });
       });
       if (isEnable(this.data.property.view_pinyin)) {
+        if (editIndex) {
+          let arr = editIndex.split('#');
+          text = this.data.option_list[arr[0]][arr[1]].content;
+        }
+
         this.createParsedTextInfoPinyin(text);
       }
     },
@@ -483,7 +490,37 @@ export default {
             ),
           );
           this.data.paragraph_list = mergedData;
-          this.$set(this.data, 'rich_text_list', res.rich_text.text_list);
+          if (this.editContentIndex) {
+            let arr = this.editContentIndex.split('#');
+            let list = res.rich_text.text_list;
+            list.forEach((item) => {
+              let inputIndex = 0;
+              if (item.word_list) {
+                item.word_list.forEach((items, index) => {
+                  let isUnderline = /^_{3,}$/.test(items.text);
+                  if (isUnderline) {
+                    let obj = {
+                      value: '',
+                      type: 'input',
+                      mark: getRandomNumber(),
+                      inputIndex,
+                      write_base64: '',
+                      audio_answer_list: [],
+                    };
+                    inputIndex++;
+                    item.word_list[index] = { ...items, ...obj };
+                  } else {
+                    items.type = 'text';
+                  }
+                });
+              } else {
+                item.type = 'text';
+              }
+            });
+            this.$set(this.data.option_list[arr[0]][arr[1]], 'rich_text_list', list);
+          } else {
+            this.$set(this.data, 'rich_text_list', res.rich_text.text_list);
+          }
           let pinyin_index = 0;
           this.data.option_list.forEach((item, index) => {
             item.forEach((items, indexs) => {
@@ -508,8 +545,12 @@ export default {
               }
             });
           });
+          if (this.editContentIndex) {
+            this.editContentIndex = '';
+          }
         }
       });
+      console.log(this.data);
     },
     // 填充校对后的拼音
     fillCorrectPinyin({ selectContent: { text, pinyin, activeTextStyle }, i, j, k }) {
@@ -536,8 +577,9 @@ export default {
       });
       this.data.mind_map.node_list = node_list;
     },
-    handleBlurCon() {
-      this.identifyText();
+    handleBlurCon(index) {
+      this.editContentIndex = index;
+      this.identifyText(index);
       this.handleMindMap();
     },
     handleMultilingual() {