瀏覽代碼

校对拼音

natasha 1 年之前
父節點
當前提交
5ad5e8aeb3
共有 1 個文件被更改,包括 25 次插入39 次删除
  1. 25 39
      src/views/Textanalysis/CheckPinyin.vue

+ 25 - 39
src/views/Textanalysis/CheckPinyin.vue

@@ -21,7 +21,7 @@
         <div class="paragraph" v-for="(item, index) in indexArr" :key="index + 'paragraph'" >
             <div class="sentence-box" v-for="(items, indexs) in item" :key="indexs + 'words'">
                 <div class="sentence" @click="selectItem(items,index)" :style="{marginRight:items.marginRight?'8px':'',color: activeIndex === index+'_'+items.sentenceIndex+'_'+items.wordIndex?'#F2555A':''}">
-                    <span class="pinyin">{{items.pinyin}}</span>
+                    <span class="pinyin">{{items.pinyin_lt?items.pinyin_lt:items.pinyin}}</span>
                     <span class="words" :class="[/^[0-9]*$/.test(items.text)]?/^[\u4e00-\u9fa5]/.test(items.text)?'hanzi':'en':''">
                         {{items.text}}
                     </span>
@@ -52,12 +52,12 @@
                     </div>
                 </template>
                 <template v-else>
-                    <div v-for="(item,index) in itemActive.wordArr" :key="index" class="words-box">
+                    <div class="words-box">
                         <span class="pinyin">
-                            {{item.pinyin}}
+                            {{itemActive.pinyin}}
                         </span>
                         <span class="words">
-                            {{item.word}}
+                            {{itemActive.text}}
                         </span>
                     </div>
                 </template>
@@ -143,41 +143,24 @@ export default {
                         items.forEach((itemss,indexss)=>{
                             let str = ''
                             let pinyinStr = ''
-                            if(itemss.pinyin_lt){
-                                itemss.text.forEach((itemT,indexT)=>{
-                                    str += itemT.word
-                                    pinyinStr += itemT.pinyin + ','
-                                })
-                                let obj = {
-                                    text: str,
-                                    pinyin: itemss.pinyin_lt,
-                                    paraIndex: index,
-                                    sentenceIndex: indexs,
-                                    wordIndex: indexss,
-                                    wordArr: itemss.text,
-                                    marginRight: true,
-                                    saveIndex: saveIndex,
-                                    pinyin_lt: itemss.pinyin_lt
-                                }
-                                arr[index].push(obj)
-                            }else{
-                                itemss.text.forEach((itemT,indexT)=>{
-                                    str += itemT.word
-                                    pinyinStr += itemT.pinyin + ','
-                                    let obj = {
-                                        text: itemT.word,
-                                        pinyin: itemT.pinyin,
-                                        paraIndex: index,
-                                        sentenceIndex: indexs,
-                                        wordIndex: indexss,
-                                        wordArr: itemss.text,
-                                        marginRight: indexT===itemss.text.length-1,
-                                        saveIndex: saveIndex
-                                    }
-                                    arr[index].push(obj)
-                                })
+                            let pinyinNo = ''
+                            itemss.text.forEach((itemT,indexT)=>{
+                                str += itemT.word
+                                pinyinStr += itemT.pinyin + ','
+                                pinyinNo += itemT.pinyin
+                            })
+                            let obj = {
+                                text: str,
+                                pinyin: pinyinNo,
+                                paraIndex: index,
+                                sentenceIndex: indexs,
+                                wordIndex: indexss,
+                                wordArr: itemss.text,
+                                marginRight: true,
+                                saveIndex: saveIndex,
+                                pinyin_lt: itemss.pinyin_lt
                             }
-                            
+                            arr[index].push(obj)
                             let saveObj = {
                                 word: str,
                                 pinyin: pinyinStr.substring(0,pinyinStr.length-1),
@@ -256,11 +239,14 @@ export default {
             this.checkPinyinInput = str.trim();
             if(this.oldInput.indexOf('_')>-1){
                 this.ArticelData[this.itemActive.saveIndex].pinyin = this.checkPinyinInput.replace(/\s+/g, " ").split(/\s+/).join('_')
-                this.checkPinyinInput = this.checkPinyinInput.replace(/\s+/g, " ").split(/\s+/).join('_').replace('_e','')
+                this.checkPinyinInput = this.checkPinyinInput.replace(/\s+/g, " ").split(/\s+/).join('_').replace('_e','').replace('_ē','').replace('_é','').replace('_ě','').replace('_è','')
+                this.itemActive.pinyin_lt = this.checkPinyinInput.replace(/\s+/g, "")
             }else{
                 this.ArticelData[this.itemActive.saveIndex].pinyin = this.checkPinyinInput.replace(/\s+/g, " ").split(/\s+/).join(',')
+                this.itemActive.pinyin = this.checkPinyinInput.replace(/\s+/g, "")
             }
             // this.ArticelData[this.itemActive.saveIndex].pinyin = this.checkPinyinInput
+            
             this.loading = true;
             publicMethods('/TeachingServer/TextAnalyser/AddMyPinyinProofread',{
                 analyse_record_id: this.id,