flat: 国庆节暂存

This commit is contained in:
史典卓
2024-10-09 10:14:51 +08:00
parent 6504a558ac
commit a4ffe68ec2
32 changed files with 2663 additions and 2135 deletions

View File

@@ -1,54 +1,18 @@
<template>
<view class="mainWrapper">
<view v-show="!searchResultShow" class="headSearch">
<view class="headSearch">
<view class="search-view">
<view class="search-item">
<image src="../../static/img/search.svg" style="width: 32rpx;height: 32rpx;" mode=""></image>
<input type="text" confirm-type="搜索" v-model="keywords" @confirm="getNewList('search')"
<input type="text" confirm-type="搜索" v-model="keywords" @confirm="getList"
placeholder="搜零工岗位/搜全职岗位/搜政策" />
<view @click="getNewList('search')"
<view @click="getList"
style="width: 80rpx;height: 50rpx;color:#fff;background-color: #0091ff;font-size:24rpx;text-align: center;line-height: 50rpx;border-radius: 25rpx;;">
搜索</view>
</view>
<!-- <view class="close" @click="closeBack">
取消
</view> -->
</view>
</view>
<view v-show="searchResultShow" class="headSearch">
<view class="search-view">
<view class="search-item" @click="clearCurrentKeyWords">
<!-- <image src="../../static/img/search.svg" style="width: 32rpx;height: 32rpx;" mode=""></image> -->
<!-- <input type="text" confirm-type="搜索" v-model="keywords" @confirm="getNewList('search')"
placeholder="搜零工任务/搜岗位/搜政策" /> -->
<!-- <view @click="getNewList('search')" style="width: 80rpx;height: 50rpx;color:#fff;background-color: #0091ff;font-size:24rpx;text-align: center;line-height: 50rpx;border-radius: 25rpx;;">搜索</view> -->
<view
style="font-size: 24rpx;height: 50rpx;background-color: #ddd;border-radius: 25rpx;line-height: 50rpx;padding: 0 20rpx;padding-right: 40rpx;position:relative;">
{{ keywords }}
<u-icon name="close" size="14" style="position:absolute;right:10rpx;top:13rpx;"></u-icon>
</view>
</view>
</view>
</view>
<view v-show="searchResultShow" class="search-result">
<view class="title">搜索结果</view>
<view v-for="(item, index) in searchResultList" class="search-item" @click="toDetail(item)">
<image src="../../static/img/search.svg" style="width: 32rpx;height: 32rpx;margin-right: 10rpx;"
mode=""></image>
<view style="flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{ item.name }}</view>
<view class="type" v-if="item.type == 0">零工岗位</view>
<view class="type" v-else-if="item.type == 1">全职岗位</view>
<view class="type" v-else-if="item.type == 2">政策</view>
<view class="type" v-else-if="item.type == 3">招工</view>
</view>
<view v-if="searchResultList.length > 0"
style="text-align: center;font-size: 26rpx;margin-top: 20rpx;color:#999;">没有更多数据了</view>
<view v-if="searchResultList.length == 0" style="text-align: center;font-size: 26rpx;margin-top: 20rpx;">
暂无数据</view>
</view>
<view v-show="!searchResultShow" class="search-history">
<view class="search-history">
<view class="title">搜索记录</view>
<view class="clear" @click="clearKeyWords">
<image src="../../static/img/delete.png" style="width: 24rpx;height: 24rpx;" mode=""></image>
@@ -60,15 +24,14 @@
</view>
</view>
<view v-else class="empty">暂无历史记录</view>
<v-tabs :tabs="tabList" height="45px" v-model="activeTab" color="#999" activeColor="#000" fontSize="30rpx"
activeFontSize="31rpx" @change='changeTab' />
</view>
<v-tabs v-show="!searchResultShow" :tabs="['推荐零工岗位', '推荐全职岗位', '推荐政策']" height="45px" v-model="activeTab"
color="#999" activeColor="#000" fontSize="30rpx" activeFontSize="31rpx" @change='changeTab' />
<block v-if="(activeTab == 0)&&!searchResultShow">
<view v-if="companyList.length > 0">
<block v-if="activeTab === 0">
<view v-if="companyList.length ">
<block v-for="(item, index) in companyList" :key="item.id">
<companyList :companyitem="item"></companyList>
<companyList :companyitem="item" :location="userLocation"></companyList>
</block>
</view>
<view v-else>
@@ -78,10 +41,10 @@
</view>
</view>
</block>
<block v-if="(activeTab == 1)&&!searchResultShow">
<view v-if="newList.length > 0">
<block v-if="activeTab === 1">
<view v-if="newList.length">
<block v-for="(item, index) in newList" :key="item.id">
<workList :companyitem="item" :near="activeTab === 0"></workList>
<workList :companyitem="item" :near="activeTab === 0" :location="userLocation"></workList>
</block>
</view>
<view v-else>
@@ -92,8 +55,8 @@
<block v-if="(activeTab == 2)&&!searchResultShow">
<view v-if="recommendList.length > 0">
<block v-if="activeTab == 2">
<view v-if="recommendList.length">
<!-- <block v-for="(item, index) in recommendList" :key="item.id">
<companyList :companyitem="item"></companyList>
</block> -->
@@ -109,94 +72,86 @@
<view v-else>
<image src="../../static/img/pic_notask.svg" mode="" class="nothing"></image>
<view class="nothingContnt">
完善技能获取精推荐
暂无信息
</view>
<!-- <view class="btn" @click="goResume">
完善技能
</view> -->
完善技能
</view> -->
</view>
</block>
<!-- <view v-if="companyList.length > 0">
<block v-for="(item, index) in companyList" :key="item.id">
<companyList :companyitem="item"></companyList>
<view class="baddd"></view>
</block>
</view>
<view v-else>
<image src="../../static/img/pic_notask.svg" mode="" class="nothing"></image>
<view class="nothingContnt">
暂无任务信息
</view>
</view> -->
<block v-if="activeTab == -1">
<view>
<image src="../../static/img/pic_notask.svg" mode="" class="nothing"></image>
<view class="nothingContnt">
没有更多数据
</view>
</view>
</block>
</view>
</template>
<script>
import {
cloneDeep
} from 'lodash';
import {
newMissionAll,
getSearchKeyWordsList,
clearSearchKeyWords,
getListByKeyWords,
nearMission,
getPolicyContentList
getPolicyContentList,
userWorkSearchListAll
} from '@/api/mission.js';
import {
mapGetters
} from 'vuex'
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'
const titleStatus = {
'mission': {
title: '零工岗位',
val: 0,
},
'work': {
title: '全职岗位',
val: 1,
},
'policy': {
title: '政策',
val: 2,
},
}
export default {
components: {
companyList,
vTabs,
workList
},
data() {
return {
activeTab: 0,
companyList: [],
recommendList: [],
newList: [],
keywords: '',
page: {
current: 1,
size: 10,
total: 0
},
searchHistoryList: [],
searchResultShow: false,
searchResultList: []
};
companyList: [],
newList: [],
recommendList: [],
tabList: ['零工岗位', '全职岗位', '政策']
}
},
onLoad: function(option) {
this.keywords = option.keywords ? option.keywords : ''
computed: {
...mapGetters(['userLocation']),
},
onShow: function() {
this.getList('refresh');
this.getKeyWordsList()
},
/*页面滚动到底部*/
onReachBottom: function() {
this.upLoad()
},
methods: {
clearCurrentKeyWords() {
this.keywords = '';
let that = this;
setTimeout(function() {
that.searchResultShow = false;
}, 100);
},
// 新面板搜索
getNewList() {
getListByKeyWords(this.keywords).then(res => {
this.searchResultShow = true
this.searchResultList = res.data.data
// this.searchResultList.forEach((item, index) => {
// item.name = this.getInf(item.name, this.keywords);
// })
})
goPolicyInfo(data) {
if (data) {
uni.navigateTo({
url: `/pages/user/policyContent?id=${data}`
})
}
},
// 获取搜索历史记录
getKeyWordsList() {
@@ -211,142 +166,6 @@
// console.log(keyWords)
this.searchResultShow = true;
this.keywords = keyWords;
this.getNewList();
},
//最新任务;
getList: function(type = 'add') {
//改变搜索条件页码值变为1
if (type === 'refresh') {
this.page.current = 1;
};
// if (this.keywords) {
newMissionAll(this.page.current, this.page.size, this.keywords).then(res => {
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;
})
},
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)) {
switch (this.activeTab) {
case 0:
this.getList();
break;
case 1:
this.getgwList();
break;
case 2:
this.getPoliyList()
break;
}
} else {
uni.showToast({
icon: "none",
title: '已经是最后一页',
})
return
}
},
closeBack() {
uni.navigateBack({
delta: 1
})
},
/**
* 指定关键字高亮
* @param {*} str 字符串
* @param {*} key 关键字
*/
getInf(str, key) {
if (str && key) {
let replaceReg = new RegExp(key, 'g') // 匹配关键字正则
let replaceString = "<span style='color: #1b66ff;'>" + key + "</span>" // 高亮替换
return str.replace(replaceReg, replaceString);
}
},
toDetail(item) {
const no = item.id
// 判断是岗位还是任务 0任务1岗位2政策
if (item.type == 0) {
uni.navigateTo({
url: `/pages/projectInfo/projectInfo?missionNo=${encodeURIComponent(no)}&isCan=1`
})
} else if (item.type == 1) {
uni.navigateTo({
url: `/pages/projectInfo/workInfo?workId=${encodeURIComponent(no)}&isCan=1`
})
} else if (item.type == 2) {
uni.navigateTo({
url: `/pages/user/policyContent?id=${no}`
})
}
},
changeTab: function(e) {
this.activeTab = e;
switch (e) {
case 0:
this.getList('refresh');
break;
case 1:
this.getgwList('refresh');
break;
case 2:
this.getPoliyList('refresh')
break;
}
},
// 清空搜索历史
clearKeyWords() {
@@ -355,15 +174,55 @@
this.getKeyWordsList()
}
})
},
changeTab: function(e) {
this.activeTab = e;
// const tab = cloneDeep(this.tabList[e])
// Object.keys(titleStatus).map((key) => {
// if (titleStatus[key].title === tab) {
// this.activeTab = titleStatus[key].val;
// }
// })
},
async getList() {
const params = {
keywords: this.keywords
}
let resData = await userWorkSearchListAll(params)
if (resData.data.code === 200) {
const {
mission,
policy,
work
} = resData.data.data
const tabVal = []
Object.keys(titleStatus).map((key) => {
if (resData.data.data[key].length) {
tabVal.push(titleStatus[key].title)
}
})
if (tabVal.length) {
let count = 0
Object.keys(titleStatus).map((key) => {
if (!count && titleStatus[key].title === tabVal[0]) {
this.activeTab = titleStatus[key].val;
count++
}
})
}
this.companyList = mission
this.recommendList = policy
this.newList = work
}
}
}
};
}
</script>
<style scoped>
.mainWrapper {
background-color: #f3f4f8;
min-height: 95vh;
min-height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
}
.baddd {
@@ -475,6 +334,7 @@
padding: 8rpx 12rpx;
border-radius: 20rpx;
margin-right: 10rpx;
position: relative;
}
.search-result {