Ver código fonte

选择声调去掉轻声

natasha 1 ano atrás
pai
commit
d5e58a225d

+ 7 - 0
src/views/exercise_questions/create/components/exercises/ChineseQuestion.vue

@@ -41,6 +41,7 @@
               v-model="item.pinyin"
               :placeholder="data.property.learn_type === 'dictation' ? '拼音间用空格隔开' : '输入拼音'"
               @blur="handleSplitPy(item)"
+              @change="changePinyin(item)"
             />
             <UploadAudio
               v-if="data.other.audio_generation_method === 'upload'"
@@ -332,6 +333,12 @@ export default {
         item.pinyin_item_list.push(obj);
       });
     },
+    // 修改拼音
+    changePinyin(item) {
+      if (this.data.other.audio_generation_method === 'auto') {
+        item.audio_file_id = '';
+      }
+    },
   },
 };
 </script>

+ 12 - 5
src/views/exercise_questions/create/components/exercises/ChooseToneQuestion.vue

@@ -25,6 +25,7 @@
               v-model="item.content"
               placeholder="拼音间用空格隔开,如:ni3 ha3o"
               @blur="handleItemAnswer(item)"
+              @change="changePinyin(item)"
             />
             <UploadAudio
               v-if="data.other.audio_generation_method === 'upload'"
@@ -277,7 +278,7 @@ export default {
       let content_preview = '';
       this.res_arr = [];
       this.$set(this.matically_pinyin_obj, item.mark, []);
-      content_arr.forEach((items) => {
+      content_arr.forEach((items, index) => {
         let items_trim = items.trim();
         if (items_trim) {
           let items_yuan = JSON.parse(JSON.stringify(items_trim)).replace(/0|1|2|3|4/, '');
@@ -285,10 +286,10 @@ export default {
           if (this.data.property.answer_mode === 'select') {
             // 如果是选择声调 把声调放在拼音后面
             // select_item += `${items_yuan + items_trim.substring(indexs, indexs + 1)} `;
-            select_item += `${items_trim.substring(indexs, indexs + 1)} `;
+            select_item += `${items_trim.substring(indexs, indexs + 1)}${index === content_arr.length - 1 ? '' : ' '}`;
           } else if (this.data.property.answer_mode === 'label') {
             // 如果是标注声调 把声调放在对应字母后面
-            select_item += `${items_trim} `;
+            select_item += `${items_trim}${index === content_arr.length - 1 ? '' : ' '}`;
           }
           content_preview += `${items_yuan} `;
           this.handleReplaceTone(items_yuan + items_trim.substring(indexs, indexs + 1), item.mark);
@@ -297,11 +298,11 @@ export default {
       if (index === -1) {
         let obj = {
           mark: item.mark,
-          value: select_item.trim().split(' '),
+          value: select_item.split(' '),
         };
         this.data.answer.answer_list.push(obj);
       } else {
-        this.data.answer.answer_list[index].value = select_item.trim().split(' ');
+        this.data.answer.answer_list[index].value = select_item.split(' ');
       }
       item.content_view = content_preview.trim().split(' ');
       // item.matically_pinyin = matically_pinyin.trim().split(' ').join(',');
@@ -312,6 +313,12 @@ export default {
         this.handleItemAnswer(item);
       });
     },
+    // 修改拼音
+    changePinyin(item) {
+      if (this.data.other.audio_generation_method === 'auto') {
+        item.audio_file_id = '';
+      }
+    },
   },
 };
 </script>

+ 7 - 1
src/views/exercise_questions/create/components/exercises/WordCardQuestion.vue

@@ -37,7 +37,7 @@
                   :placeholder="'输入汉字或词汇'"
                   @blur="handleChineseStrokes(item, i)"
                 />
-                <el-input v-model="item.pinyin" :placeholder="'拼音间用空格隔开'" />
+                <el-input v-model="item.pinyin" :placeholder="'拼音间用空格隔开'" @change="changePinyin(item)" />
                 <UploadAudio
                   v-if="data.other.audio_generation_method === 'upload'"
                   :key="item.audio_file_id || i"
@@ -342,6 +342,12 @@ export default {
     addSentence(item) {
       item.example_sentence.push('');
     },
+    // 修改拼音
+    changePinyin(item) {
+      if (this.data.other.audio_generation_method === 'auto') {
+        item.audio_file_id = '';
+      }
+    },
   },
 };
 </script>

+ 7 - 5
src/views/exercise_questions/preview/ChooseTonePreview.vue

@@ -115,7 +115,7 @@ export default {
         { value: '2', label: '二声', img: 'second-tone' },
         { value: '3', label: '三声', img: 'third-tone' },
         { value: '4', label: '四声', img: 'fourth-tone' },
-        { value: '0', label: '轻声', img: 'neutral-tone' },
+        // { value: '0', label: '轻声', img: 'neutral-tone' },
       ],
       con_preview: [],
       tone_data: [
@@ -198,13 +198,13 @@ export default {
         let con_arr = JSON.parse(JSON.stringify(item.content_view));
         let user_answer = [];
         let user_submit = []; // 用户提交答案
-        con_arr.forEach(() => {
+        con_arr.forEach((items) => {
           user_answer.push({
             select_tone: null,
             select_letter: '',
             select_index: '',
           });
-          user_submit.push('');
+          user_submit.push(this.data.property.answer_mode === 'label' ? items : '');
         });
         let obj = {
           item_con: con_arr,
@@ -255,7 +255,7 @@ export default {
               });
               if (this.data.property.answer_mode === 'label') {
                 let number_index = e.search(/0|1|2|3|4/) + 1;
-                arr[index] = str.trim() + e.substring(number_index);
+                arr[index] = str.trim() + (number_index === 0 ? '' : e.substring(number_index));
               } else {
                 arr[index] = str.trim();
               }
@@ -399,7 +399,9 @@ export default {
             } else {
               user_select[indexs] = items;
             }
-            user_answer[indexs].right_answer = this.data.answer.answer_list[index].value[indexs].match(/0|1|2|3|4/)[0];
+            user_answer[indexs].right_answer = this.data.answer.answer_list[index].value[indexs].match(/0|1|2|3|4/)
+              ? this.data.answer.answer_list[index].value[indexs].match(/0|1|2|3|4/)[0]
+              : '';
             user_answer[indexs].right_index = this.data.answer.answer_list[index].value[indexs].search(/0|1|2|3|4/) - 1;
           } else {
             this.handleReplaceTone(