公寓小程序端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

207 lines
4.4 KiB

// subpages/index/recruitment/detail/detail.js
import { recruitmentDetail } from '../../../../api/index'
Page({
/**
* 页面的初始数据
*/
data: {
info: null,
id: '',
statusHeight: 0,
navigationHeight: 44,
otherJobs: [], // 其他职位列表
currentPage: 1,
totalPages: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 获取系统信息
const systemInfo = wx.getSystemInfoSync()
this.setData({
statusHeight: systemInfo.statusBarHeight,
navigationHeight: 44
})
if(options.id){
this.setData({
id: options.id
})
this.recruitmentDetail(options.id)
}
},
/**
* 获取招聘详情
*/
recruitmentDetail(id){
wx.showLoading({
title: '加载中...',
})
recruitmentDetail({ id: id }).then(res=>{
wx.hideLoading()
if(res.code === 200){
this.setData({
info: res.data
})
// 获取其他职位
// this.getOtherJobs()
} else {
wx.showToast({
title: res.message || '获取详情失败',
icon: 'none'
})
}
}).catch(err => {
wx.hideLoading()
wx.showToast({
title: '网络错误',
icon: 'none'
})
})
},
/**
* 返回上一页
*/
handleGoToBack() {
wx.navigateBack()
},
/**
* 获取其他职位
*/
getOtherJobs() {
// 模拟其他职位数据
// const mockOtherJobs = [
// {
// id: 1001,
// position: '质量工程师',
// minWage: '9',
// maxWage: '12',
// publishTime: '2025-08-13',
// minEdu: '本科',
// workExp: '不限'
// },
// {
// id: 1002,
// position: '销售工程师',
// minWage: '10',
// maxWage: '18',
// publishTime: '2025-08-13',
// minEdu: '本科',
// workExp: '不限'
// },
// {
// id: 1003,
// position: '光学工程师',
// minWage: '7',
// maxWage: '9',
// publishTime: '2025-08-13',
// minEdu: '本科',
// workExp: '不限'
// }
// ]
// this.setData({
// otherJobs: mockOtherJobs,
// totalPages: 1
// })
},
/**
* 点击其他职位
*/
onOtherJobTap(e) {
const item = e.currentTarget.dataset.item
wx.navigateTo({
url: `/subpages/index/recruitment/detail/detail?id=${item.id}`
})
},
/**
* 上一页
*/
onPrevPage() {
if (this.data.currentPage > 1) {
this.setData({
currentPage: this.data.currentPage - 1
})
// 这里可以调用API获取对应页面的数据
}
},
/**
* 下一页
*/
onNextPage() {
if (this.data.currentPage < this.data.totalPages) {
this.setData({
currentPage: this.data.currentPage + 1
})
// 这里可以调用API获取对应页面的数据
}
},
/**
* 申请职位
*/
onApply() {
wx.showToast({
title: '申请成功',
icon: 'success'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})