|
|
|
|
|
|
|
|
|
|
|
const app = getApp();
|
|
|
|
|
|
const commonUtil = require("../../utils/commonUtil.js");
|
|
|
|
|
|
|
|
|
|
|
|
var inter;
|
|
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
|
data: {
|
|
|
|
|
|
// array: ['服务员1', '服务员2', '服务员3', '服务员4'],
|
|
|
|
|
|
hopeJobList: [],
|
|
|
|
|
|
//期望职位列表
|
|
|
|
|
|
hopeJobListIndex: -1,
|
|
|
|
|
|
applyType: 0,
|
|
|
|
|
|
//申请标识,0预约,1报名
|
|
|
|
|
|
jobDetail: {},
|
|
|
|
|
|
phoneNumber: '',
|
|
|
|
|
|
//职位详情
|
|
|
|
|
|
btnLoading: false,
|
|
|
|
|
|
sendTime: '获取验证码',
|
|
|
|
|
|
sendColor: '#fe633f',
|
|
|
|
|
|
snsMsgWait:60,
|
|
|
|
|
|
showMsgCode: true,
|
|
|
|
|
|
msgCode: '',
|
|
|
|
|
|
disabled: 0, //0不可点
|
|
|
|
|
|
_num: 0,
|
|
|
|
|
|
sex:-1,
|
|
|
|
|
|
tapFlag:true, //点击手机号倒计时变红
|
|
|
|
|
|
iosDialog1: false,
|
|
|
|
|
|
iosDialog2: false,
|
|
|
|
|
|
canInputTel: false,
|
|
|
|
|
|
inputShowed: true,
|
|
|
|
|
|
inputTel: '',
|
|
|
|
|
|
wxCode: '',
|
|
|
|
|
|
canCommit: false,
|
|
|
|
|
|
inputUserName: '',
|
|
|
|
|
|
},
|
|
|
|
|
|
onShow:function(){
|
|
|
|
|
|
// this.openIOS2();
|
|
|
|
|
|
|
|
|
|
|
|
if (app.globalData.isLogin) {
|
|
|
|
|
|
this.data.canInputTel = true;
|
|
|
|
|
|
this.data.inputTel = app.globalData.loginUserInfo.tel;
|
|
|
|
|
|
this.data.canCommit = true;
|
|
|
|
|
|
if (app.isNotEmptyCheck(app.globalData.user.userName)) {
|
|
|
|
|
|
this.data.inputUserName = app.globalData.user.userName;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.wxLogin();
|
|
|
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
isLogin: app.globalData.isLogin,
|
|
|
|
|
|
hasUserInfo: app.globalData.hasUserInfo,
|
|
|
|
|
|
canInputTel: this.data.canInputTel,
|
|
|
|
|
|
canCommit: this.data.canCommit,
|
|
|
|
|
|
inputUserName: this.data.inputUserName,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
wxLogin() {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
wx.login({
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
if (res.code) {
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
wxCode: res.code
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.log('获取code失败!' + res.errMsg)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
getPhoneNumber(e) {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
console.log(e)
|
|
|
|
|
|
console.log(e.detail.errMsg)
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(e);
|
|
|
|
|
|
// console.log(e.detail.errMsg)
|
|
|
|
|
|
// console.log(e.detail.iv)
|
|
|
|
|
|
// console.log(e.detail.encryptedData)
|
|
|
|
|
|
if ("getPhoneNumber:ok" == e.detail.errMsg) { //同意
|
|
|
|
|
|
var iv = e.detail.iv;
|
|
|
|
|
|
var encryptedData = e.detail.encryptedData;
|
|
|
|
|
|
wx.checkSession({
|
|
|
|
|
|
success() {
|
|
|
|
|
|
//session_key 未过期,并且在本生命周期一直有效
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + '/getWechatTel',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
code: that.data.wxCode,
|
|
|
|
|
|
iv: iv,
|
|
|
|
|
|
encryptedData: encryptedData,
|
|
|
|
|
|
},
|
|
|
|
|
|
success: function(res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
|
|
|
|
|
|
promise.then(res => {
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
isLogin: app.globalData.isLogin,
|
|
|
|
|
|
phoneNumber: app.globalData.loginUserInfo.tel,
|
|
|
|
|
|
canInputTel: true,
|
|
|
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: function(res) {
|
|
|
|
|
|
console.log("获取用户手机号错误");
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
fail() {
|
|
|
|
|
|
// session_key 已经失效,需要重新执行登录流程
|
|
|
|
|
|
wx.login({
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
if (res.code) {
|
|
|
|
|
|
console.log(res.code);
|
|
|
|
|
|
//发起网络请求
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + '/getWechatTel',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
code: res.code,
|
|
|
|
|
|
iv: iv,
|
|
|
|
|
|
encryptedData: encryptedData,
|
|
|
|
|
|
},
|
|
|
|
|
|
success: function(res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
app.globalData.openId = res.data.data.openId;
|
|
|
|
|
|
let promise = app.setLoginUserTokenInfo(res.data.data.phoneNumber, null);
|
|
|
|
|
|
var collected = e.currentTarget.dataset.collected;
|
|
|
|
|
|
if (collected) {
|
|
|
|
|
|
promise.then(res => {
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
isLogin: app.globalData.isLogin
|
|
|
|
|
|
});
|
|
|
|
|
|
that.doCollected(collected, e.currentTarget.dataset.jobid);
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
|
url: "../enroll/index?applyType=1&tel=" + res.data.data.phoneNumber
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: function(res) {
|
|
|
|
|
|
console.log("获取用户手机号错误");
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.log('获取手机号失败!' + res.errMsg)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
} else { //拒绝
|
|
|
|
|
|
console.log("拒绝获取手机号====");
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
canInputTel: true,
|
|
|
|
|
|
inputShowed: true,
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
},
|
|
|
|
|
|
close: function () {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
iosDialog1: false,
|
|
|
|
|
|
iosDialog2: false,
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
closeInputCode: function () {
|
|
|
|
|
|
var telNum = '';
|
|
|
|
|
|
if (app.isNotEmptyCheck(app.globalData.loginUserInfo.tel)) {
|
|
|
|
|
|
telNum = app.globalData.loginUserInfo.tel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
iosDialog1: false,
|
|
|
|
|
|
iosDialog2: false,
|
|
|
|
|
|
phoneNumber: telNum,
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
openIOS1: function() {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
iosDialog1: true
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
openIOS2: function() {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
clearInterval(inter);
|
|
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
iosDialog2: true,
|
|
|
|
|
|
|
|
|
|
|
|
msgCode: '',
|
|
|
|
|
|
|
|
|
|
|
|
sendColor: '#ccc',
|
|
|
|
|
|
sendTime: '60秒',
|
|
|
|
|
|
snsMsgWait:60,
|
|
|
|
|
|
smsFlag: false
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.sendCode();
|
|
|
|
|
|
},
|
|
|
|
|
|
showCha: function (e) {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
msgCode: e.detail.value
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
bindinputUserName: function (e) {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
inputUserName: e.detail.value
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
checkCodeAndLogin: function () {
|
|
|
|
|
|
|
|
|
|
|
|
app.load("校验中...");
|
|
|
|
|
|
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
console.log(this.data.inputTel)
|
|
|
|
|
|
|
|
|
|
|
|
if (this.data.msgCode == '') {
|
|
|
|
|
|
app.hideLoad();
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
title: '验证码不能为空',
|
|
|
|
|
|
duration: 2000
|
|
|
|
|
|
})
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var channelContactId = '';
|
|
|
|
|
|
try {
|
|
|
|
|
|
var value = wx.getStorageSync('fromQrCodeChannelContactId')
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
console.log("fromQrCodeChannelContactId:======", value);
|
|
|
|
|
|
channelContactId = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log("获取缓存设置的参数错误:", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
var agencyUserId = '';
|
|
|
|
|
|
try {
|
|
|
|
|
|
var value = wx.getStorageSync('storageSyncAgencyUserId')
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
console.log("storageSyncAgencyUserId======", value);
|
|
|
|
|
|
agencyUserId = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log("获取缓存设置的参数错误:", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + '/registerOrLoginByTel',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
tel: that.data.inputTel,
|
|
|
|
|
|
code: that.data.msgCode,
|
|
|
|
|
|
channelContactId: channelContactId,
|
|
|
|
|
|
agencyUserId: agencyUserId,
|
|
|
|
|
|
autoLoginTag: -1,
|
|
|
|
|
|
},
|
|
|
|
|
|
header: {
|
|
|
|
|
|
'content-type': 'application/json'
|
|
|
|
|
|
},
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
app.hideLoad();
|
|
|
|
|
|
|
|
|
|
|
|
console.log(res.data);
|
|
|
|
|
|
|
|
|
|
|
|
if (res.data.status == 200) {
|
|
|
|
|
|
app.globalData.sessionId = res.data.data.sessionId;
|
|
|
|
|
|
app.globalData.headers.Cookie = 'JSESSIONID=' + res.data.data.sessionId;
|
|
|
|
|
|
app.globalData.headers2.Cookie = 'JSESSIONID=' + res.data.data.sessionId;
|
|
|
|
|
|
app.globalData.isLogin = true;
|
|
|
|
|
|
app.globalData.agencyStatus = res.data.data.agencyStatus;
|
|
|
|
|
|
app.globalData.hasUserInfo = res.data.data.imgSrc != '' && res.data.data.imgSrc != null && res.data.data.imgSrc != undefined && res.data.data.nickName != '' && res.data.data.nickName != null && res.data.data.nickName != undefined ? 1 : 0,
|
|
|
|
|
|
app.globalData.loginUserInfo = res.data.data;
|
|
|
|
|
|
//登录设置缓存
|
|
|
|
|
|
app.globalData.userLoginTokenInfo.tel = res.data.data.tel;
|
|
|
|
|
|
app.globalData.userLoginTokenInfo.token = null;
|
|
|
|
|
|
|
|
|
|
|
|
wx.setStorageSync('loginUserTokenInfo', app.globalData.userLoginTokenInfo);
|
|
|
|
|
|
|
|
|
|
|
|
console.log(111);
|
|
|
|
|
|
|
|
|
|
|
|
that.close();
|
|
|
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
isLogin: true,
|
|
|
|
|
|
canInputTel: true,
|
|
|
|
|
|
canCommit: true,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
|
duration: 2000
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
//console.log('form发生了submit事件,携带数据为:', e.detail.value)
|
|
|
|
|
|
},
|
|
|
|
|
|
inputBlur:function(e){
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
var myreg = /^[1][3456789][0-9]{9}$/;
|
|
|
|
|
|
console.log(e.detail.value);
|
|
|
|
|
|
that.data.inputTel = e.detail.value;
|
|
|
|
|
|
|
|
|
|
|
|
if(myreg.test(e.detail.value)){
|
|
|
|
|
|
|
|
|
|
|
|
if (app.globalData.isLogin) {
|
|
|
|
|
|
if (app.globalData.loginUserInfo.tel != that.data.inputTel) {
|
|
|
|
|
|
that.addUserResourceAfterInputTel();
|
|
|
|
|
|
this.openIOS2();
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
that.addUserResourceAfterInputTel();
|
|
|
|
|
|
this.openIOS2();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
duration: 2000,
|
|
|
|
|
|
title: '手机号格式不正确',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
mask: true
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
showCha: function (e) {
|
|
|
|
|
|
|
|
|
|
|
|
var myreg = /^[1][3456789][0-9]{9}$/;
|
|
|
|
|
|
if (e.target.dataset.tel == 1) {
|
|
|
|
|
|
if (myreg.test(e.detail.value) && this.data.tapFlag) {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
disabled: 1,
|
|
|
|
|
|
phoneNumber: e.detail.value
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
disabled: 0
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
msgCode: e.detail.value
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e.detail.value.length > 0) {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
_num: e.target.dataset.num,
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
_num: 0,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
sendCode: function () {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
// 60秒后重新获取验证码
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + '/commons/sendMsgCode',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
// tel: that.data.phoneNumber
|
|
|
|
|
|
tel: that.data.inputTel
|
|
|
|
|
|
},
|
|
|
|
|
|
header: app.globalData.headers,
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log("发送短信验证码");
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
if (res.data.status == 200) {
|
|
|
|
|
|
// app.globalData.headers.Cookie = 'JSESSIONID=' + res.data.data.sessionId;
|
|
|
|
|
|
// app.globalData.headers2.Cookie = 'JSESSIONID=' + res.data.data.sessionId;
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
smsFlag: true,
|
|
|
|
|
|
sendColor: '#cccccc',
|
|
|
|
|
|
sendTime: that.data.snsMsgWait + '秒',
|
|
|
|
|
|
snsMsgWait: that.data.snsMsgWait - 1,
|
|
|
|
|
|
disabled: 0,
|
|
|
|
|
|
});
|
|
|
|
|
|
inter = setInterval(function () {
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
smsFlag: true,
|
|
|
|
|
|
sendColor: '#cccccc',
|
|
|
|
|
|
sendTime: that.data.snsMsgWait + '秒',
|
|
|
|
|
|
snsMsgWait: that.data.snsMsgWait - 1
|
|
|
|
|
|
});
|
|
|
|
|
|
if (that.data.snsMsgWait < 0) {
|
|
|
|
|
|
clearInterval(inter)
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
sendColor: '#ff0000',
|
|
|
|
|
|
sendTime: '重新获取',
|
|
|
|
|
|
snsMsgWait: 60,
|
|
|
|
|
|
smsFlag: false,
|
|
|
|
|
|
disabled: 1,
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}.bind(that), 1000);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
|
duration: 2000
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
checkMsgCode: function (formData) {
|
|
|
|
|
|
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
// if (this.data.phoneNumber == '') {
|
|
|
|
|
|
if (this.data.inputTel == '') {
|
|
|
|
|
|
that.showTips('手机号码不能为空');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
/*if(this.data.showMsgCode) {//需要填写验证码时,才验证
|
|
|
|
|
|
if (this.data.msgCode == '') {
|
|
|
|
|
|
that.showTips('验证码不能为空');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + '/commons/validateMsgCode',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
tel: that.data.phoneNumber,
|
|
|
|
|
|
code: that.data.msgCode,
|
|
|
|
|
|
},
|
|
|
|
|
|
header: app.globalData.headers,
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
if (res.data.status == 200) {
|
|
|
|
|
|
that.doSubmit(formData);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
that.showTips(res.data.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
that.doSubmit(formData);
|
|
|
|
|
|
}*/
|
|
|
|
|
|
that.doSubmit(formData);
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
showTips(_title) {
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
duration: 2000,
|
|
|
|
|
|
title: _title,
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
mask: true
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad(query) {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
wx.setStorageSync({
|
|
|
|
|
|
key: "storeJobId",
|
|
|
|
|
|
data: -1
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.data.applyType = query.applyType;
|
|
|
|
|
|
console.log(this.data.applyType);
|
|
|
|
|
|
// this.data.phoneNumber = query.tel != undefined ? query.tel : '';
|
|
|
|
|
|
this.data.phoneNumber = app.globalData.loginUserInfo.tel;
|
|
|
|
|
|
console.log(this.data.jobDetail);
|
|
|
|
|
|
|
|
|
|
|
|
if (this.data.applyType == 1) {
|
|
|
|
|
|
that.data.jobDetail = wx.getStorageSync("jobDetailStorage");
|
|
|
|
|
|
console.log(that.data.jobDetail);
|
|
|
|
|
|
if(app.isEmptyCheck(that.data.jobDetail.districtStr)){
|
|
|
|
|
|
that.data.jobDetail.districtStr = that.data.jobDetail.district;
|
|
|
|
|
|
}
|
|
|
|
|
|
// that.data.jobDetail["salaryClassifyValue"] = commonUtil.getSalaryClassifyValue(that.data.jobDetail.salaryClassify, that.data.jobDetail.salaryClassify);
|
|
|
|
|
|
// that.data.jobDetail.districtStr = that.data.jobDetail.district;
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
jobDetail:that.data.jobDetail
|
|
|
|
|
|
})
|
|
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
|
|
|
title: "我想报名"
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
|
|
|
title: "预约推荐"
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
applyType: that.data.applyType,
|
|
|
|
|
|
jobDetail: that.data.jobDetail,
|
|
|
|
|
|
phoneNumber: that.data.phoneNumber,
|
|
|
|
|
|
showMsgCode: that.data.phoneNumber != '' ? false : true,
|
|
|
|
|
|
});
|
|
|
|
|
|
//this.getHopeJobLabels();
|
|
|
|
|
|
},
|
|
|
|
|
|
getHopeJobLabels() {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + "/labels/findAllHopeJobLabels?category=4",
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
header: app.globalData.headers,
|
|
|
|
|
|
data: {},
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
hopeJobList: res.data.data
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: function (res) {
|
|
|
|
|
|
console.log("获取期望职位错误");
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
bindPickerChange(e) {
|
|
|
|
|
|
console.log("picker发送选择改变,携带值为", e.detail.value);
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
hopeJobListIndex: e.detail.value
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
changeSex(e){
|
|
|
|
|
|
var sex = e.currentTarget.dataset.sex;
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
sex: sex
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onSubmit(e) {
|
|
|
|
|
|
console.log(e);
|
|
|
|
|
|
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
btnLoading: true
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (e.detail.value.tel == '') {
|
|
|
|
|
|
that.showTips('你尚未验证手机号,不能报名');
|
|
|
|
|
|
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 = e.detail.value;
|
|
|
|
|
|
formData["applyType"] = that.data.applyType;
|
|
|
|
|
|
// formData["sex"] = that.data.sex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (that.data.applyType == 1) {
|
|
|
|
|
|
formData["storeJobId"] = that.data.jobDetail.id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log(formData);
|
|
|
|
|
|
that.checkMsgCode(formData);
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onSubmitAfterGetUserInfo() {
|
|
|
|
|
|
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
btnLoading: true
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (that.data.inputTel == '') {
|
|
|
|
|
|
that.showTips('你尚未验证手机号,不能报名');
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
btnLoading: false
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var myreg = /^[1][3456789][0-9]{9}$/;
|
|
|
|
|
|
if (!myreg.test(that.data.inputTel) || that.data.inputTel == "") {
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
title: "请输入正确手机号",
|
|
|
|
|
|
duration: 3000
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
btnLoading: false
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var formData = {
|
|
|
|
|
|
userName: that.data.inputUserName,
|
|
|
|
|
|
tel: that.data.inputTel,
|
|
|
|
|
|
};
|
|
|
|
|
|
formData["applyType"] = that.data.applyType;
|
|
|
|
|
|
// formData["sex"] = that.data.sex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (that.data.applyType == 1) {
|
|
|
|
|
|
formData["storeJobId"] = that.data.jobDetail.id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log(formData);
|
|
|
|
|
|
that.checkMsgCode(formData);
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
doSubmit(formData) {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
var value = wx.getStorageSync('fromQrCodeChannelContactId')
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
console.log("fromQrCodeChannelContactId:======", value);
|
|
|
|
|
|
formData['channelContactId'] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log("获取缓存设置的参数错误:", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
|
|
|
var value = wx.getStorageSync('storageSyncAgencyUserId')
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
console.log("storageSyncAgencyUserId======", value);
|
|
|
|
|
|
formData['agencyUserId'] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log("获取缓存设置的参数错误:", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
formData['isCommission'] = app.globalData.isCommission;
|
|
|
|
|
|
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + "/user/resource/applyJobWX",
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
header: app.globalData.headers,
|
|
|
|
|
|
data: formData,
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
|
|
|
|
|
|
if (res.data.status == 200) {
|
|
|
|
|
|
if (res.data.data.doLogin == 0) {
|
|
|
|
|
|
app.setLoginUserTokenInfo(formData.tel, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (app.isNotEmptyCheck(formData.userName)) {//报名之后把用户名修改了,设置一下前端缓存的用户名
|
|
|
|
|
|
app.globalData.user.userName = formData.userName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wx.redirectTo({
|
|
|
|
|
|
url: "../success/index?applyType=" + that.data.applyType
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
|
duration: 2000
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
btnLoading: false
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
addUserResourceAfterInputTel() {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
var formData = {
|
|
|
|
|
|
applyType: 1,
|
|
|
|
|
|
sourceFrom: 19,
|
|
|
|
|
|
tel: that.data.inputTel,
|
|
|
|
|
|
};
|
|
|
|
|
|
that.addOneRecord(formData);
|
|
|
|
|
|
},
|
|
|
|
|
|
addUserResourceAfterGetWXUserInfoRefuse() {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
var formData = {
|
|
|
|
|
|
applyType: 1,
|
|
|
|
|
|
sourceFrom: 20,
|
|
|
|
|
|
tel: that.data.inputTel,
|
|
|
|
|
|
};
|
|
|
|
|
|
that.addOneRecord(formData);
|
|
|
|
|
|
|
|
|
|
|
|
that.openIOS1();
|
|
|
|
|
|
},
|
|
|
|
|
|
addOneRecord(formData) {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
|
|
if (that.data.applyType == 1) {
|
|
|
|
|
|
formData["storeJobId"] = that.data.jobDetail.id;
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
|
|
|
var value = wx.getStorageSync('fromQrCodeChannelContactId')
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
console.log("fromQrCodeChannelContactId:======", value);
|
|
|
|
|
|
formData['channelContactId'] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log("获取缓存设置的参数错误:", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
|
|
|
var value = wx.getStorageSync('storageSyncAgencyUserId')
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
console.log("storageSyncAgencyUserId======", value);
|
|
|
|
|
|
formData['agencyUserId'] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log("获取缓存设置的参数错误:", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + "/user/resource/applyJobWX",
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
header: app.globalData.headers,
|
|
|
|
|
|
data: formData,
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
if (res.data.status == 200) {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
emptyMethod() {
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
getUserInfoBtn: function(e) {
|
|
|
|
|
|
console.log(e)
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
// let type = e.currentTarget.dataset.type;
|
|
|
|
|
|
// var collected = e.currentTarget.dataset.collected;
|
|
|
|
|
|
// var storeJobId = e.currentTarget.dataset.jobid;
|
|
|
|
|
|
// let idx = e.currentTarget.dataset.idx;
|
|
|
|
|
|
// console.log(type)
|
|
|
|
|
|
wx.getUserProfile({
|
|
|
|
|
|
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
|
|
|
success: (res) => {
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
//发起网络请求
|
|
|
|
|
|
wx.request({
|
|
|
|
|
|
url: app.globalData.ip + '/updateUserWechatInfo',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
nickName: res.userInfo.nickName,
|
|
|
|
|
|
avatarUrl: res.userInfo.avatarUrl,
|
|
|
|
|
|
gender: res.userInfo.gender,
|
|
|
|
|
|
country: res.userInfo.country,
|
|
|
|
|
|
province: res.userInfo.province,
|
|
|
|
|
|
city: res.userInfo.city,
|
|
|
|
|
|
},
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
header: app.globalData.headers,
|
|
|
|
|
|
success: function(res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
app.globalData.hasUserInfo = 1;
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
hasUserInfo: 1
|
|
|
|
|
|
})
|
|
|
|
|
|
that.onSubmitAfterGetUserInfo();
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: function(res) {
|
|
|
|
|
|
that.addUserResourceAfterGetWXUserInfoRefuse();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (res) => {
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
that.addUserResourceAfterGetWXUserInfoRefuse();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|