|
@@ -0,0 +1,348 @@
|
|
|
+<template>
|
|
|
+ <div v-loading="loading" class="check-article">
|
|
|
+ <div class="wheader">
|
|
|
+ <HeaderPage />
|
|
|
+ </div>
|
|
|
+ <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="savePinyin(id)">保存</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-if="showPos" class="pos-box">
|
|
|
+ <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>
|
|
|
+ </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>
|
|
|
+ </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,
|
|
|
+ indexArr: [], // 索引数组
|
|
|
+ showPos: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ created() {
|
|
|
+ this.routerData = JSON.parse(JSON.stringify(this.$route.query));
|
|
|
+ this.id = this.routerData.id
|
|
|
+ this.getArticleData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取分析结果
|
|
|
+ getArticleData() {
|
|
|
+ this.loading = true;
|
|
|
+ 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));
|
|
|
+ let saveArr = []
|
|
|
+ let arr = []
|
|
|
+ let saveIndex = 0
|
|
|
+ // 添加索引
|
|
|
+ newdata.forEach((item,index) => {
|
|
|
+ arr.push([])
|
|
|
+ item.forEach((items,indexs) => {
|
|
|
+ items.forEach((itemss,indexss)=>{
|
|
|
+ let str = ''
|
|
|
+ let pinyinStr = ''
|
|
|
+ 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),
|
|
|
+ // pinyin_lt: itemss.pinyin_lt?itemss.pinyin_lt:''
|
|
|
+ }
|
|
|
+ saveArr.push(saveObj)
|
|
|
+ saveIndex++
|
|
|
+ })
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.indexArr = arr
|
|
|
+ this.ArticelData = saveArr
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ savePinyin(analyse_record_id){
|
|
|
+ this.loading = true;
|
|
|
+ reparse({ analyse_record_id })
|
|
|
+ .then(({ record }) => {
|
|
|
+ this.getArticleData()
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
+</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 0 8px 0;
|
|
|
+ }
|
|
|
+ p{
|
|
|
+ color: #000;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 22px;
|
|
|
+ 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{
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+</style>
|
|
|
+
|