You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
3.4 KiB
JavaScript
173 lines
3.4 KiB
JavaScript
// pages/enroll/index.js
|
|
const app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
inputUserName: '',
|
|
phoneNumber:'',
|
|
btnLoading: false,
|
|
jobDetail:{}
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
console.log(app.globalData)
|
|
// console.log(wx.getStorageSync("jobDetailStorageChajian"))
|
|
if (app.isNotEmptyCheck(app.globalData.user.userName)) {
|
|
// this.data.inputUserName = app.globalData.user.userName;
|
|
this.setData({
|
|
inputUserName: app.globalData.user.userName,
|
|
});
|
|
}
|
|
if (app.isNotEmptyCheck(app.globalData.loginUserInfo.tel)) {
|
|
// this.data.phoneNumber = app.globalData.loginUserInfo.tel;
|
|
this.setData({
|
|
phoneNumber: app.globalData.loginUserInfo.tel
|
|
});
|
|
}
|
|
},
|
|
bindinputUserName(e) {
|
|
console.log(e)
|
|
},
|
|
getJob(e){
|
|
console.log(e.detail)
|
|
this.setData({
|
|
jobDetail:e.detail
|
|
})
|
|
},
|
|
onSubmit(e) {
|
|
console.log(e);
|
|
var that = this;
|
|
that.setData({
|
|
btnLoading: true
|
|
});
|
|
if (e.detail.value.userName == '') {
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: "请输入姓名",
|
|
duration: 3000
|
|
});
|
|
that.setData({
|
|
btnLoading: false
|
|
});
|
|
return;
|
|
}
|
|
var myreg = /^[1][3456789][0-9]{9}$/;
|
|
if (!myreg.test(e.detail.value.tel) || e.detail.value.tel == "") {
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: "请输入正确手机号",
|
|
duration: 3000
|
|
});
|
|
|
|
that.setData({
|
|
btnLoading: false
|
|
});
|
|
return;
|
|
}
|
|
var formData = {
|
|
userName: e.detail.value.userName,
|
|
tel: e.detail.value.tel,
|
|
applyType:1,
|
|
isCommission:0,
|
|
storeJobId:that.data.jobDetail.storeJob.id
|
|
};
|
|
|
|
wx.request({
|
|
url: app.globalData.ip + "/user/resource/applyJobWX",
|
|
method: "POST",
|
|
header: app.globalData.headers,
|
|
data: formData,
|
|
success: function (res) {
|
|
wx.redirectTo({
|
|
url: "../success/index?applyType=0"
|
|
// + that.data.applyType
|
|
});
|
|
// wx.showToast({
|
|
// icon: "success",
|
|
// title: "报名成功",
|
|
// duration: 3000,
|
|
// success(){
|
|
// that.setData({
|
|
// inputUserName:'',
|
|
// phoneNumber:'',
|
|
// btnLoading: false
|
|
// })
|
|
// }
|
|
// });
|
|
}
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
getPhoneNumber(e) {
|
|
var that = this;
|
|
console.log(e.detail.code) // 动态令牌
|
|
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
|
|
console.log(e.detail.errno) // 错误码(失败时返回)
|
|
if ("getPhoneNumber:ok" == e.detail.errMsg) { //同意
|
|
|
|
|
|
} else { //拒绝
|
|
console.log("拒绝获取手机号====");
|
|
|
|
}
|
|
return false;
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |