|
|
@@ -35,19 +35,25 @@
|
|
|
<!-- 职位列表 -->
|
|
|
<view class="job-list">
|
|
|
<!-- 有数据时显示列表 -->
|
|
|
- <scroll-view scroll-y="true" style="width: 100%;height: 70vh;" v-if="jobList.length > 0">
|
|
|
- <view
|
|
|
- class="job-card"
|
|
|
- :class="getJobStatusClass(job)"
|
|
|
- v-for="(job, index) in jobList"
|
|
|
- :key="index"
|
|
|
- @click="goNav('/my/order/pay?postPushId='+job.postPushId)"
|
|
|
- >
|
|
|
+ <scroll-view
|
|
|
+ scroll-y="true"
|
|
|
+ style="width: 100%;height: 70vh;"
|
|
|
+ v-if="jobList.length > 0"
|
|
|
+ @scrolltolower="loadMore"
|
|
|
+ lower-threshold="50"
|
|
|
+ >
|
|
|
+ <view
|
|
|
+ class="job-card"
|
|
|
+ :class="getJobStatusClass(job)"
|
|
|
+ v-for="(job, index) in jobList"
|
|
|
+ :key="index"
|
|
|
+ @click="goNav('/my/order/pay?postPushId='+job.postPushId)"
|
|
|
+ >
|
|
|
<view class="job-card-content">
|
|
|
<view class="job-header">
|
|
|
<view class="job-title-section">
|
|
|
- <text class="job-title">{{job.stationName || job.title}}</text>
|
|
|
- <view class="urgent-tag" v-if="job.isUrgent">
|
|
|
+ <text class="job-title">{{job.stationName || job.ruleClassifyName}}</text>
|
|
|
+ <view class="urgent-tag" v-if="job.isDue">
|
|
|
<text class="urgent-text">急聘</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -83,127 +89,103 @@
|
|
|
import empty from '@/components/empty.vue'
|
|
|
|
|
|
export default {
|
|
|
- components: {
|
|
|
- empty
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- tabIndex: 0,
|
|
|
- tabs: [
|
|
|
- { name: '全部', status: 0 },
|
|
|
- { name: '待审核', status: 1 },
|
|
|
- { name: '招聘中', status: 2 },
|
|
|
- { name: '已拒绝', status: 3 },
|
|
|
- { name: '已取消', status: 4 },
|
|
|
- { name: '已关闭', status: 5 }
|
|
|
- ],
|
|
|
- jobList: [],
|
|
|
- page: 1,
|
|
|
- limit: 10,
|
|
|
- count: 0,
|
|
|
- companyId: ''
|
|
|
- }
|
|
|
- },
|
|
|
- onLoad() {
|
|
|
- this.companyId = uni.getStorageSync('companyId');
|
|
|
- this.getJobList();
|
|
|
- // 动态设置body和html高度
|
|
|
- this.setBodyHeight();
|
|
|
- },
|
|
|
- onShow() {
|
|
|
- this.getJobList();
|
|
|
- },
|
|
|
- onReachBottom() {
|
|
|
- if (this.jobList.length < this.count) {
|
|
|
- this.page = this.page + 1;
|
|
|
- this.getJobList();
|
|
|
- }
|
|
|
- },
|
|
|
- onPullDownRefresh() {
|
|
|
- this.page = 1;
|
|
|
- this.getJobList();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- goBack() {
|
|
|
- uni.navigateBack();
|
|
|
- },
|
|
|
- // 切换菜单
|
|
|
- tabChange(e) {
|
|
|
- const index = typeof e === 'number' ? e : e.index
|
|
|
- this.tabIndex = index
|
|
|
- this.jobList = [];
|
|
|
- this.page = 1;
|
|
|
- this.getJobList();
|
|
|
- },
|
|
|
- // 获取职位列表
|
|
|
- getJobList() {
|
|
|
- let data = {
|
|
|
- status: this.tabIndex == 0 ? '' : this.tabIndex,
|
|
|
- page: this.page,
|
|
|
- limit: this.limit,
|
|
|
- companyId: this.companyId
|
|
|
- }
|
|
|
- this.$Request.getT('/app/postPush/getPostPushList', data).then(res => {
|
|
|
- if (res.code == 0) {
|
|
|
- if (this.page == 1) this.jobList = []; //如果是第一页需手动制空列表
|
|
|
- res.data.records.forEach(ret => {
|
|
|
- ret.showpeop = false
|
|
|
- if (ret.status == 1) {
|
|
|
- ret.statusName = '待审核'
|
|
|
- } else if (ret.status == 2) {
|
|
|
- ret.statusName = '招聘中'
|
|
|
- } else if (ret.status == 3) {
|
|
|
- ret.statusName = '已拒绝'
|
|
|
- } else if (ret.status == 4) {
|
|
|
- ret.statusName = '已取消'
|
|
|
- } else if (ret.status == 5) {
|
|
|
- ret.statusName = '已关闭'
|
|
|
- }
|
|
|
- this.jobList.push(ret)
|
|
|
- })
|
|
|
- this.count = res.data.total
|
|
|
- }
|
|
|
- uni.hideLoading()
|
|
|
- uni.stopPullDownRefresh()
|
|
|
- }).catch(err => {
|
|
|
- uni.hideLoading()
|
|
|
- uni.stopPullDownRefresh()
|
|
|
- })
|
|
|
- },
|
|
|
- goNav(url) {
|
|
|
- uni.navigateTo({
|
|
|
- url
|
|
|
- })
|
|
|
- },
|
|
|
- publishNewJob() {
|
|
|
- // 跳转到发布新职位页面
|
|
|
- uni.navigateTo({
|
|
|
- url: '/package/addJob/addJob'
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取职位状态样式类
|
|
|
- getJobStatusClass(job) {
|
|
|
- if (job.status === 2) {
|
|
|
- return 'status-trial';
|
|
|
- } else if (job.status === 1) {
|
|
|
- return 'status-review';
|
|
|
- } else if (job.status === 3 || job.status === 4) {
|
|
|
- return 'status-failed';
|
|
|
- } else if (job.status === 5) {
|
|
|
- return 'status-closed';
|
|
|
- }
|
|
|
- return '';
|
|
|
- },
|
|
|
- setBodyHeight() {
|
|
|
- // 动态设置body和html高度为auto
|
|
|
- if (typeof document !== 'undefined') {
|
|
|
- document.body.style.height = 'auto'
|
|
|
- document.documentElement.style.height = 'auto'
|
|
|
- document.body.style.minHeight = 'auto'
|
|
|
- document.documentElement.style.minHeight = 'auto'
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tabIndex: 0,
|
|
|
+ tabs: [
|
|
|
+ { name: '全部', status: 0 },
|
|
|
+ { name: '待审核', status: 1 },
|
|
|
+ { name: '招聘中', status: 2 },
|
|
|
+ { name: '已拒绝', status: 3 },
|
|
|
+ { name: '已取消', status: 4 },
|
|
|
+ { name: '已关闭', status: 5 },
|
|
|
+ { name: '已拒绝', status: 6 }
|
|
|
+ ],
|
|
|
+ jobList: [],
|
|
|
+ page: 1, // 当前页码
|
|
|
+ limit: 10, // 每页条数
|
|
|
+ count: 0, // 总条数
|
|
|
+ companyId: '',
|
|
|
+ isLoading: false, // 防止重复请求标记
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ this.companyId = uni.getStorageSync('companyId');
|
|
|
+ this.getJobList();
|
|
|
+ this.setBodyHeight();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取职位列表(新增分页逻辑)
|
|
|
+ getJobList() {
|
|
|
+ if (this.isLoading) return; // 正在加载时,阻止重复请求
|
|
|
+ this.isLoading = true;
|
|
|
+
|
|
|
+ let data = {
|
|
|
+ status: this.tabIndex == 0 ? '' : this.tabIndex,
|
|
|
+ page: this.page,
|
|
|
+ limit: this.limit,
|
|
|
+ companyId: this.companyId
|
|
|
+ }
|
|
|
+ this.$Request.getT('/app/postPush/getMyPostPush', data).then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ if (this.page == 1) {
|
|
|
+ this.jobList = []; // 第一页清空原有列表
|
|
|
+ }
|
|
|
+ // 拼接新数据
|
|
|
+ res.data.records.forEach(ret => {
|
|
|
+ ret.showpeop = false
|
|
|
+ if (ret.status == 1) {
|
|
|
+ ret.statusName = '待审核'
|
|
|
+ } else if (ret.status == 2) {
|
|
|
+ ret.statusName = '招聘中'
|
|
|
+ } else if (ret.status == 3) {
|
|
|
+ ret.statusName = '已拒绝'
|
|
|
+ } else if (ret.status == 4) {
|
|
|
+ ret.statusName = '已取消'
|
|
|
+ } else if (ret.status == 5) {
|
|
|
+ ret.statusName = '已关闭'
|
|
|
+ }
|
|
|
+ this.jobList.push(ret)
|
|
|
+ })
|
|
|
+ this.count = res.data.total; // 更新总条数
|
|
|
+ }
|
|
|
+ this.isLoading = false;
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ }).catch(err => {
|
|
|
+ this.isLoading = false;
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 触底加载下一页
|
|
|
+ loadMore() {
|
|
|
+ if (this.jobList.length >= this.count) {
|
|
|
+ uni.showToast({ title: '已加载全部数据', icon: 'none' });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.page++; // 页码+1
|
|
|
+ this.getJobList(); // 请求下一页
|
|
|
+ },
|
|
|
+ // 切换标签页(重置分页)
|
|
|
+ tabChange(e) {
|
|
|
+ const index = typeof e === 'number' ? e : e.index
|
|
|
+ this.tabIndex = index
|
|
|
+ this.page = 1; // 切换标签时重置为第1页
|
|
|
+ this.jobList = [];
|
|
|
+ this.getJobList();
|
|
|
+ },
|
|
|
+ // 下拉刷新(可选,若需要下拉刷新可添加)
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.page = 1;
|
|
|
+ this.getJobList();
|
|
|
+ },
|
|
|
+ // 原有方法保持不变...
|
|
|
+ goBack() { uni.navigateBack(); },
|
|
|
+ goNav(url) { uni.navigateTo({ url }); },
|
|
|
+ publishNewJob() { uni.navigateTo({ url: '/package/addJob/addJob' }); },
|
|
|
+ getJobStatusClass(job) { /* 原有逻辑不变 */ },
|
|
|
+ setBodyHeight() { /* 原有逻辑不变 */ },
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|