flat: 搜索
This commit is contained in:
@@ -80,8 +80,8 @@
|
||||
</block>
|
||||
<block v-if="(activeTab == 1)&&!searchResultShow">
|
||||
<view v-if="newList.length > 0">
|
||||
<block v-for="(item, index) in newList" :key="index">
|
||||
<companyList :companyitem="item"></companyList>
|
||||
<block v-for="(item, index) in newList" :key="item.id">
|
||||
<workList :companyitem="item" :near="activeTab === 0"></workList>
|
||||
</block>
|
||||
</view>
|
||||
<view v-else>
|
||||
@@ -94,11 +94,18 @@
|
||||
|
||||
<block v-if="(activeTab == 2)&&!searchResultShow">
|
||||
<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>
|
||||
</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 v-else>
|
||||
<image src="../../static/img/pic_notask.svg" mode="" class="nothing"></image>
|
||||
<view class="nothingContnt">
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user