CheckArticle.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div v-loading="loading" class="check-article">
  3. <HeaderPage />
  4. <div class="main">
  5. <div class="main-top">
  6. <a class="go-back" @click="$router.go(-1)">
  7. <i class="el-icon-arrow-left"></i>
  8. 返回
  9. </a>
  10. <b>校对</b>
  11. <div class="btn-box">
  12. <el-button @click="checkPinyin">校对拼音</el-button>
  13. <el-button type="primary" @click="checkWord">校对分词</el-button>
  14. </div>
  15. </div>
  16. <div class="paragraph" v-for="(item, index) in indexArr" :key="index + 'paragraph'" >
  17. <label>段 {{index+1}}</label>
  18. <div class="sentence-box" v-for="(items, indexs) in item" :key="indexs + 'words'">
  19. <div class="sentence" v-for="(itemss, indexss) in items" :key="indexss + 'words'">
  20. <b>{{itemss.index}}.</b>
  21. <div class="sentence" v-html="itemss.text">
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import HeaderPage from '@/components/Header.vue';
  31. import { publicMethods } from '@/api/api';
  32. export default {
  33. components: {
  34. HeaderPage,
  35. },
  36. data() {
  37. return {
  38. loading: false,
  39. id: '',
  40. ArticelData: null,
  41. indexArr: [], // 索引数组
  42. };
  43. },
  44. // 生命周期 - 创建完成(可以访问当前this实例)
  45. created() {
  46. this.routerData = JSON.parse(JSON.stringify(this.$route.query));
  47. this.id = this.routerData.id
  48. this.getArticleData()
  49. },
  50. methods: {
  51. // 获取分析结果
  52. getArticleData() {
  53. this.loading = true;
  54. publicMethods('/TeachingServer/TextAnalyser/GetParsedTextInfo',{
  55. analyse_record_id: this.id,
  56. }
  57. )
  58. .then((res) => {
  59. if(res.status===1){
  60. let newdata = [];
  61. res.parsed_text.paragraph_list.forEach((item) => {
  62. if (item.length !== 0) {
  63. newdata.push(item);
  64. }
  65. });
  66. this.ArticelData = newdata;
  67. let arr = []
  68. let indexS = 0;
  69. // 添加索引
  70. this.ArticelData.forEach((item,index) => {
  71. arr.push([])
  72. item.forEach((items,indexs) => {
  73. arr[index].push([])
  74. indexS += 1;
  75. let str = ''
  76. items.forEach((itemss,indexss)=>{
  77. itemss.text.forEach(itemT=>{
  78. str += itemT.word
  79. })
  80. if(indexss!==items.length-1) str+='&nbsp;&nbsp;'
  81. })
  82. let obj = {
  83. text: str,
  84. index: JSON.parse(JSON.stringify(indexS))
  85. }
  86. arr[index][indexs].push(obj)
  87. });
  88. });
  89. this.indexArr = arr
  90. this.loading = false;
  91. }
  92. })
  93. .catch(() => {
  94. this.loading = false;
  95. });
  96. },
  97. // 校对拼音
  98. checkPinyin(){
  99. this.$router.push({
  100. path: "/textanalysis/checkPinyin",
  101. query: {
  102. id: this.id
  103. },
  104. });
  105. },
  106. // 校对分词
  107. checkWord(){
  108. this.$router.push({
  109. path: "/textanalysis/checkWord",
  110. query: {
  111. id: this.id
  112. },
  113. });
  114. }
  115. },
  116. };
  117. </script>
  118. <style lang="scss" scoped>
  119. .check-article {
  120. min-height: 100%;
  121. background: #f6f6f6;
  122. .wheader {
  123. background: #fff;
  124. }
  125. .main {
  126. width: 1200px;
  127. margin: 23px auto;
  128. background: #FFF;
  129. padding: 24px;
  130. &-top{
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. margin-bottom: 24px;
  135. position: relative;
  136. b{
  137. color: #000;
  138. font-size: 24px;
  139. font-weight: 500;
  140. line-height: 34px;
  141. position: absolute;
  142. width: 600px;
  143. text-align: center;
  144. top: 0;
  145. left: 50%;
  146. margin-left: -300px;
  147. }
  148. .el-button{
  149. padding: 5px 16px;
  150. border-radius: 2px;
  151. border: 1px solid #165DFF;
  152. color: #165DFF;
  153. font-size: 14px;
  154. font-weight: 400;
  155. line-height: 22px;
  156. &.el-button--primary{
  157. background: #165DFF;
  158. color: #FFF;
  159. }
  160. }
  161. }
  162. .go-back{
  163. border-radius: 4px;
  164. border: 1px solid #D9D9D9;
  165. background: #FFF;
  166. box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02);
  167. display: flex;
  168. width: 60px;
  169. color: #333;
  170. font-size: 14px;
  171. font-weight: 400;
  172. line-height: 22px;
  173. padding: 5px 8px;
  174. align-items: center;
  175. cursor: pointer;
  176. .el-icon-arrow-left{
  177. font-size: 16px;
  178. margin-right: 8px;
  179. }
  180. }
  181. .paragraph{
  182. margin-bottom: 8px;
  183. text-align: center;
  184. >label{
  185. border-radius: 2px;
  186. border: 1px solid #175DFF;
  187. background: #E7EEFF;
  188. padding: 1px 8px;
  189. color: var(--blue-05, #175DFF);
  190. font-size: 14px;
  191. font-weight: 400;
  192. line-height: 22px;
  193. }
  194. .sentence-box{
  195. .sentence{
  196. display: flex;
  197. margin-top: 8px;
  198. b{
  199. width: 32px;
  200. line-height: 24px;
  201. flex-shrink: 0;
  202. color: #000;
  203. font-size: 16px;
  204. font-weight: 400;
  205. margin-top: 16px;
  206. }
  207. .sentence{
  208. flex: 1;
  209. padding: 8px;
  210. background: #F7F7F7;
  211. color: #000;
  212. font-size: 16px;
  213. font-weight: 400;
  214. line-height: 24px;
  215. text-align: left;
  216. }
  217. }
  218. }
  219. }
  220. }
  221. }
  222. </style>