From 3d985542babbcd90bbde30c4a0ae1b86ecb037d0 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Wed, 8 May 2024 11:26:38 +0800 Subject: [PATCH] =?UTF-8?q?flat=EF=BC=9A=20=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/mission.js | 7 ++- pages/seach/seach.vue | 118 ++++++++++++++++++++++++++++++++---------- 2 files changed, 97 insertions(+), 28 deletions(-) diff --git a/api/mission.js b/api/mission.js index f9a9462..75d166c 100644 --- a/api/mission.js +++ b/api/mission.js @@ -299,4 +299,9 @@ export const getMyInviteUserList = (params) => { method: 'get', params }) -} \ No newline at end of file +} +export const getPolicyContentList = (params) => request({ + url: '/api/jobslink-api/desk/article/getAllArticle', + method: 'get', + params +}) \ No newline at end of file diff --git a/pages/seach/seach.vue b/pages/seach/seach.vue index d96ccbd..d58b21f 100644 --- a/pages/seach/seach.vue +++ b/pages/seach/seach.vue @@ -80,8 +80,8 @@ - - + + @@ -94,11 +94,18 @@ - + + + + {{ item.articleTitle }} + + @@ -130,15 +137,19 @@ newMissionAll, getSearchKeyWordsList, clearSearchKeyWords, - getListByKeyWords + getListByKeyWords, + nearMission, + getPolicyContentList } from '@/api/mission.js'; import companyList from '@/components/companyList/companyList.vue'; import vTabs from '@/components/v-tabs/v-tabs.vue'; import testData from '@/common/textdata.js'; + import workList from '@/components/companyList/workList.vue' export default { components: { companyList, vTabs, + workList }, data() { return { @@ -161,8 +172,7 @@ this.keywords = option.keywords ? option.keywords : '' }, onShow: function() { - this.getList('search'); - + this.getList('refresh'); this.getKeyWordsList() }, /*页面滚动到底部*/ @@ -204,37 +214,81 @@ this.getNewList(); }, //最新任务; - getList: function(type) { + getList: function(type = 'add') { //改变搜索条件,页码值变为1 - if (type === 'search') { + if (type === 'refresh') { this.page.current = 1; }; // if (this.keywords) { newMissionAll(this.page.current, this.page.size, this.keywords).then(res => { - if (this.page.current === 1) { - this.companyList = []; + this.page.total = res.data.data.total; + if (type === 'refresh') { + this.companyList = res.data.data.records + } else if (res.data.data && res.data.data.records.length) { + this.companyList = this.companyList.concat(res.data.data.records); } this.page.current += 1; - this.page.total = res.data.data.total; - if (res.data.data && res.data.data.records.length) { - this.companyList = this.companyList.concat(res.data.data.records); - - } - //搜索关键词高亮 - // if (this.companyList.length) { - // this.companyList.forEach((item, index) => { - // item.missionTitle = this.getInf(item.missionTitle, this.keywords); - // }); - // } - console.log(this.companyList, '----------'); }) - // } }, - + getgwList(type = 'add') { + if (type === 'refresh') { + this.page.current = 1; + }; + nearMission(this.page.current, this.page.size).then(res => { + this.page.total = res.data.data.total; + if (type === 'refresh') { + this.newList = res.data.data.records + } else if (res.data.data && res.data.data.records.length) { + this.newList = this.newList.concat(res.data.data.records); + } + this.page.current += 1; + }) + }, + getPoliyList(type = 'add') { + if (type === 'refresh') { + this.page.current = 1; + }; + let params = { + current: this.page.current, + size: this.page.size, + type: 1 + } + getPolicyContentList(params).then(res => { + this.page.total = res.data.data.total; + if (type === 'refresh') { + this.recommendList = res.data.data.records + } else if (res.data.data && res.data.data.records.length) { + this.recommendList = this.recommendList.concat(res.data.data.records); + } + this.page.current += 1; + }) + }, + goPolicyInfo(data) { + if (data) { + uni.navigateTo({ + url: `/pages/user/policyContent?id=${data}` + }) + } else { + // uni.showToast({ + // title:'暂无内容', + // icon:'none' + // }) + } + }, //上拉加载 upLoad: function() { if (this.page.current <= Math.ceil(this.page.total / this.page.size)) { - this.getList(); + switch (this.activeTab) { + case 0: + this.getList(); + break; + case 1: + this.getgwList(); + break; + case 2: + this.getPoliyList() + break; + } } else { uni.showToast({ icon: "none", @@ -282,7 +336,17 @@ changeTab: function(e) { this.activeTab = e; - console.log(e) + switch (e) { + case 0: + this.getList('refresh'); + break; + case 1: + this.getgwList('refresh'); + break; + case 2: + this.getPoliyList('refresh') + break; + } }, // 清空搜索历史 clearKeyWords() {