Jelajahi Sumber

语料库词典修改问题

natasha 1 tahun lalu
induk
melakukan
ea976753fe
2 mengubah file dengan 55 tambahan dan 41 penghapusan
  1. 1 1
      src/components/Header.vue
  2. 54 40
      src/views/corpus/Result.vue

+ 1 - 1
src/components/Header.vue

@@ -423,7 +423,7 @@ export default {
   position: sticky;
   top: 0;
   left: 0;
-  z-index: 999;
+  z-index: 999999;
   box-sizing: border-box;
   display: flex;
   align-items: center;

+ 54 - 40
src/views/corpus/Result.vue

@@ -192,7 +192,7 @@
               </template>
             </div>
             <div class="page">
-              <span class="text"> 共 {{ CurrentList.length }} 条 命中 {{ scoreAHitNumber }} </span>
+              <span class="text"> 共 {{ CurrentList.length }} 条 {{patternIndex == 0?' 命中 '+scoreAHitNumber+' 次':''}} </span>
               <el-pagination
                 background
                 @current-change="handleCurrentChange"
@@ -209,7 +209,7 @@
         <div class="right">
           <div class="top">
             <div>
-              <div :class="[rightTopIndex == 0 ? 'sele' : '']" @click="cutsyly(0)">释义</div>
+              <div v-if="allList.stat_list_word_definition&&allList.stat_list_word_definition.length>0" :class="[rightTopIndex == 0 ? 'sele' : '']" @click="cutsyly(0)">释义</div>
               <div :class="[rightTopIndex == 1 ? 'sele' : '']" @click="cutsyly(1)">来源</div>
             </div>
           </div>
@@ -319,8 +319,9 @@ export default {
     KWICsortEvent(index, type) {
       if (this.KWIC_sortIndex == index) return;
       this.KWIC_sortIndex = index;
-      this.CurrentList = this.allList[type];
-      this.padingEvetn();
+    //   this.CurrentList = this.allList[type];
+    //   this.padingEvetn();
+      this.getdata();
     },
     // 排序
     sortEvent() {
@@ -367,12 +368,13 @@ export default {
         return;
       }
       this.patternIndex = index;
-      if (this.patternIndex == 0) {
-        this.CurrentList = JSON.parse(JSON.stringify(this.allList.sentence_list));
-      } else {
-        this.CurrentList = JSON.parse(JSON.stringify(this.allList.sentence_list_sort_left));
-      }
-      this.padingEvetn();
+      this.getdata()
+    //   if (this.patternIndex == 0) {
+    //     this.CurrentList = JSON.parse(JSON.stringify(this.allList.sentence_list));
+    //   } else {
+    //     this.CurrentList = JSON.parse(JSON.stringify(this.allList.sentence_list_sort_left));
+    //   }
+    //   this.padingEvetn();
       this.page = 1;
     },
     // 切换释义来源
@@ -386,9 +388,9 @@ export default {
       } else {
         this.rightList = this.allList.stat_list_sentence_source_book;
       }
-      if (this.rightList.length > 0) {
+    //   if (this.rightList.length > 0) {
         this.inityuan();
-      }
+    //   }
     },
     updownHz() {
       this.unfold = !this.unfold;
@@ -464,7 +466,7 @@ export default {
             name: 'Access From',
             type: 'pie',
             // radius: ["50%", "50%"],
-            data: newdata,
+            data: newdata.length>0?newdata:[],
             itemStyle: {
               //   borderColor: "#fff",
               //   borderWidth: 2,
@@ -546,7 +548,7 @@ export default {
     getdata(flag) {
       this.loading = true;
       this.scoreAHitNumber = 0
-      let Mname = 'book-courseware_manager-GetCoursewareWordExampleSentenceList';
+      let Mname = 'book-courseware_manager-GetCoursewareWordExampleSentenceList_Sort';
       let data = {
         // courseware_id: "003-20211012-17-BDUZ1JVCAN",
         courseware_id: '',
@@ -556,7 +558,11 @@ export default {
         // 本章:同一本教材下,归属同一个第一级章节下的所有课件为同一章。
         is_contain_word_variants: false, // 是否包含单词变体例句
         is_contain_stat_data: true, //
-        sentence_length_sort_mode: this.sort ? (this.sort == 'down' ? 'DESCENT' : 'ASCENT') : 'NO'
+        is_filter_repetitive_sentence: 'true',
+        sort_mode: this.sort ? (this.sort == 'down' ? 'DESCENT' : 'ASCENT') : 'NO',
+        compare_mode: this.patternIndex === 0 ? 'LENGTH' : 'KWIC',
+        kwic_arrange_type: this.KWIC_sortIndex === 0 ? 'LEFT' : this.KWIC_sortIndex === 1 ? 'MID' : 'RIGHT',
+        kwic_compare_by: 0
       };
       BookgetContent(Mname, data)
         .then(res => {
@@ -571,18 +577,33 @@ export default {
 
           if (res.sentence_list.length > 0) {
             res.stat_list_word_definition.forEach(item => {
-              item.book_name = item.definition;
+              item.book_name = item.definition.replace(/<i>/g, "").replace(/<\/i>/g, "");
             });
             // 清理脏数据
-            this.removeRubbishData(res);
-            this.rightList = res.stat_list_word_definition;
+            if(this.patternIndex === 1){
+                this.removeRubbishData(res);
+            }
+            if(res.stat_list_word_definition.length===0){
+                this.rightTopIndex = 1
+            }
+            if(this.rightTopIndex === 0){
+                this.rightList = res.stat_list_word_definition;
+            }else{
+                this.rightList = res.stat_list_sentence_source_book;
+            }
             this.getrightListdata();
-            this.allList.sentence_list = this.handleExample(res.sentence_list);
-            this.allList.sentence_list_sort_left = this.handleExample(res.sentence_list_sort_left, 'left');
-            this.allList.sentence_list_sort_mid = this.handleExample(res.sentence_list_sort_mid, 'mid');
-            this.allList.sentence_list_sort_right = this.handleExample(res.sentence_list_sort_right, 'right');
-
-            this.CurrentList = JSON.parse(JSON.stringify(this.allList.sentence_list));
+            if(this.patternIndex === 0){
+                this.allList.sentence_list = this.handleExample(res.sentence_list);
+            }else{
+                if(this.KWIC_sortIndex === 0){
+                    this.allList.sentence_list_sort_left = this.handleExample(res.sentence_list, 'left');
+                }else if(this.KWIC_sortIndex === 1){
+                    this.allList.sentence_list_sort_mid = this.handleExample(res.sentence_list, 'mid');
+                }else{
+                    this.allList.sentence_list_sort_right = this.handleExample(res.sentence_list, 'right');
+                }
+            }
+            this.CurrentList = JSON.parse(JSON.stringify(res.sentence_list));
             this.padingEvetn();
           } else {
             this.CurrentList = [];
@@ -722,21 +743,13 @@ export default {
     },
     // 删除脏数据
     removeRubbishData(data) {
-      for (let i = data.sentence_list_sort_left.length - 1; i--; ) {
-        if (data.sentence_list_sort_left[i].sentence_fc_list.length <= 1) {
-          data.sentence_list_sort_left.splice(i, 1);
-        }
-      }
-      for (let i = data.sentence_list_sort_mid.length - 1; i--; ) {
-        if (data.sentence_list_sort_mid[i].sentence_fc_list.length <= 1) {
-          data.sentence_list_sort_mid.splice(i, 1);
-        }
-      }
-      for (let i = data.sentence_list_sort_right.length - 1; i--; ) {
-        if (data.sentence_list_sort_right[i].sentence_fc_list.length <= 1) {
-          data.sentence_list_sort_right.splice(i, 1);
+      if(data.sentence_list.length>0){
+        for (let i = data.sentence_list.length - 1; i--; ) {
+            if (data.sentence_list[i].sentence_fc_list.length <= 1) {
+                data.sentence_list.splice(i, 1);
+            }
         }
-      }
+      }      
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -1169,7 +1182,7 @@ export default {
                 font-weight: 400;
                 line-height: 24px;
                 color: #48a3e6;
-
+                font-family: 'robot', 'FZJCGFKTK';
                 &-0 {
                   line-height: 32px;
                 }
@@ -1289,7 +1302,8 @@ export default {
           display: flex;
           align-items: center;
           justify-content: center;
-          width: 84px;
+        //   width: 84px;
+          padding: 0 2px;
           height: 28px;
           margin-left: 16px;
           background: #eee;