|
@@ -1,6 +1,7 @@
|
|
|
//index.js
|
|
|
//获取应用实例
|
|
|
-// const app = require('../../utils/util.js');
|
|
|
+const app = require('../../utils/util.js');
|
|
|
+const tools = require('../../utils/tools.js');
|
|
|
Page({
|
|
|
data: {
|
|
|
nameIsTrue: false, //名字是否填写
|
|
@@ -8,31 +9,24 @@ Page({
|
|
|
graduationIsTrue: false, //毕业学校
|
|
|
majorIsTrue: false, //所有专业
|
|
|
postIsTrue: false, //现任职务
|
|
|
- renzhishijianIsTrue :false,
|
|
|
+ renzhishijianIsTrue: false,
|
|
|
phoneIsTrue: false, //电话
|
|
|
- peixunshijianTrue :false, // 培训时间
|
|
|
+ peixunshijianTrue: false, // 培训时间
|
|
|
nameMessage: '',
|
|
|
- zaizhiTime:'',//在线时间
|
|
|
- peixunTime:'', //培训时间
|
|
|
- headmasterText: '请选择任职时间', //
|
|
|
- peixunText:'请选择培训时间',
|
|
|
+ zaizhiTime: [], //在线时间
|
|
|
+ peixunTime: '', //培训时间
|
|
|
+ headmasterText: [], //
|
|
|
+ names: [],
|
|
|
+ timeIndex: '',
|
|
|
+ chooseValue: [], // 选择的答案序列
|
|
|
radio: '1',
|
|
|
- parameter: [{
|
|
|
- id: 1,
|
|
|
- name: '男',
|
|
|
- checked: false
|
|
|
- }, {
|
|
|
- id: 2,
|
|
|
- name: '女',
|
|
|
- checked: false
|
|
|
- }],
|
|
|
renzhiDate: '',
|
|
|
- postshow: false,
|
|
|
+ postshow: [],
|
|
|
postshow1: false,
|
|
|
errorIsTrue: false,
|
|
|
currentDate: new Date().getTime(),
|
|
|
currentDate1: new Date().getTime(),
|
|
|
- minDate: new Date().getTime ,
|
|
|
+ minDate: new Date().getTime,
|
|
|
formatter(type, value) {
|
|
|
if (type === 'year') {
|
|
|
return `${value}年`;
|
|
@@ -41,22 +35,260 @@ Page({
|
|
|
}
|
|
|
return value;
|
|
|
},
|
|
|
+ questionList: [{
|
|
|
+ "QuestType": "6",
|
|
|
+ "Id": 11,
|
|
|
+ name: 'ccccc',
|
|
|
+ QuestStem: '时间选择',
|
|
|
+ QuestAnswer: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "5",
|
|
|
+ "Id": 11,
|
|
|
+ name: 'dddd',
|
|
|
+ QuestStem: '姓名输入',
|
|
|
+ QuestAnswer: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "6",
|
|
|
+ "Id": 11,
|
|
|
+ name: 'username111',
|
|
|
+ QuestStem: '时间2',
|
|
|
+ QuestAnswer: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "5",
|
|
|
+ "Id": 11,
|
|
|
+ name: 'address',
|
|
|
+ QuestStem: '姓名输入',
|
|
|
+ QuestAnswer: ''
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "0",
|
|
|
+ "QuestChoice": [{
|
|
|
+ value: 'USA',
|
|
|
+ name: '美国'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'CHN',
|
|
|
+ name: '中国',
|
|
|
+ checked: 'true'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'BRA',
|
|
|
+ name: '巴西'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'JPN',
|
|
|
+ name: '日本'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'ENG',
|
|
|
+ name: '英国'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'FRA',
|
|
|
+ name: '法国'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ "Id": 36,
|
|
|
+ name: 'sex',
|
|
|
+ QuestStem: '性别单选'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "0",
|
|
|
+ "QuestChoice": [{
|
|
|
+ value: '男',
|
|
|
+ name: '男',
|
|
|
+ checked: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '女',
|
|
|
+ name: '女',
|
|
|
+ checked: false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ "Id": 36,
|
|
|
+ name: 'sex111',
|
|
|
+ QuestStem: '性别单选2222'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "1",
|
|
|
+ "QuestAnswer": "equals ()||\nhashCode()||",
|
|
|
+ "QuestChoice": [{
|
|
|
+ value: 'USA',
|
|
|
+ name: '美国'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'CHN',
|
|
|
+ name: '中国',
|
|
|
+ checked: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'FRA',
|
|
|
+ name: '法国'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "Id": 38,
|
|
|
+ name: 'alls',
|
|
|
+ QuestStem: '多选'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ "QuestType": "2",
|
|
|
+ "QuestStem": "1+1=2",
|
|
|
+ "QuestAnswer": "是",
|
|
|
+ "QuestChoice": [{
|
|
|
+ value: 'USA',
|
|
|
+ name: '是'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'CHN',
|
|
|
+ name: '中国',
|
|
|
+ checked: false
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ "Id": 42,
|
|
|
+ name: 'lllll',
|
|
|
+ QuestStem: '判断1'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "2",
|
|
|
+ "QuestStem": "1+1=2",
|
|
|
+ "QuestAnswer": "是",
|
|
|
+ "QuestChoice": [{
|
|
|
+ value: 'USA',
|
|
|
+ name: '是'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'CHN',
|
|
|
+ name: '中国',
|
|
|
+ checked: false
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ "Id": 42,
|
|
|
+ name: 'lllll',
|
|
|
+ QuestStem: '判断2'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "2",
|
|
|
+ "QuestStem": "1+1=2",
|
|
|
+ "QuestAnswer": "是",
|
|
|
+ "QuestChoice": [{
|
|
|
+ value: 'USA',
|
|
|
+ name: '是'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'CHN',
|
|
|
+ name: '中国',
|
|
|
+ checked: false
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ "Id": 42,
|
|
|
+ name: 'lllll',
|
|
|
+ QuestStem: '判断3'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "QuestType": "3",
|
|
|
+ "QuestStem": "世纪大厦的萨科技的哈市(解答)",
|
|
|
+ "QuestAnswer": "",
|
|
|
+ "QuestChoice": "",
|
|
|
+ "Id": 39,
|
|
|
+ name: 'textarea',
|
|
|
+ },
|
|
|
+
|
|
|
+ ],
|
|
|
+ answersId: '', // 提交答案用到
|
|
|
+ sessionKey: '',
|
|
|
+ paperId: '',
|
|
|
+ answersId: '',
|
|
|
+ id: '',
|
|
|
},
|
|
|
onChange(event) {
|
|
|
this.setData({
|
|
|
radio: event.detail,
|
|
|
});
|
|
|
},
|
|
|
+ radioChange(e) {
|
|
|
+ console.log(e);
|
|
|
+ const items = this.data.questionList[e.currentTarget.dataset.index].QuestChoice
|
|
|
+ for (let i = 0, len = items.length; i < len; ++i) {
|
|
|
+ items[i].checked = items[i].value === e.detail.value
|
|
|
+ }
|
|
|
+
|
|
|
+ let json = {};
|
|
|
+ json.currentAnswer = e.detail.value;
|
|
|
+ json.id = e.currentTarget.dataset.idx;
|
|
|
+ json.questType = e.currentTarget.dataset.questtypes;
|
|
|
+ this.data.chooseValue[e.currentTarget.dataset.index] = json;
|
|
|
+ this.setData({
|
|
|
+ questionList: this.data.questionList
|
|
|
+ })
|
|
|
+ wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
|
|
|
+ wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
|
|
|
+ console.log(this.data.questionList);
|
|
|
+
|
|
|
+ // this.data.questionList[this.data.index].checked = e.detail.value;
|
|
|
+
|
|
|
+ // this.setData({
|
|
|
+ // questionList: this.data.questionList
|
|
|
+ // })
|
|
|
+ // const items = this.data.items
|
|
|
+ // for (let i = 0, len = items.length; i < len; ++i) {
|
|
|
+ // items[i].checked = items[i].value === e.detail.value
|
|
|
+ // }
|
|
|
|
|
|
+ // this.setData({
|
|
|
+ // items
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ checkboxChange(e) {
|
|
|
+ const items = this.data.questionList[e.currentTarget.dataset.index].QuestChoice
|
|
|
+ const values = e.detail.value
|
|
|
+ for (let i = 0, lenI = items.length; i < lenI; ++i) {
|
|
|
+ items[i].checked = false
|
|
|
+ for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
|
|
|
+ if (items[i].value === values[j]) {
|
|
|
+ items[i].checked = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let json = {};
|
|
|
+ let aa = e.detail.value.join("||")
|
|
|
+ json.currentAnswer = aa;
|
|
|
+ json.id = e.currentTarget.dataset.idx;
|
|
|
+ json.questType = e.currentTarget.dataset.questtypes;
|
|
|
+ this.data.chooseValue[e.currentTarget.dataset.index] = json;
|
|
|
+ this.setData({
|
|
|
+ questionList: this.data.questionList
|
|
|
+ })
|
|
|
+ wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
|
|
|
+ wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
|
|
|
+ },
|
|
|
+ bindTextAreaBlur(e) {
|
|
|
+ console.log(e, "hhhhh");
|
|
|
+ console.log(e.detail.value);
|
|
|
+ let json = {};
|
|
|
+ json.currentAnswer = e.detail.value;
|
|
|
+ json.id = e.currentTarget.dataset.idx;
|
|
|
+ json.questType = e.currentTarget.dataset.questtypes;
|
|
|
+ this.data.chooseValue[e.currentTarget.dataset.index] = json;
|
|
|
+ this.data.questionList[e.currentTarget.dataset.index].QuestAnswer = e.detail.value;
|
|
|
+ this.setData({
|
|
|
+ questionList: this.data.questionList
|
|
|
+ })
|
|
|
+ wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
|
|
|
+ wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
|
|
|
+ },
|
|
|
share() {
|
|
|
this.setData({
|
|
|
show: true
|
|
|
});
|
|
|
},
|
|
|
onClose() {
|
|
|
- console.log("11111111111111");
|
|
|
this.setData({
|
|
|
- postshow: false
|
|
|
+ ['postshow[' + this.data.timeIndex + ']']: false,
|
|
|
});
|
|
|
},
|
|
|
onClose1() {
|
|
@@ -66,7 +298,9 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
onInput(event) {
|
|
|
- console.log("000");
|
|
|
+ console.log(event, "8888888");
|
|
|
+
|
|
|
+ console.log("点击了");
|
|
|
this.setData({
|
|
|
currentDate: event.detail,
|
|
|
});
|
|
@@ -83,10 +317,22 @@ Page({
|
|
|
return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
|
|
|
},
|
|
|
|
|
|
- share1() {
|
|
|
+ share1(e) {
|
|
|
+ console.log(e);
|
|
|
+ console.log(e.currentTarget.dataset.index);
|
|
|
+ console.log(e.currentTarget.dataset.names, "8520852085208520");
|
|
|
+ console.log(this.data.postshow[e.currentTarget.dataset.index]);
|
|
|
+ this.data.postshow[e.currentTarget.dataset.index] = true;
|
|
|
+ this.data.names[e.currentTarget.dataset.index] = e.currentTarget.dataset.names;
|
|
|
this.setData({
|
|
|
- postshow: true
|
|
|
- });
|
|
|
+ postshow: this.data.postshow,
|
|
|
+ timeIndex: e.currentTarget.dataset.index
|
|
|
+ })
|
|
|
+ console.log(this.data.postshow, "打印下锕啊啊啊啊锕锕锕");
|
|
|
+
|
|
|
+ // this.setData({
|
|
|
+ // postshow: true
|
|
|
+ // });
|
|
|
},
|
|
|
share() {
|
|
|
this.setData({
|
|
@@ -98,21 +344,34 @@ Page({
|
|
|
return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
|
|
|
},
|
|
|
onConfirm(event) {
|
|
|
- console.log(event, "0000");
|
|
|
+ console.log(event, "1111111");
|
|
|
let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
|
|
|
+ let json = {};
|
|
|
+ json.currentAnswer = timeValue;
|
|
|
+ json.id = event.currentTarget.dataset.idx;
|
|
|
+ json.questType = event.currentTarget.dataset.questtypes;
|
|
|
+ let aa = this.data.chooseValue[event.currentTarget.dataset.index] = json;
|
|
|
+ this.data.questionList[event.currentTarget.dataset.index].QuestAnswer = timeValue;
|
|
|
this.setData({
|
|
|
- zaizhiTime: timeValue,
|
|
|
- postshow :false,
|
|
|
- headmasterText :''
|
|
|
+ questionList: this.data.questionList,
|
|
|
+ ['chooseValue[' + event.currentTarget.dataset.index + ']']: aa,
|
|
|
+ ['postshow[' + this.data.timeIndex + ']']: false,
|
|
|
+ ['headmasterText[' + this.data.timeIndex + ']']: '',
|
|
|
});
|
|
|
+ wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
|
|
|
+ wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
|
|
|
+ console.log(this.data.chooseValue, "确定后的值锕");
|
|
|
+ console.log( this.data.questionList,"789789798789");
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
onConfirm1(event) {
|
|
|
console.log(event, "0000");
|
|
|
let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
|
|
|
this.setData({
|
|
|
peixunTime: timeValue,
|
|
|
- postshow1 :false,
|
|
|
- peixunText :''
|
|
|
+ postshow1: false,
|
|
|
+ peixunText: ''
|
|
|
});
|
|
|
},
|
|
|
parameterTap: function (e) { //e是获取e.currentTarget.dataset.id所以是必备的,跟前端的data-id获取的方式差不多
|
|
@@ -130,124 +389,190 @@ Page({
|
|
|
parameter: parameterList
|
|
|
})
|
|
|
},
|
|
|
+ submitForm() {
|
|
|
+ // let arr1 = this.data.chooseValue.filter(d => d);
|
|
|
+ //console.log(arr1,"打印下提交");
|
|
|
+ console.log(this.data.chooseValue, "打印下提交");
|
|
|
+ this.data.chooseValue.forEach(item => {
|
|
|
+ console.log(item,"123123");
|
|
|
+
|
|
|
+ if (item.currentAnswer) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ console.log(item.QuestStem);
|
|
|
+
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: item.QuestStem + "不能为空",
|
|
|
+ success(res) {}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
+ // wx.request({
|
|
|
+ // url: app.globalData.publicUrl + '/wx/paper/commit',
|
|
|
+ // method: "post",
|
|
|
+ // data: {
|
|
|
+ // sessionKey: this.data.sessionKey,
|
|
|
+ // currentAnswerTemp: arr1,
|
|
|
+ // answersId: wx.getStorageSync('answersId')
|
|
|
+ // },
|
|
|
+ // success: (res) => {
|
|
|
+ // console.log(res);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ },
|
|
|
formSubmit(e) {
|
|
|
console.log(e.detail.value, "000000000000000");
|
|
|
- if (!e.detail.value.username) {
|
|
|
- this.setData({
|
|
|
- nameIsTrue: true
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- nameIsTrue: false
|
|
|
- })
|
|
|
+ let arr1 = this.data.zaizhiTime.filter(d => d);
|
|
|
+ let arr = this.data.names.filter(d => d);
|
|
|
+ var activeSubjectsArr = [];
|
|
|
+ for (var i = 0; i < arr.length; i++) {
|
|
|
+ var activeSubjectsObject = {};
|
|
|
+ for (var j = 0; j < arr1.length; j++) {
|
|
|
+ if (i == j) {
|
|
|
+ activeSubjectsObject[arr[i]] = arr1[j];
|
|
|
+ activeSubjectsArr.push(activeSubjectsObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- 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
|
|
|
- })
|
|
|
+ console.log(activeSubjectsArr, "7777777");
|
|
|
+ let count = 0;
|
|
|
+ let data = {};
|
|
|
+ for (let a in e.detail.value) {
|
|
|
+ count += 1;
|
|
|
+ if (count = 1) {
|
|
|
+ data[a] = e.detail.value[a]
|
|
|
+ }
|
|
|
}
|
|
|
+ activeSubjectsArr.forEach(item => {
|
|
|
+ Object.assign(data, item)
|
|
|
+ })
|
|
|
+ console.log(data, "888888888888888888888888");
|
|
|
+ // Object.keys(data).forEach(function (key) {
|
|
|
+ // if (!data[key]) {
|
|
|
+ // wx.showModal({
|
|
|
+ // showCancel: false,
|
|
|
+ // content: key + "不能为空"
|
|
|
+ // })
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
- if (!e.detail.value.work) {
|
|
|
- this.setData({
|
|
|
- workIsTrue: true
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- workIsTrue: false
|
|
|
- })
|
|
|
- }
|
|
|
+ // });
|
|
|
+ // 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.culture) {
|
|
|
- this.setData({
|
|
|
- cultureIsTrue: true
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- cultureIsTrue: false
|
|
|
- })
|
|
|
- }
|
|
|
+ // if (!e.detail.value.work) {
|
|
|
+ // this.setData({
|
|
|
+ // workIsTrue: true
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.setData({
|
|
|
+ // workIsTrue: false
|
|
|
+ // })
|
|
|
+ // }
|
|
|
|
|
|
- if (!e.detail.value.graduation) {
|
|
|
- this.setData({
|
|
|
- graduationIsTrue: true
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- graduationIsTrue: false
|
|
|
- })
|
|
|
- }
|
|
|
+ // if (!e.detail.value.culture) {
|
|
|
+ // this.setData({
|
|
|
+ // cultureIsTrue: true
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.setData({
|
|
|
+ // cultureIsTrue: false
|
|
|
+ // })
|
|
|
+ // }
|
|
|
|
|
|
- if (!e.detail.value.major) {
|
|
|
- this.setData({
|
|
|
- majorIsTrue: true
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- majorIsTrue: false
|
|
|
- })
|
|
|
- }
|
|
|
+ // if (!e.detail.value.graduation) {
|
|
|
+ // this.setData({
|
|
|
+ // graduationIsTrue: true
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.setData({
|
|
|
+ // graduationIsTrue: 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.zaizhiTime) {
|
|
|
- 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.zaizhiTime,"在职时间000");
|
|
|
- console.log(this.data.peixunTime,"培训时间000");
|
|
|
- console.log(sex,"性别的");
|
|
|
- e.detail.value.zaizhiTime = this.data.zaizhiTime;
|
|
|
- e.detail.value.peixunTime = this.data.peixunTime;
|
|
|
- e.detail.value.sex = sex;
|
|
|
- console.log(e.detail.value,"我是合并后的锕");
|
|
|
-
|
|
|
+ // 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.zaizhiTime) {
|
|
|
+ // 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.zaizhiTime, "在职时间000");
|
|
|
+ // console.log(this.data.peixunTime, "培训时间000");
|
|
|
+ // console.log(sex, "性别的");
|
|
|
+ // e.detail.value.zaizhiTime = this.data.zaizhiTime;
|
|
|
+ // e.detail.value.peixunTime = this.data.peixunTime;
|
|
|
+ // e.detail.value.sex = sex;
|
|
|
+ // console.log(e.detail.value, "我是合并后的锕");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
timeFormat(date, fmt) {
|
|
|
let o = {
|
|
|
"M+": date.getMonth() + 1, //月份
|
|
@@ -267,8 +592,106 @@ Page({
|
|
|
|
|
|
},
|
|
|
onReady: function () {},
|
|
|
- onLoad: function () {
|
|
|
+ onLoad: function (options) {
|
|
|
+ //const sessionKey = await tools.checkSessionAndLogin();
|
|
|
+ const sessionKey = 'yoa0rZTt2bAiTVDsiRjysw==';
|
|
|
+ console.log("onloading.....................");
|
|
|
|
|
|
+
|
|
|
+ let chooceArr = this.data.questionList.map(item => {
|
|
|
+ let json = {};
|
|
|
+ json.currentAnswer = '';
|
|
|
+ json.questType = '';
|
|
|
+ json.id = item.Id;
|
|
|
+ json.QuestStem = item.QuestStem;
|
|
|
+ return json
|
|
|
+ })
|
|
|
+ console.log(chooceArr);
|
|
|
+ this.setData({
|
|
|
+ chooseValue: chooceArr
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ wx.setStorageSync('answersId', options.paperId);
|
|
|
+ this.setData({
|
|
|
+ sessionKey: sessionKey,
|
|
|
+ paperId: options.paperId,
|
|
|
+ answersId: options.answersId,
|
|
|
+ id: options.id,
|
|
|
+ })
|
|
|
+ if (wx.getStorageSync('questionList' + wx.getStorageSync('answersId'))) {
|
|
|
+ console.log("缓村了锕");
|
|
|
+ const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
|
|
|
+ this.setData({
|
|
|
+ questionList: questionList,
|
|
|
+ answersId: wx.getStorageSync('answersId' + wx.getStorageSync('answersId')),
|
|
|
+ chooseValue: wx.getStorageSync('chooseValue' + wx.getStorageSync('answersId')),
|
|
|
+ })
|
|
|
+ console.log(this.data.questionList, "show 缓存的数据");
|
|
|
+ } else {
|
|
|
+ console.log("无缓存");
|
|
|
+ this.allShi(this.data.id, this.data.paperId, this.data.sessionKey);
|
|
|
+ }
|
|
|
},
|
|
|
+ allShi(id, paperId, sessionKey) {
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/wx/paper/detail',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: sessionKey,
|
|
|
+ id: id,
|
|
|
+ paperId: paperId
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ let jsonArr = JSON.parse(res.data.paperContent).map(item => {
|
|
|
+ let json = {};
|
|
|
+ json.QuestType = item.QuestType;
|
|
|
+ json.Id = item.Id;
|
|
|
+ json.QuestAnswer = item.QuestAnswer;
|
|
|
+ json.QuestStem = item.QuestStem;
|
|
|
+ // if (item.QuestChoice) {
|
|
|
+ // let arr = item.QuestChoice.split('||');
|
|
|
+ // json.QuestChoice = arr;
|
|
|
+ // }
|
|
|
+ if (item.QuestType == '1' || item.QuestType == '0') {
|
|
|
+ let arr = item.QuestChoice.split('||');
|
|
|
+ let arrJson = arr.map(item => {
|
|
|
+ let json1 = {};
|
|
|
+ json1.name = item;
|
|
|
+ json1.value = item;
|
|
|
+ json1.checked = false;
|
|
|
+ return json1
|
|
|
+ });
|
|
|
+ json.QuestChoice = arrJson;
|
|
|
+ }
|
|
|
+ return json;
|
|
|
+ })
|
|
|
+
|
|
|
+ // for(let i = 0 ; i<jsonArr.length; i++){
|
|
|
+ // let json = {};
|
|
|
+ // json.currentAnswer = '';
|
|
|
+ // json.questType = '';
|
|
|
+ // json.id = '';
|
|
|
+
|
|
|
+ // }
|
|
|
|
|
|
+ // 答案锕
|
|
|
+ let chooceArr = jsonArr.map(item => {
|
|
|
+ let json = {};
|
|
|
+ json.currentAnswer = '';
|
|
|
+ json.questType = '';
|
|
|
+ json.id = item.Id;
|
|
|
+ json.QuestStem = item.QuestStem;
|
|
|
+ return json
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ questionList: jsonArr,
|
|
|
+ chooseValue: chooceArr
|
|
|
+ })
|
|
|
+ console.log(this.data.questionList, "00000");
|
|
|
+ wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
|
|
|
+ wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), this.data.chooseValue);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
})
|