flat: 搜索

This commit is contained in:
Apcallover
2024-05-08 11:26:38 +08:00
parent bdd6ce0af7
commit 3d985542ba
2 changed files with 97 additions and 28 deletions

View File

@@ -300,3 +300,8 @@ export const getMyInviteUserList = (params) => {
params params
}) })
} }
export const getPolicyContentList = (params) => request({
url: '/api/jobslink-api/desk/article/getAllArticle',
method: 'get',
params
})

View File

@@ -80,8 +80,8 @@
</block> </block>
<block v-if="(activeTab == 1)&&!searchResultShow"> <block v-if="(activeTab == 1)&&!searchResultShow">
<view v-if="newList.length > 0"> <view v-if="newList.length > 0">
<block v-for="(item, index) in newList" :key="index"> <block v-for="(item, index) in newList" :key="item.id">
<companyList :companyitem="item"></companyList> <workList :companyitem="item" :near="activeTab === 0"></workList>
</block> </block>
</view> </view>
<view v-else> <view v-else>
@@ -94,11 +94,18 @@
<block v-if="(activeTab == 2)&&!searchResultShow"> <block v-if="(activeTab == 2)&&!searchResultShow">
<view v-if="recommendList.length > 0"> <view v-if="recommendList.length > 0">
<block v-for="(item, index) in recommendList" :key="item.id"> <!-- <block v-for="(item, index) in recommendList" :key="item.id">
<companyList :companyitem="item"></companyList> <companyList :companyitem="item"></companyList>
</block> </block> -->
<view v-for="(item, index) in recommendList" :key="index"
style="width: 90%;height: 100rpx;background-color: #fff;border-radius: 10rpx;margin:20rpx 5% 20rpx 5%;display: flex;align-items: center"
@click="goPolicyInfo(item.id)">
<image :src="item.headPic" style="width: 60rpx;height: 60rpx;margin: 0 20rpx;"></image>
<view style="font-size: 26rpx;">{{ item.articleTitle }}</view>
</view>
</view> </view>
<view v-else> <view v-else>
<image src="../../static/img/pic_notask.svg" mode="" class="nothing"></image> <image src="../../static/img/pic_notask.svg" mode="" class="nothing"></image>
<view class="nothingContnt"> <view class="nothingContnt">
@@ -130,15 +137,19 @@
newMissionAll, newMissionAll,
getSearchKeyWordsList, getSearchKeyWordsList,
clearSearchKeyWords, clearSearchKeyWords,
getListByKeyWords getListByKeyWords,
nearMission,
getPolicyContentList
} from '@/api/mission.js'; } from '@/api/mission.js';
import companyList from '@/components/companyList/companyList.vue'; import companyList from '@/components/companyList/companyList.vue';
import vTabs from '@/components/v-tabs/v-tabs.vue'; import vTabs from '@/components/v-tabs/v-tabs.vue';
import testData from '@/common/textdata.js'; import testData from '@/common/textdata.js';
import workList from '@/components/companyList/workList.vue'
export default { export default {
components: { components: {
companyList, companyList,
vTabs, vTabs,
workList
}, },
data() { data() {
return { return {
@@ -161,8 +172,7 @@
this.keywords = option.keywords ? option.keywords : '' this.keywords = option.keywords ? option.keywords : ''
}, },
onShow: function() { onShow: function() {
this.getList('search'); this.getList('refresh');
this.getKeyWordsList() this.getKeyWordsList()
}, },
/*页面滚动到底部*/ /*页面滚动到底部*/
@@ -204,37 +214,81 @@
this.getNewList(); this.getNewList();
}, },
//最新任务; //最新任务;
getList: function(type) { getList: function(type = 'add') {
//改变搜索条件页码值变为1 //改变搜索条件页码值变为1
if (type === 'search') { if (type === 'refresh') {
this.page.current = 1; this.page.current = 1;
}; };
// if (this.keywords) { // if (this.keywords) {
newMissionAll(this.page.current, this.page.size, this.keywords).then(res => { newMissionAll(this.page.current, this.page.size, this.keywords).then(res => {
if (this.page.current === 1) { this.page.total = res.data.data.total;
this.companyList = []; 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.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() { upLoad: function() {
if (this.page.current <= Math.ceil(this.page.total / this.page.size)) { 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 { } else {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
@@ -282,7 +336,17 @@
changeTab: function(e) { changeTab: function(e) {
this.activeTab = 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() { clearKeyWords() {