import recruitApi from '../../api/recruit' const app = getApp() Page({ /** * 页面的初始数据 */ data: { endDate:'', // birth:'1990-01-01', // date:'1990-01-01', // sex: 0, array: ["保密", "男", "女"], educationArray: ["小学", "初中", "高中","中技(中专、技校、职高)","大专","本科","硕士研究生","MBA","博士研究生","保密"], // highestEducation: 0, schoolTypeArray: ["","全国普通高等院校非全日制","全国普通高等院校全日制", "成人高等教育", "统招专升本","其他","自学考试","非统招专升本","海外留学生"], // learningModality: 0, statusArray: ["","正在主动找工作","可以考虑工作机会", "目前不想找工作"], // jobStatus: 0, moneyArray: ["","1000以下","1000-2000", "2001-4000", "4001-6000","6001-8000","8001-10000","10001-15000","15001-25000","25001-30000","30001-50000","50001以上","面议"], // nowMoneyIndex:0, // expectMoneyIndex:0, type:1,//1保存简历 2保存简历+投递简历) saveTitle:'保存', name:'', emali:'', mobile:'', birthday:'1990-01-01', gender:0, nowAddress:'', registeredAddress:'', highestEducation:0, learningModality:0, takeProfessionally:'', jobStatus:0, hopeProfessionally:'', nowSalary:0, hopeSalary:0, resumeFile:'', resumeFileName:'在微信聊天中选择附件', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) if(options.type ==2){ this.setData({ saveTitle:'确认投递' }) wx.setNavigationBarTitle({ title: '投递简历' }) }else{ wx.setNavigationBarTitle({ title: '我的简历' }) } var d = new Date(); var endDate = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() this.setData({ endDate:endDate, type:options.type, recruitsId:options.id, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: async function () { const isAuth = await app.isAuth() if (!isAuth) { wx.redirectTo({ url: '/pages/prompt/prompt?page=' + this.route+"?type="+this.data.type, }) return } var openId = wx.getStorageSync("openId") this.setData({ openId:openId }) await this.getUserInfo(openId); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, changeBirth: function (e) { this.setData({ birthday: e.detail.value }) }, changeSex: function (e) { this.setData({ gender: e.detail.value }) }, changeEducation: function (e) { this.setData({ highestEducation: e.detail.value }) }, changeSchoolType: function (e) { this.setData({ learningModality: e.detail.value }) }, changeStatus:function(e){ this.setData({ jobStatus: e.detail.value }) }, changeNowMoney:function(e){ this.setData({ nowSalary: e.detail.value }) }, changeExpectMoney:function(e){ this.setData({ hopeSalary: e.detail.value }) }, chooseEnclosure:function(){ var self =this; wx.chooseMessageFile({ count: 1, type: 'file', success (res) { // tempFilePath可以作为img标签的src属性显示图片 console.log(res.tempFiles); var path = res.tempFiles[0].path self.setData({ resumeFile:path, resumeFileName:res.tempFiles[0].name }) } }) }, getUserInfo: async function(openId) { var params = {} params['openid'] = openId; var info = await recruitApi.infoUser(params); console.log(info); var highestEducation = info.highestEducation?info.highestEducation:0; var jobStatus = info.jobStatus?info.jobStatus:0; var nowSalary = info.nowSalary?info.nowSalary:0; var hopeSalary = info.hopeSalary?info.hopeSalary:0; var learningModality = info.learningModality?info.learningModality:0; var birthday = info.birthday?info.birthday:'1990-01-01'; this.setData({ userId:info.userId, name:info.name, email:info.email, mobile:info.mobile, gender:info.gender, birthday:birthday, nowAddress:info.nowAddress, registeredAddress:info.registeredAddress, highestEducation:highestEducation, learningModality:learningModality, takeProfessionally:info.takeProfessionally, jobStatus:jobStatus, hopeProfessionally:info.hopeProfessionally, nowSalary:nowSalary, hopeSalary:hopeSalary, resumeFile:info.resumeFile, }) }, saveResume: async function(){ if(!this.data.name){ wx.showToast({ title: '请输入姓名', icon: 'none', duration: 1000 }) return; } if(!this.data.email){ wx.showToast({ title: '请输入邮箱', icon: 'none', duration: 1000 }) return; } if(!this.data.resumeFile){ wx.showToast({ title: '请上传附件', icon: 'none', duration: 1000 }) return; } var params = { userId:this.data.userId, name:this.data.name, email:this.data.email, mobile:this.data.mobile, birthday:this.data.birthday, gender:this.data.gender, nowAddress:this.data.nowAddress, registeredAddress:this.data.registeredAddress, highestEducation:this.data.highestEducation, learningModality:this.data.learningModality, takeProfessionally:this.data.takeProfessionally, jobStatus:this.data.jobStatus, hopeProfessionally:this.data.hopeProfessionally, nowSalary:this.data.nowSalary, hopeSalary:this.data.hopeSalary, resumeFile:this.data.resumeFile, }; await recruitApi.saveUser(params); if(this.data.type ==2){ await recruitApi.deliveryRecruit(this.data.openId,this.data.recruitsId); wx.showToast({ title: '投递成功', icon: 'success', success:function(){ setTimeout(() => { wx.navigateBack({ delta: 2 }) }, 1000); } }) }else{ wx.showToast({ title: '保存成功', icon: 'success', success:function(){ setTimeout(() => { wx.navigateBack({ delta: 2 }) }, 1000); } }) } } })