|
|
|
|
@ -1,6 +1,15 @@
|
|
|
|
|
const app = getApp();
|
|
|
|
|
const mydate = new Date();
|
|
|
|
|
var dateUtil = require("../../utils/dateUtil.js");
|
|
|
|
|
var dateTimePicker = require("../../utils/dateTimePicker.js");
|
|
|
|
|
Component({
|
|
|
|
|
data: {
|
|
|
|
|
dateTime: "",
|
|
|
|
|
currentTime: dateUtil.formatDateYMD(mydate.toLocaleDateString()),
|
|
|
|
|
copyTime: dateUtil.formatDateYMD(mydate.toLocaleDateString()),
|
|
|
|
|
sex: 1,
|
|
|
|
|
ageArray: [],
|
|
|
|
|
ageIndex: -1,
|
|
|
|
|
morePeople: false,
|
|
|
|
|
recordList: [
|
|
|
|
|
{
|
|
|
|
|
@ -73,9 +82,187 @@ Component({
|
|
|
|
|
type: Boolean,
|
|
|
|
|
value: true
|
|
|
|
|
},
|
|
|
|
|
info: {
|
|
|
|
|
type: Object,
|
|
|
|
|
value: {},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
ready () {
|
|
|
|
|
let that = this;
|
|
|
|
|
console.log(this.data.info);
|
|
|
|
|
for (let i = 16; i < 70; i++) {
|
|
|
|
|
that.data.ageArray.push(i);
|
|
|
|
|
}
|
|
|
|
|
this.setData({
|
|
|
|
|
ageArray: that.data.ageArray
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let hour = new Date().getHours();
|
|
|
|
|
if (hour < 20 && hour >= 6) {
|
|
|
|
|
if (that.data.currentTime == that.data.copyTime) {
|
|
|
|
|
that.data.currentTime = that.data.currentTime + " " + (hour + 1) + ":00";
|
|
|
|
|
}
|
|
|
|
|
} else if (hour >= 20) {
|
|
|
|
|
if (that.data.currentTime == that.data.copyTime) {
|
|
|
|
|
that.data.currentTime = that.data.currentTime + " " + "19:30";
|
|
|
|
|
}
|
|
|
|
|
} else if (hour < 6) {
|
|
|
|
|
if (that.data.currentTime == that.data.copyTime) {
|
|
|
|
|
that.data.currentTime = that.data.currentTime + " " + "6:00";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setData({
|
|
|
|
|
currentTime: that.data.currentTime,
|
|
|
|
|
});
|
|
|
|
|
var obj = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear, this.data.currentTime);
|
|
|
|
|
console.log(obj);
|
|
|
|
|
console.log(obj.dateTimeArray);
|
|
|
|
|
for (let index = 0; index < obj.dateTimeArray[0].length; index++) {
|
|
|
|
|
obj.dateTimeArray[0][index] = obj.dateTimeArray[0][index] + "年";
|
|
|
|
|
}
|
|
|
|
|
for (let index = 0; index < obj.dateTimeArray[1].length; index++) {
|
|
|
|
|
obj.dateTimeArray[1][index] = obj.dateTimeArray[1][index] + "月";
|
|
|
|
|
}
|
|
|
|
|
for (let index = 0; index < obj.dateTimeArray[2].length; index++) {
|
|
|
|
|
obj.dateTimeArray[2][index] = obj.dateTimeArray[2][index] + "日";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
dateTimeArray: obj.dateTimeArray,
|
|
|
|
|
dateTime: obj.dateTime,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
changeDateTime (e) {
|
|
|
|
|
var dateTimeArray = this.data.dateTimeArray,
|
|
|
|
|
dateTime = e.detail.value;
|
|
|
|
|
this.setData({
|
|
|
|
|
// dateTime: e.detail.value,
|
|
|
|
|
currentTime: dateTimeArray[0][dateTime[0]].replace("年", "") + "-" + dateTimeArray[1][dateTime[1]].replace("月", "") + "-" + dateTimeArray[2][dateTime[2]].replace("日", "") + " " + dateTimeArray[3][dateTime[3]],
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
changeDateTimeColumn (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
console.log(e.detail.value);
|
|
|
|
|
console.log(e.detail.column);
|
|
|
|
|
var arr = this.data.dateTime,
|
|
|
|
|
dateArr = this.data.dateTimeArray;
|
|
|
|
|
console.log(arr);
|
|
|
|
|
console.log(dateArr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arr[e.detail.column] = e.detail.value;
|
|
|
|
|
console.log(dateArr[0][arr[0]], dateArr[1][arr[1]]);
|
|
|
|
|
|
|
|
|
|
dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]]);
|
|
|
|
|
for (let index = 0; index < dateArr[2].length; index++) {
|
|
|
|
|
dateArr[2][index] = dateArr[2][index] + "日";
|
|
|
|
|
}
|
|
|
|
|
// .replace("年",'').replace("月",'').replace("日",'')
|
|
|
|
|
this.setData({
|
|
|
|
|
dateTimeArray: dateArr,
|
|
|
|
|
dateTime: arr,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
bindPickerChangeAge (e) {
|
|
|
|
|
this.setData({
|
|
|
|
|
ageIndex: e.detail.value,
|
|
|
|
|
["userInfo.age"]: parseInt(e.detail.value) + 16,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
formSubmit(e) {
|
|
|
|
|
let that = this;
|
|
|
|
|
console.log(e.detail.value);
|
|
|
|
|
if(e.detail.value.userName == ""){
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请输入姓名",
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(e.detail.value.tel == ""){
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请输入手机号",
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var reg = /^1[3|4|5|6|9|7|8][0-9]\d{8}$/;
|
|
|
|
|
if(reg.test(e.detail.value.tel) == false){
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请输入正确的手机号",
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(that.data.info.agencyOperation == 2){
|
|
|
|
|
if(that.data.ageIndex == -1){
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请选择年龄",
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
e.detail.value.age = parseInt(that.data.ageIndex) + 16;
|
|
|
|
|
e.detail.value.sex = that.data.sex;
|
|
|
|
|
}else{
|
|
|
|
|
if(e.detail.value.idCard == ""){
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请输入身份证号",
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
|
|
|
|
if(regIdCard.test(e.detail.value.idCard) == false){
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "请输入正确的身份证号",
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e.detail.value.interviewTimeStr = that.data.currentTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
e.detail.value.jobId = that.data.info.id
|
|
|
|
|
console.log('form发生了submit事件,携带数据为:', e.detail.value)
|
|
|
|
|
wx.request({
|
|
|
|
|
url: app.globalData.ip + '/yishoudan/common/order/add',
|
|
|
|
|
data: e.detail.value,
|
|
|
|
|
header: app.globalData.headers,
|
|
|
|
|
method: "POST",
|
|
|
|
|
success: function (res) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.data.status == 200) {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: "报名成功",
|
|
|
|
|
})
|
|
|
|
|
that.setData({
|
|
|
|
|
show: false,
|
|
|
|
|
ageIndex:-1
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
icon: "none",
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 阻止滑动穿透
|
|
|
|
|
*
|
|
|
|
|
@ -131,9 +318,9 @@ Component({
|
|
|
|
|
},
|
|
|
|
|
hideLeft () {
|
|
|
|
|
// this.data.show = false
|
|
|
|
|
// this.setData({
|
|
|
|
|
// show: false
|
|
|
|
|
// })
|
|
|
|
|
this.setData({
|
|
|
|
|
ageIndex: -1
|
|
|
|
|
})
|
|
|
|
|
var eventDetail = {
|
|
|
|
|
type: this.data.drawerType
|
|
|
|
|
};
|
|
|
|
|
|