瀏覽代碼

标注声调录入修改

natasha 1 年之前
父節點
當前提交
65fbf7c288
共有 1 個文件被更改,包括 19 次插入2 次删除
  1. 19 2
      src/views/exercise_questions/create/components/exercises/ChooseToneQuestion.vue

+ 19 - 2
src/views/exercise_questions/create/components/exercises/ChooseToneQuestion.vue

@@ -355,12 +355,29 @@ export default {
             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}${index === content_arr.length - 1 ? '' : ' '}`;
+            // select_item += `${items_trim}${index === content_arr.length - 1 ? '' : ' '}`;
           }
-          content_preview += `${items_yuan} `;
+          content_preview += `${items_yuan}${index === content_arr.length - 1 ? '' : ' '}`;
           this.handleReplaceTone(items_yuan + items_trim.substring(indexs, indexs + 1), item.mark, itemIndex);
         }
       });
+      if (this.data.property.answer_mode === 'label') {
+        content_preview.split(' ').forEach((items, index) => {
+          let items_trim = items.trim();
+          if (items_trim) {
+            let indexs = content_arr[index].search(/0|1|2|3|4/);
+            let items_tone = this.matically_pinyin_str[item.mark].split(' ')[index].split('');
+            for (let i = 0; i < items_trim.length; i++) {
+              if (items_trim[i] === items_tone[i]) {
+                select_item += `${items_trim[i]}`;
+              } else {
+                select_item += `${items_trim[i]}${content_arr[index].substring(indexs, indexs + 1)}`;
+              }
+            }
+            select_item += `${index === content_preview.split(' ').length - 1 ? '' : ' '}`;
+          }
+        });
+      }
       if (itemIndex === -1) {
         let obj = {
           mark: item.mark,