Bläddra i källkod

存储句长信息

natasha 1 år sedan
förälder
incheckning
a281464132
3 ändrade filer med 61 tillägg och 36 borttagningar
  1. 32 19
      src/components/Header.vue
  2. 24 14
      src/views/corpus/Result.vue
  3. 5 3
      src/views/corpus/seekPage.vue

+ 32 - 19
src/components/Header.vue

@@ -27,7 +27,7 @@
         </div>
       </template>
       <el-popover v-if="seekOptions" v-model="visibleOption" placement="bottom" width="335" trigger="click">
-        <div class="set_corpus_dv">
+        <!-- <div class="set_corpus_dv">
           <span>选择难度</span>
           <el-select v-model="corpus.difficlty" style="width: 205px" placeholder="请选择">
             <el-option
@@ -37,13 +37,13 @@
               :value="itemD.value"
             />
           </el-select>
-        </div>
-        <div class="set_corpus_dv">
+        </div> -->
+        <!-- <div class="set_corpus_dv">
           <span>选择范围</span>
           <el-select v-model="corpus.scope" style="width: 205px" placeholder="请选择">
             <el-option v-for="(itemD, indexD) in scopeList" :key="indexD" :label="itemD.label" :value="itemD.value" />
           </el-select>
-        </div>
+        </div> -->
         <div class="set_corpus_dv">
           <span>句子长度</span>
           <el-input
@@ -55,14 +55,15 @@
           ——
           <el-input
             v-model="corpus.sentenceEnd"
-            style="width: 55px; margin-left: 8px"
+            style="width: 55px; margin: 0 8px"
             onkeyup="value=value.replace(/^0+(\d)|[^\d]+/g,'')"
             class="numbre-input"
           />
+          词
         </div>
         <div class="set_corpus_submit">
           <div @click="visibleOption = false">取消</div>
-          <div @click="visibleOption = false">确认</div>
+          <div @click="sureCorpus">确认</div>
         </div>
         <div slot="reference" class="set_corpus" style="margin-left: 24px; cursor: pointer">设置条件</div>
       </el-popover>
@@ -70,7 +71,7 @@
     <div class="userName">
       <template v-if="seekOption">
         <el-popover v-model="visible" placement="bottom" width="335" trigger="click">
-          <div class="set_corpus_dv">
+          <!-- <div class="set_corpus_dv">
             <span>选择难度</span>
             <el-select v-model="corpus.difficlty" style="width: 205px" placeholder="请选择">
               <el-option
@@ -80,13 +81,13 @@
                 :value="itemD.value"
               />
             </el-select>
-          </div>
-          <div class="set_corpus_dv">
+          </div> -->
+          <!-- <div class="set_corpus_dv">
             <span>选择范围</span>
             <el-select v-model="corpus.scope" style="width: 205px" placeholder="请选择">
               <el-option v-for="(itemD, indexD) in scopeList" :key="indexD" :label="itemD.label" :value="itemD.value" />
             </el-select>
-          </div>
+          </div> -->
           <div class="set_corpus_dv">
             <span>句子长度</span>
             <el-input
@@ -98,14 +99,15 @@
             ——
             <el-input
               v-model="corpus.sentenceEnd"
-              style="width: 55px; margin-left: 8px"
+              style="width: 55px; margin: 0 8px"
               onkeyup="value=value.replace(/^0+(\d)|[^\d]+/g,'')"
               class="numbre-input"
             />
+            词
           </div>
           <div class="set_corpus_submit">
             <div @click="visible = false">取消</div>
-            <div @click="visible = false">确认</div>
+            <div @click="sureCorpus">确认</div>
           </div>
           <div slot="reference" class="set_corpus">设置</div>
         </el-popover>
@@ -172,10 +174,10 @@ export default {
       visible: false,
       visibleOption: false,
       corpus: {
-        difficlty: null,
-        scope: null,
-        sentenceStart: null,
-        sentenceEnd: null,
+        difficlty: localStorage.getItem('seekPageData')?JSON.parse(localStorage.getItem('seekPageData')).difficlty:null,
+        scope: localStorage.getItem('seekPageData')?JSON.parse(localStorage.getItem('seekPageData')).scope:null,
+        sentenceStart: localStorage.getItem('seekPageData')?JSON.parse(localStorage.getItem('seekPageData')).sentenceStart:null,
+        sentenceEnd: localStorage.getItem('seekPageData')?JSON.parse(localStorage.getItem('seekPageData')).sentenceEnd:null,
       },
       activeIndex: '2', // 主导航索引
       LoginNavIndex: 0, // 下拉框导航索引
@@ -294,20 +296,24 @@ export default {
   methods: {
     downSeek(e) {
       if (e.keyCode === 13) {
-        if (!this.keyword) {
-          this.$message.warning('请输入内容');
+        if (!this.keyword.trim()) {
+          this.$message.warning('请输入要搜索的内容');
           return;
         }
         this.seekresult();
       }
     },
     seekresult() {
+      if (!this.keyword.trim()) {
+        this.$message.warning('请输入要搜索的内容');
+        return;
+      }
       this.$router.replace({
         path: '/corpus/Result',
         query: {
           keyword: this.keyword,
         },
-      });
+      }).catch(err => err);
       this.$emit('changehzdata');
     },
     // 前往个人中心
@@ -414,6 +420,13 @@ export default {
           console.log(err);
         });
     },
+    // 存储句长信息
+    sureCorpus(){
+      this.visibleOption = false
+      this.visible = false
+      localStorage.setItem('seekPageData',JSON.stringify(this.corpus))
+      if(this.seekOptions) this.seekresult()
+    }
   },
 };
 </script>

+ 24 - 14
src/views/corpus/Result.vue

@@ -461,12 +461,17 @@ export default {
         this.inityuan();
     //   }
     },
-    updownHz() {
-      this.unfold = !this.unfold;
-      if (this.unfold) {
-        this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
-      } else {
+    updownHz(flag) {
+      if(flag===true){
+        this.unfold = false
         this.ShowHzData.splice(2);
+      }else{
+        this.unfold = !this.unfold;
+        if (this.unfold) {
+          this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
+        } else {
+          this.ShowHzData.splice(2);
+        }
       }
     },
     jfEvent(index) {
@@ -501,6 +506,7 @@ export default {
             this.$set(item.hzDetail, 'hz_json', res);
             this.$forceUpdate();
             this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
+            this.updownHz(true)
             if (i == this.hzData.length - 1) {
               this.loading = false;
             }
@@ -586,7 +592,7 @@ export default {
     changehzdata() {
       this.hzData = [];
       this.jfEvent(0);
-      let arr = this.$route.query.keyword.split('');
+      let arr = this.$route.query.keyword.trim().split('');
       arr.forEach(item => {
         if (!/^[\u4e00-\u9fa5]/.test(item)) {
           return;
@@ -624,16 +630,20 @@ export default {
         // courseware_id: "003-20211012-17-BDUZ1JVCAN",
         courseware_id: '',
         // word: this.$route.query.keyword, // 单词
-        word: this.$route.query.keyword,
+        word: this.$route.query.keyword.trim(),
         search_scope: 3, // 检索范围 0 【本章】,1【本教材】,2【本套教材】,3【系统所有教材】
         // 本章:同一本教材下,归属同一个第一级章节下的所有课件为同一章。
         is_contain_word_variants: false, // 是否包含单词变体例句
-        is_contain_stat_data: true, //
-        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: this.sortType==='pclength'?1:0
+        is_contain_stat_data: true, //是否包统计数据
+        is_filter_repetitive_sentence: 'true', // 过滤重复例句
+        sort_mode: this.sort ? (this.sort == 'down' ? 'DESCENT' : 'ASCENT') : 'NO',// 排序模式 NO 【不排序】,ASCENT【顺序】,DESCENT【倒序】
+        compare_mode: this.patternIndex === 0 ? 'LENGTH' : 'KWIC',// 排序比较模式,LENGTH【例句长度】,KWIC【KWIC 模式】
+        kwic_arrange_type: this.KWIC_sortIndex === 0 ? 'LEFT' : this.KWIC_sortIndex === 1 ? 'MID' : 'RIGHT',// KWIC 排列类型, LEFT【左】,MID【中】,RIGHT【右】
+        kwic_compare_by: this.sortType==='pclength'?1:0,// KWIC 排序比较依据,0【字符】,1【相邻的搭配词出现的次数】
+        book_publish_status: -1, // 教材发布状态 -1【全部】, 0【下架】1【上架】
+        book_id_list: [],  // 指定教材查询,空表示在检索范围内检索所有教材。
+        sentence_fc_length_min: localStorage.getItem('seekPageData')?Number(JSON.parse(localStorage.getItem('seekPageData')).sentenceStart):-1, // 例句分词长度范围(最小值),-1 表示不检测最小值
+        sentence_fc_length_max: localStorage.getItem('seekPageData')?Number(JSON.parse(localStorage.getItem('seekPageData')).sentenceEnd):-1, // 例句分词长度范围(最大值),-1 表示不检测最大值
       };
       BookgetContent(Mname, data)
         .then(res => {
@@ -684,7 +694,7 @@ export default {
             this.rightList = [];
             this.getrightListdata();
           }
-          if (this.$route.query.keyword && flag) {
+          if (this.$route.query.keyword.trim() && flag) {
             this.changehzdata();
           } else {
             this.loading = false;

+ 5 - 3
src/views/corpus/seekPage.vue

@@ -40,7 +40,7 @@ export default {
     downSeek(e) {
       if (e.keyCode == 13) {
         if (!this.keyword) {
-          this.$message.warning("请输入内容");
+          this.$message.warning("请输入要搜索的内容");
           return;
         }
         this.seekEvent();
@@ -48,7 +48,7 @@ export default {
     },
     seekEvent() {
       if (!this.keyword) {
-        this.$message.warning("请输入内容");
+        this.$message.warning("请输入要搜索的内容");
         return;
       }
       this.$router.push({
@@ -60,7 +60,9 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    localStorage.removeItem('seekPageData')
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   //生命周期-创建之前