Browse Source

职位条件查询

lrf402788946 5 năm trước cách đây
mục cha
commit
e26f0c1c47
2 tập tin đã thay đổi với 18 bổ sung8 xóa
  1. 6 6
      src/pages/jobsList/views/list.vue
  2. 12 2
      src/store/jobs.js

+ 6 - 6
src/pages/jobsList/views/list.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="jobs">
-    <list-layout searchPlaceHolder="请输入公司或职位名称" @searchBar="searchBar" :needInfinteLoading="false" :searchName="`corpname`">
+    <list-layout searchPlaceHolder="请输入职位名称" @searchBar="searchBar" :needInfinteLoading="false" :searchName="`job_name`">
       <template v-slot:content>
         <!-- <div style="width: 100%;">
           <div class="demo-image__placeholder">
@@ -52,7 +52,6 @@ export default {
     jobsName: '',
     jobsList: [],
     internList: [],
-    hasMore: [],
     totalRow: [],
     jobsTotalRow: 0,
     jobsHasMore: true,
@@ -68,7 +67,7 @@ export default {
   computed: {},
   methods: {
     ...mapActions(['postsOperation']),
-    async search({ type, currentPage }) {
+    async search({ type = this.active, currentPage } = {}) {
       let skip = 0;
       //首先取出当前显示的分类下的列表相关信息
       if (currentPage) {
@@ -76,14 +75,14 @@ export default {
       }
       let hasMore = _.get(this, `${type}HasMore`);
       if (!hasMore) return false; //判断的是:如果我列表的数据条数大于等于数据库返回给我的总数时=>我就不查了.没数据了
-      this.$set(this, `hasMore`, false); //控制无限加载瞬间加载N次的情况
+      this.$set(this, `${type}HasMore`, false); //控制无限加载瞬间加载N次的情况
       let result = await this.postsOperation({
         type: 'list',
         data: { skip: skip, limit: this.$limit, is_practice: type === 'jobs' ? '0' : '1', ...this.searchInfo },
       }); //查询,添加skip和limit参数
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
-        this.$set(this, `${type}List`, _.get(this, `${type}List`).concat(result.data)); //将现有的列表和请求来的数据列表合并到一起,自动追加在下面import '@/plugins/var';
+        this.$set(this, `${type}List`, skip === 0 ? this.$set(this, `${type}List`, result.data) : _.get(this, `${type}List`).concat(result.data)); //将现有的列表和请求来的数据列表合并到一起,自动追加在下面
         this.$set(this, `${type}TotalRow`, result.total); //将数据库返回的总数放到页面的totalRow变量中,用来判断
         this.$set(this, `${type}HasMore`, _.get(this, `${type}List`).length < result.total); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据
       }
@@ -92,7 +91,8 @@ export default {
       //1)实时同步查询框中的内容至当前组件内
       this.$set(this, `searchInfo`, value);
       if (type === 'search') {
-        this.hasMore = true;
+        console.log(`in function:searchBar: ${this.active} `);
+        this.$set(this, `${this.active}HasMore`, true);
         this.search();
       }
     },

+ 12 - 2
src/store/jobs.js

@@ -15,8 +15,18 @@ export const actions = {
   async postsOperation({ state }, { type, data }) {
     let result;
     if (type === 'list') {
-      let { corpid, state, corpname, is_practice } = data;
-      result = await this.$axios.$get(api.posts, {}, { corpid: corpid, state: state, corpname: corpname, is_practice: is_practice });
+      let { corpid, state, corpname, is_practice, ...searchInfo } = data;
+      result = await this.$axios.$get(
+        api.posts,
+        {},
+        {
+          corpid: corpid,
+          state: state,
+          corpname: corpname,
+          is_practice: is_practice,
+          ...searchInfo,
+        }
+      );
     }
     if (type === 'add') {
       let { info, corpid, corpname } = data;