123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- const tools = require('../../utils/tools.js');
- const app = require('../../utils/util.js');
- Page({
- data: {
- jobArr: [],
- jobtext: '请选择',
- kaihutext: '请选择',
- kaihuList: [{
- name: '高中'
- },
- {
- name: '大专'
- },
- {
- name: '本科'
- },
- {
- name: '硕士'
- },
- ],
- kaihuindex: 0,
- nameIsTrue: false, //名字是否填写
- cultureIsTrue: false, //文化是否填写
- graduationIsTrue: false, //毕业学校
- majorIsTrue: false, //所有专业
- postIsTrue: false, //现任职务
- renzhishijianIsTrue: false,
- phoneIsTrue: false, //电话
- peixunshijianTrue: false, // 培训时间
- nameMessage: '',
- tenure: '', //在线时间
- peixunTime: '', //培训时间
- headmasterText: '请选择任职时间', //
- peixunText: '请选择培训时间',
- radio: '1',
- username: 'asdsadsad',
- info: {},
- parameter: [{
- id: 1,
- name: '男',
- value: '0',
- checked: false
- }, {
- id: 2,
- name: '女',
- checked: false,
- value: '1',
- }],
- renzhiDate: '',
- postshow: false,
- postshow1: false,
- errorIsTrue: false,
- currentDate: new Date().getTime(),
- currentDate1: new Date().getTime(),
- minDate: new Date().getTime,
- formatter(type, value) {
- if (type === 'year') {
- return `${value}年`;
- } else if (type === 'month') {
- return `${value}月`;
- }
- return value;
- },
- },
- onChange(event) {
- this.setData({
- radio: event.detail,
- });
- },
- jobChange(e) {
- console.log(e)
- this.setData({
- jobIndex: e.detail.value,
- jobtext: this.data.jobArr[e.detail.value].dictLabel
- })
- },
- share() {
- this.setData({
- show: true
- });
- },
- onClose() {
- this.setData({
- postshow: false
- });
- },
- onClose1() {
- this.setData({
- postshow1: false
- });
- },
- onInput(event) {
- this.setData({
- currentDate: event.detail,
- });
- },
- onInput1(event) {
- this.setData({
- currentDate1: event.detail,
- });
- },
- formatDate(date) {
- date = new Date(date);
- return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
- },
- kaihuListChange(e) {
- console.log(e, "8888888888888")
- this.setData({
- kaihuindex: e.detail.value,
- kaihutext: this.data.kaihuList[e.detail.value].name,
- })
- },
- share1() {
- this.setData({
- postshow: true
- });
- },
- share() {
- this.setData({
- postshow1: true
- });
- },
- formatDate(date) {
- date = new Date(date);
- return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
- },
- onConfirm(event) {
- let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
- this.setData({
- tenure: timeValue,
- postshow: false,
- headmasterText: ''
- });
- },
- onConfirm1(event) {
- let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
- this.setData({
- peixunTime: timeValue,
- postshow1: false,
- peixunText: ''
- });
- },
- parameterTap: function (e) {
- let that = this
- let this_checked = e.currentTarget.dataset.id
- let parameterList = this.data.parameter //获取Json数组
- for (let i = 0; i < parameterList.length; i++) {
- if (parameterList[i].id == this_checked) {
- parameterList[i].checked = true; //当前点击的位置为true即选中
- } else {
- parameterList[i].checked = false; //其他的位置为false
- }
- }
- that.setData({
- parameter: parameterList
- })
- },
- formSubmit(e) {
- if (!e.detail.value.username) {
- this.setData({
- nameIsTrue: true
- })
- } else {
- this.setData({
- nameIsTrue: false
- })
- }
- let sex = '';
- if (this.data.parameter[0].checked) {
- sex = this.data.parameter[0].name
- this.setData({
- errorIsTrue: false
- })
- } else if (this.data.parameter[1].checked) {
- sex = this.data.parameter[1].name
- this.setData({
- errorIsTrue: false
- })
- } else {
- this.setData({
- errorIsTrue: true
- })
- }
- if (!e.detail.value.work) {
- this.setData({
- workIsTrue: true
- })
- } else {
- this.setData({
- workIsTrue: false
- })
- }
- if (!e.detail.value.culture) {
- this.setData({
- cultureIsTrue: true
- })
- } else {
- this.setData({
- cultureIsTrue: false
- })
- }
- if (!e.detail.value.graduation) {
- this.setData({
- graduationIsTrue: true
- })
- } else {
- this.setData({
- graduationIsTrue: false
- })
- }
- if (!e.detail.value.major) {
- this.setData({
- majorIsTrue: true
- })
- } else {
- this.setData({
- majorIsTrue: false
- })
- }
- if (!e.detail.value.post) {
- this.setData({
- postIsTrue: true
- })
- } else {
- this.setData({
- postIsTrue: false
- })
- }
- if (!e.detail.value.phone) {
- this.setData({
- phoneIsTrue: true
- })
- } else {
- this.setData({
- phoneIsTrue: false
- })
- }
- if (!this.data.tenure) {
- this.setData({
- renzhishijianIsTrue: true
- })
- } else {
- this.setData({
- renzhishijianIsTrue: false
- })
- }
- if (!this.data.peixunTime) {
- this.setData({
- peixunshijianTrue: true
- })
- } else {
- this.setData({
- peixunshijianTrue: false
- })
- }
- console.log(this.data.jobArr,this.data.jobIndex, "55555555")
- e.detail.value.culture = this.data.kaihuList[this.data.kaihuindex].name;
- e.detail.value.studentDuty = this.data.jobtext;
- e.detail.value.tenure = this.data.tenure;
- e.detail.value.sessionKey = this.data.sessionKey;
- let aa = e.detail.value
- console.log(aa, "00000000")
- if (aa.culture && aa.school && aa.studentDuty && aa.tenure && aa.studentDept) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/student/upStudent',
- method: "post",
- data: {
- studentDept: aa.studentDept,
- culture: aa.culture,
- school: aa.school,
- studentDuty: aa.studentDuty,
- tenure: aa.tenure,
- studentPhone: aa.studentPhone,
- sessionKey: this.data.sessionKey,
- mcajor: aa.mcajor,
- },
- success: () => {
- wx.showModal({
- showCancel: false,
- content: '报到成功',
- success() {
- wx.navigateBack({
- delta: 1
- })
- }
- })
- },
- fail: (res) => {
- console.log(res)
- wx.showModal({
- showCancel: false,
- content: '报到失败',
- success() {
- wx.navigateBack({
- delta: 1
- })
- }
- })
- }
- })
- } else {
- wx.showModal({
- showCancel: false,
- content: '请补全除了“所学专业”以外的其他信息'
- })
- }
- },
- timeFormat(date, fmt) {
- let o = {
- "M+": date.getMonth() + 1, //月份
- "d+": date.getDate(), //日
- "h+": date.getHours(), //小时
- "m+": date.getMinutes(), //分
- "s+": date.getSeconds(), //秒
- "q+": Math.floor((date.getMonth() + 3) / 3), //季度
- "S": date.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt))
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (let k in o)
- if (new RegExp("(" + k + ")").test(fmt))
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- },
- getjob(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/student/position',
- method: "get",
- data: {
- sessionKey
- },
- success: (res) => {
- let Arr=[];
- res.data.data.forEach(item => {
- let newdata = {};
- newdata.dictLabel = item.dictLabel;
- Arr.push(newdata);
- });
- this.setData({
- jobArr:Arr
- })
- console.log(this.data.jobArr,'我是新组成的数组')
- }
- })
- },
- onReady: function () {},
- async onLoad() {
- const sessionKey = await tools.checkSessionAndLogin();
- console.log(sessionKey, "000000");
- this.setData({
- sessionKey: sessionKey
- })
- this.getBanner(sessionKey);
- this.getjob(sessionKey)
- },
- getBanner(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/student/selStudentSessionKeyEcho',
- method: "post",
- data: {
- sessionKey: sessionKey,
- },
- success: (res) => {
- console.log(res.data.data.studentDuty)
- if (res.data.code == 0) {
- this.data.parameter.forEach(item => {
- if (item.value == res.data.data.studentSex) {
- item.checked = true;
- }
- })
- this.setData({
- info: res.data.data,
- parameter: this.data.parameter,
- studentDept: res.data.data.studentDept,
- jobtext: res.data.data.studentDuty,
- kaihutext: res.data.data.culture,
- major: res.data.data.major,
- tenure: res.data.data.tenure,
- studentPhone: res.data.data.studentPhone,
- })
- }
- }
- })
- }
- })
|