|
@@ -0,0 +1,377 @@
|
|
|
+<template>
|
|
|
+ <div v-loading="loading" class="check-article">
|
|
|
+ <HeaderPage />
|
|
|
+ <div class="main">
|
|
|
+ <div class="main-top">
|
|
|
+ <div style="display: flex; align-items: end">
|
|
|
+ <a class="go-back" @click="$router.go(-1)">
|
|
|
+ <i class="el-icon-arrow-left"></i>
|
|
|
+ 返回
|
|
|
+ </a>
|
|
|
+ <b>校对词性</b>
|
|
|
+ <p class="tips">*为保证词性校对的准确性,请尽量在校对分词后校对词性。</p>
|
|
|
+ </div>
|
|
|
+ <div class="btn-box">
|
|
|
+ <!-- <el-switch
|
|
|
+ class="show-pos"
|
|
|
+ v-model="showPos"
|
|
|
+ active-text="显示词性"
|
|
|
+ inactive-text="">
|
|
|
+ </el-switch> -->
|
|
|
+ <el-button type="info" @click="$router.go(-1)">取消</el-button>
|
|
|
+ <el-button type="primary" @click="saveWord(id)">保存</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-if="showPos" class="pos-box">
|
|
|
+ <h4>词性解释</h4>
|
|
|
+ <ul>
|
|
|
+ <li v-for="(item,index) in cixingList" :key="index">
|
|
|
+ <label>{{item.code}}</label>
|
|
|
+ <span>{{item.name}}</span>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </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>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import HeaderPage from '@/components/Header.vue';
|
|
|
+import { publicMethods, reparse } from '@/api/api';
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ HeaderPage,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ id: '',
|
|
|
+ ArticelData: null,
|
|
|
+ showPos: true,
|
|
|
+ noPosContent: '',
|
|
|
+ hasPosContent: '',
|
|
|
+ posList: ['NR','NN','JJ','AD','PU','VV','CC','SP','FW','DEC','ETC','AS'],
|
|
|
+ cixingList: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created() {
|
|
|
+ this.routerData = JSON.parse(JSON.stringify(this.$route.query));
|
|
|
+ this.id = this.routerData.id
|
|
|
+ this.getArticleData()
|
|
|
+ this.getCixingList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取分析结果
|
|
|
+ getArticleData() {
|
|
|
+ this.loading = true;
|
|
|
+ let str = ''
|
|
|
+ let posStr = ''
|
|
|
+ publicMethods('/TeachingServer/TextAnalyser/GetParsedTextInfo',{
|
|
|
+ analyse_record_id: this.id,
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ let newdata = [];
|
|
|
+ res.parsed_text.paragraph_list.forEach((item) => {
|
|
|
+ if (item.length !== 0) {
|
|
|
+ newdata.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.ArticelData = JSON.parse(JSON.stringify(newdata));
|
|
|
+ newdata.forEach((item,index) => {
|
|
|
+ item.forEach((items,indexs) => {
|
|
|
+ items.forEach((itemss,indexss)=>{
|
|
|
+ let strWord = ''
|
|
|
+ itemss.text.forEach((itemT,indexT)=>{
|
|
|
+ strWord += itemT.word
|
|
|
+ })
|
|
|
+ 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.noPosContent = str
|
|
|
+ this.hasPosContent = posStr
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ saveWord(analyse_record_id){
|
|
|
+ let saveArr = []
|
|
|
+ let arr = this.showPos?this.hasPosContent.split('\n'):this.noPosContent.split('\n')
|
|
|
+ let indexP = 0 // 段落索引
|
|
|
+ let indexS = 0 // 句子索引
|
|
|
+ let flag = true
|
|
|
+ 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)=>{
|
|
|
+ // if(items.lastIndexOf('_')===-1||this.posList.indexOf(items.substring(items.lastIndexOf('_')+1).trim())==-1){
|
|
|
+ // flag = false
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ 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++
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // if(!flag){
|
|
|
+ // this.$message.warning('词性有错误请检查')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ this.loading = true;
|
|
|
+ publicMethods('/TeachingServer/TextAnalyser/SetFCProofreadForAnalyseRecord',{
|
|
|
+ analyse_record_id: this.id,
|
|
|
+ proofread_text: {
|
|
|
+ paragraph_list: saveArr
|
|
|
+ },
|
|
|
+ is_proofread_cx: "true"
|
|
|
+ })
|
|
|
+ .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;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取词性列表
|
|
|
+ getCixingList(){
|
|
|
+ this.cixingList = []
|
|
|
+ publicMethods('/TeachingServer/TextAnalyser/GetCixingList',{})
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ this.cixingList = res.cixing_list
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.check-article {
|
|
|
+ min-height: 100%;
|
|
|
+ background: #f6f6f6;
|
|
|
+
|
|
|
+ .wheader {
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+ .el-button{
|
|
|
+ padding: 5px 16px;
|
|
|
+ border-radius: 2px;
|
|
|
+ border: 1px solid #F2F3F5;
|
|
|
+ color: #4E5969;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 22px;
|
|
|
+ background: #F2F3F5;
|
|
|
+ &.el-button--primary{
|
|
|
+ background: #165DFF;
|
|
|
+ border: 1px solid #165DFF;
|
|
|
+ color: #FFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .main {
|
|
|
+ width: 1200px;
|
|
|
+ margin: 23px auto;
|
|
|
+ background: #FFF;
|
|
|
+ padding: 24px;
|
|
|
+ &-top{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 24px;
|
|
|
+ position: relative;
|
|
|
+ b{
|
|
|
+ color: #000;
|
|
|
+ font-size: 24px;
|
|
|
+ font-weight: 500;
|
|
|
+ line-height: 34px;
|
|
|
+ margin-left: 16px;
|
|
|
+ }
|
|
|
+ .tips{
|
|
|
+ color: #979797;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 20px;
|
|
|
+ margin-left: 12px;
|
|
|
+ }
|
|
|
+ .show-pos{
|
|
|
+ margin-right: 24px;
|
|
|
+ &.is-checked{
|
|
|
+ .el-switch__label.is-active{
|
|
|
+ color: rgba(13, 13, 13, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .go-back{
|
|
|
+ border-radius: 4px;
|
|
|
+ border: 1px solid #D9D9D9;
|
|
|
+ background: #FFF;
|
|
|
+ box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02);
|
|
|
+ display: flex;
|
|
|
+ width: 60px;
|
|
|
+ color: #333;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 22px;
|
|
|
+ padding: 5px 8px;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+ .el-icon-arrow-left{
|
|
|
+ font-size: 16px;
|
|
|
+ margin-right: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .pos-box{
|
|
|
+ margin-bottom: 16px;
|
|
|
+ border-radius: 4px;
|
|
|
+ background: #F7F7F7;
|
|
|
+ padding: 16px;
|
|
|
+ h4{
|
|
|
+ color: #000;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 600;
|
|
|
+ line-height: 22px;
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+ ul{
|
|
|
+ list-style: none;
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ display: flex;
|
|
|
+ flex-flow: wrap;
|
|
|
+ li{
|
|
|
+ margin: 8px 8px 0 0;
|
|
|
+ border-radius: 4px;
|
|
|
+ background: #FFF;
|
|
|
+ padding: 4px 16px;
|
|
|
+ label{
|
|
|
+ color: #007EFF;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 600;
|
|
|
+ line-height: 22px;
|
|
|
+ margin-right: 8px;
|
|
|
+ }
|
|
|
+ span{
|
|
|
+ color: #000;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 22px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.check-box{
|
|
|
+ padding: 24px;
|
|
|
+ border-radius: 4px;
|
|
|
+ background: #FFF;
|
|
|
+ box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
|
+ .content{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ .words-box{
|
|
|
+ text-align: center;
|
|
|
+ color: #000;
|
|
|
+ .words{
|
|
|
+ display: block;
|
|
|
+ font-size: 28px;
|
|
|
+ line-height: 40px;
|
|
|
+ font-weight: 400;
|
|
|
+ }
|
|
|
+ .pinyin{
|
|
|
+ font-family: 'League';
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 1;
|
|
|
+ height: 20px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .checkPinyinInput{
|
|
|
+ margin: 16px 0 8px 0;
|
|
|
+ }
|
|
|
+ .tips{
|
|
|
+ color: #A0A0A0;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 18px;
|
|
|
+ margin: 0 0 24px 0;
|
|
|
+ }
|
|
|
+ .btn-box{
|
|
|
+ text-align: right;
|
|
|
+ .el-button{
|
|
|
+ font-size: 12px;
|
|
|
+ padding: 2px 12px;
|
|
|
+ line-height: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="scss">
|
|
|
+.check-article{
|
|
|
+ .show-pos{
|
|
|
+ .el-switch__label.is-active{
|
|
|
+ color: rgba(13, 13, 13, 1);
|
|
|
+ }
|
|
|
+ &.el-switch.is-checked .el-switch__core{
|
|
|
+ border-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>
|
|
|
+
|