Kaynağa Gözat

开启拼音及切换句首大小写时重新识别

natasha 1 hafta önce
ebeveyn
işleme
a6ffb08c24

+ 22 - 9
src/views/book/courseware/create/components/question/table/Table.vue

@@ -144,7 +144,7 @@
         placeholder="请输入词汇,用于选词填空"
       />
       <p class="tips">在需要作答的单元格内输入三个以上下划线“___”</p>
-      <el-button @click="identifyText">识别</el-button>
+      <el-button @click="identifyText()">识别</el-button>
       <el-button @click="handleMultilingual">多语言</el-button>
       <template v-if="isEnable(data.has_identify)">
         <p class="tips">在需要作答的单元格内录入标准答案,多个填空答案用换行录入,同一个填空有多个答案用斜线“/”隔开</p>
@@ -188,7 +188,7 @@
           icon="el-icon-refresh"
           title="刷新"
           class="refresh-pinyin-btn"
-          @click.native="identifyText"
+          @click.native="identifyText()"
       /></el-divider>
       <template v-if="isEnable(data.property.view_pinyin)">
         <template v-for="(item, index) in data.option_list">
@@ -338,7 +338,11 @@ export default {
           this.data.paragraph_list_parameter.text = text;
           this.data.paragraph_list_parameter.is_first_sentence_first_hz_pinyin_first_char_upper_case =
             this.data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case;
-          this.createParsedTextInfoPinyin(text);
+          this.data.option_list.forEach((item, index) => {
+            item.forEach((items, indexs) => {
+              this.createParsedTextInfoPinyin(items.content, index + '#' + indexs);
+            });
+          });
         }
       },
       deep: true,
@@ -359,7 +363,11 @@ export default {
         if (text && isEnable(this.data.property.view_pinyin)) {
           this.data.paragraph_list_parameter.text = text;
           this.data.paragraph_list_parameter.is_first_sentence_first_hz_pinyin_first_char_upper_case = val;
-          this.createParsedTextInfoPinyin(text);
+          this.data.option_list.forEach((item, index) => {
+            item.forEach((items, indexs) => {
+              this.createParsedTextInfoPinyin(items.content, index + '#' + indexs);
+            });
+          });
         }
       },
       deep: true,
@@ -456,13 +464,18 @@ export default {
         if (editIndex) {
           let arr = editIndex.split('#');
           text = this.data.option_list[arr[0]][arr[1]].content;
+          this.createParsedTextInfoPinyin(text, editIndex);
+        } else {
+          this.data.option_list.forEach((item, index) => {
+            item.forEach((items, indexs) => {
+              this.createParsedTextInfoPinyin(items.content, index + '#' + indexs);
+            });
+          });
         }
-
-        this.createParsedTextInfoPinyin(text);
       }
     },
     // 获取拼音解析文本
-    createParsedTextInfoPinyin(text) {
+    createParsedTextInfoPinyin(text, editIndex) {
       if (text === '') {
         this.data.paragraph_list_parameter.pinyin_proofread_word_list = [];
         return;
@@ -493,8 +506,8 @@ export default {
             ),
           );
           this.data.paragraph_list = mergedData;
-          if (this.editContentIndex) {
-            let arr = this.editContentIndex.split('#');
+          if (editIndex) {
+            let arr = editIndex.split('#');
             let list = res.rich_text.text_list;
             list.forEach((item) => {
               let inputIndex = 0;