natasha 1 年間 前
コミット
dafbf347e2

+ 2 - 4
src/views/Textanalysis/CheckArticle.vue

@@ -1,8 +1,6 @@
 <template>
 <template>
   <div v-loading="loading" class="check-article">
   <div v-loading="loading" class="check-article">
-    <div class="wheader">
-      <HeaderPage />
-    </div>
+    <HeaderPage />
     <div class="main">
     <div class="main">
       <div class="main-top">
       <div class="main-top">
         <a class="go-back" @click="$router.go(-1)">
         <a class="go-back" @click="$router.go(-1)">
@@ -12,7 +10,7 @@
         <b>校对</b>
         <b>校对</b>
         <div class="btn-box">
         <div class="btn-box">
             <el-button @click="checkPinyin">校对拼音</el-button>
             <el-button @click="checkPinyin">校对拼音</el-button>
-            <!-- <el-button type="primary" @click="checkWord">校对分词</el-button> -->
+            <el-button type="primary" @click="checkWord">校对分词</el-button>
         </div>
         </div>
       </div>
       </div>
       <div class="paragraph" v-for="(item, index) in indexArr" :key="index + 'paragraph'" >
       <div class="paragraph" v-for="(item, index) in indexArr" :key="index + 'paragraph'" >

+ 1 - 3
src/views/Textanalysis/CheckPinyin.vue

@@ -1,8 +1,6 @@
 <template>
 <template>
   <div v-loading="loading" class="check-article">
   <div v-loading="loading" class="check-article">
-    <div class="wheader">
-      <HeaderPage />
-    </div>
+    <HeaderPage />
     <div class="main">
     <div class="main">
       <div class="main-top">
       <div class="main-top">
         <div style="display: flex">
         <div style="display: flex">

+ 78 - 98
src/views/Textanalysis/CheckWord.vue

@@ -1,8 +1,6 @@
 <template>
 <template>
   <div v-loading="loading" class="check-article">
   <div v-loading="loading" class="check-article">
-    <div class="wheader">
-      <HeaderPage />
-    </div>
+    <HeaderPage />
     <div class="main">
     <div class="main">
       <div class="main-top">
       <div class="main-top">
         <div style="display: flex; align-items: end">
         <div style="display: flex; align-items: end">
@@ -21,25 +19,15 @@
                 inactive-text="">
                 inactive-text="">
             </el-switch>
             </el-switch>
             <el-button type="info" @click="$router.go(-1)">取消</el-button>
             <el-button type="info" @click="$router.go(-1)">取消</el-button>
-            <el-button type="primary" @click="savePinyin(id)">保存</el-button>
+            <el-button type="primary" @click="saveWord(id)">保存</el-button>
         </div>
         </div>
       </div>
       </div>
       <div v-if="showPos" class="pos-box">
       <div v-if="showPos" class="pos-box">
         <h4>词性解释</h4>
         <h4>词性解释</h4>
         <p>n/名词 np/人名 ns/地名 ni/机构名 nz/其它专名 m/数词 q/量词 mq/数量词 t/时间词 f/方位词 s/处所词 v/动词 vm/能愿动词 vd/趋向动词 a/形容词 d/副词 h/前接成分 k/后接成分 i/习语 j/简称 r/代词 c/连词 p/介词 u/助词 y/语气助词 e/叹词 o/拟声词 g/语素 w/标点 x/其它</p>
         <p>n/名词 np/人名 ns/地名 ni/机构名 nz/其它专名 m/数词 q/量词 mq/数量词 t/时间词 f/方位词 s/处所词 v/动词 vm/能愿动词 vd/趋向动词 a/形容词 d/副词 h/前接成分 k/后接成分 i/习语 j/简称 r/代词 c/连词 p/介词 u/助词 y/语气助词 e/叹词 o/拟声词 g/语素 w/标点 x/其它</p>
       </div>
       </div>
-      <div class="article">
-        <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" :style="{marginRight:items.marginRight?'8px':''}">
-                    <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>
-                </div>
-            </div>
-        </div>
-      </div>
+      <el-input v-if="showPos" class="no-pos-content" v-model="hasPosContent" type="textarea" :autosize="{ minRows: 27 }" />
+      <el-input v-else class="no-pos-content" v-model="noPosContent" type="textarea" :autosize="{ minRows: 27 }" />
     </div>
     </div>
   </div>
   </div>
 </template>
 </template>
@@ -57,8 +45,9 @@ export default {
       loading: false,
       loading: false,
       id: '',
       id: '',
       ArticelData: null,
       ArticelData: null,
-      indexArr: [], // 索引数组
-      showPos: false
+      showPos: false,
+      noPosContent: '',
+      hasPosContent: ''
     };
     };
   },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -71,6 +60,8 @@ export default {
     // 获取分析结果
     // 获取分析结果
     getArticleData() {
     getArticleData() {
       this.loading = true;
       this.loading = true;
+      let str = ''
+      let posStr = ''
       publicMethods('/TeachingServer/TextAnalyser/GetParsedTextInfo',{
       publicMethods('/TeachingServer/TextAnalyser/GetParsedTextInfo',{
           analyse_record_id: this.id,
           analyse_record_id: this.id,
         }
         }
@@ -83,65 +74,85 @@ export default {
                         newdata.push(item);
                         newdata.push(item);
                     }
                     }
                 });
                 });
-                // this.ArticelData = JSON.parse(JSON.stringify(newdata));
-                let saveArr = []
-                let arr = []
-                let saveIndex = 0
-                // 添加索引
+                this.ArticelData = JSON.parse(JSON.stringify(newdata));
                 newdata.forEach((item,index) => {
                 newdata.forEach((item,index) => {
-                    arr.push([])
                     item.forEach((items,indexs) => {
                     item.forEach((items,indexs) => {
                         items.forEach((itemss,indexss)=>{
                         items.forEach((itemss,indexss)=>{
-                            let str = ''
-                            let pinyinStr = ''
-                            let pinyinNo = ''
+                            let strWord = ''
                             itemss.text.forEach((itemT,indexT)=>{
                             itemss.text.forEach((itemT,indexT)=>{
-                                str += itemT.word
-                                pinyinStr += itemT.pinyin + ','
-                                pinyinNo += itemT.pinyin
+                               strWord += itemT.word
                             })
                             })
-                            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),
-                                // pinyin_lt: itemss.pinyin_lt?itemss.pinyin_lt:''
-                            }
-                            saveArr.push(saveObj)
-                            saveIndex++
+                            str += strWord + (indexss!==items.length-1?'  ':'')
+                            posStr += strWord +(itemss.pos?'_'+itemss.pos:'') + (indexss!==items.length-1?'  ':'')
                         })
                         })
-                        
+                        str += '\n'
+                        posStr += '\n'
                     });
                     });
+                    if(index!==newdata.length-1){
+                        str += '\n'
+                        posStr += '\n'
+                    }
                 });
                 });
-                this.indexArr = arr
-                this.ArticelData = saveArr
+                this.noPosContent = str
+                this.hasPosContent = posStr
                 this.loading = false;
                 this.loading = false;
             }
             }
-          
         })
         })
         .catch(() => {
         .catch(() => {
           this.loading = false;
           this.loading = false;
         });
         });
     },
     },
-    savePinyin(analyse_record_id){
+    saveWord(analyse_record_id){
+      let saveArr = []
+      let arr = this.showPos?this.hasPosContent.split('\n'):this.noPosContent.split('\n')
+      let indexP = 0 // 段落索引
+      let indexS = 0 // 句子索引
+      arr.forEach(item=>{
+        if(item===''){
+            saveArr.push([])
+        }
+      })
+      arr.forEach((item,index)=>{
+        if(item===''){
+            indexP++
+            indexS = 0
+        }else{
+            let arrs = item.trim().split('  ')
+            let saveItem = []
+            arrs.forEach((items,indexs)=>{
+                let obj = {
+                    word: items.lastIndexOf('_')>-1?items.substring(0,items.lastIndexOf('_')).trim():items,
+                    pos: this.showPos?items.lastIndexOf('_')>-1?items.substring(items.lastIndexOf('_')+1).trim():'':this.ArticelData[indexP]&&this.ArticelData[indexP][indexS]&&this.ArticelData[indexP][indexS][indexs]&&this.ArticelData[indexP][indexS][indexs].pos?this.ArticelData[indexP][indexS][indexs].pos:''
+                }
+                saveItem.push(obj)
+            })
+            saveArr[indexP].push(saveItem)
+            indexS++
+        }
+      })
       this.loading = true;
       this.loading = true;
-      reparse({ analyse_record_id })
-        .then(({ record }) => {
-          this.getArticleData()
+      publicMethods('/TeachingServer/TextAnalyser/SetFCProofreadForAnalyseRecord',{
+            analyse_record_id: this.id,
+            proofread_text: {
+                paragraph_list: saveArr
+            }
         })
         })
-        .finally(() => {
-          this.loading = false;
-        });
+            .then((res) => {
+                if(res.status===1){
+                    this.$message.success('保存成功')
+                    reparse({ analyse_record_id })
+                        .then(({ record }) => {
+                            this.getArticleData()
+                        })
+                        .finally(() => {
+                            this.loading = false;
+                        });
+                }
+            })
+            .catch(() => {
+                this.loading = false;
+            });
+    
     }
     }
   },
   },
 };
 };
@@ -243,44 +254,6 @@ export default {
             margin: 0;
             margin: 0;
         }
         }
     }
     }
-    .article{
-        border-radius: 2px;
-        border: 1px solid rgba(0, 0, 0, 0.08);
-        background: #FCFCFC;
-        padding: 8px;
-    }
-    .paragraph{
-        margin-bottom: 24px;
-        text-align: center;
-        display: flex;
-        flex-flow: wrap;
-        width: 100%;
-        .sentence-box{
-            display: flex;
-            flex-flow: wrap;
-            float: left;
-            .sentence{
-                margin-top: 8px;
-                text-align: center;
-                cursor: pointer;
-                color: #000;
-                .words{
-                    display: block;
-                    font-size: 20px;
-                    line-height: 28px;
-                    font-weight: 400;
-                }
-                .pinyin{
-                    font-family: 'League';
-                    font-size: 14px;
-                    font-weight: 400;
-                    line-height: 1;
-                    height: 14px;
-                    display: block;
-                }
-            }
-        }
-    }
   }
   }
 }
 }
 .check-box{
 .check-box{
@@ -342,6 +315,13 @@ export default {
             background-color: #165DFF;
             background-color: #165DFF;
         }
         }
     }
     }
+    .no-pos-content{
+        .el-textarea__inner{
+            font-family: Helvetica, 'FZJCGFKTK';
+            font-size: 16px;
+            color: rgba(0, 0, 0, 0.88);
+        }
+    }
 }
 }
 
 
 </style>
 </style>

+ 2 - 2
src/views/Textanalysis/index.vue

@@ -1,8 +1,8 @@
 <template>
 <template>
   <div v-loading="loading" class="textanalysis_index">
   <div v-loading="loading" class="textanalysis_index">
-    <div class="wheader">
+    <!-- <div class="wheader"> -->
       <HeaderPage />
       <HeaderPage />
-    </div>
+    <!-- </div> -->
     <div class="main">
     <div class="main">
       <div>
       <div>
         <div v-loading="LeftLoading" class="left">
         <div v-loading="LeftLoading" class="left">