|
@@ -12,13 +12,14 @@ Page({
|
|
|
nameLast: '', //老师的名字
|
|
|
idNum: '', //身份证号
|
|
|
sex: '', //性别,根据输入的身份证号自动判断
|
|
|
- idImgFontPath: '', //身份证正面照片的地址
|
|
|
- idImgBackPath: '', //身份证背面照片的地址
|
|
|
- diplomaPath:'', //毕业证书照片的地址
|
|
|
- stuCardPath:'', //学生证照片的地址
|
|
|
- headImgPath:'', //头像照片的地址
|
|
|
chosedTeachAttr: '', //老师的身份
|
|
|
showIdAttr: false, //老师的身份选项是否展示
|
|
|
+ teachAttrIndex: '', //选中老师身份的选项索引
|
|
|
+ idImgFontPath: '', //身份证正面照片的地址
|
|
|
+ idImgBackPath: '', //身份证背面照片的地址
|
|
|
+ diplomaPath: '', //毕业证书照片的地址
|
|
|
+ stuCardPath: '', //学生证照片的地址
|
|
|
+ headImgPath: '', //头像照片的地址
|
|
|
shcool: '', //毕业后就读的学校
|
|
|
major: '', //所学专业
|
|
|
chosedEducation: '', //学历
|
|
@@ -27,50 +28,52 @@ Page({
|
|
|
city: '', //籍贯的城市
|
|
|
county: '', //籍贯的区县
|
|
|
// 老师身份列表
|
|
|
- attributeList: [{
|
|
|
- 'attr': '专职老师',
|
|
|
- chosed: false
|
|
|
- },
|
|
|
- {
|
|
|
+ teachAttrList: [{
|
|
|
'attr': '在校大学生',
|
|
|
chosed: false
|
|
|
- }
|
|
|
- ],
|
|
|
- // 学历列表
|
|
|
- educationList: [{
|
|
|
- 'edu': '博士毕业',
|
|
|
- chosed: false
|
|
|
- },
|
|
|
- {
|
|
|
- 'edu': '博士在读',
|
|
|
- chosed: false
|
|
|
- },
|
|
|
- {
|
|
|
- 'edu': '硕士毕业',
|
|
|
- chosed: false
|
|
|
},
|
|
|
{
|
|
|
- 'edu': '硕士在读',
|
|
|
- chosed: false
|
|
|
- },
|
|
|
- {
|
|
|
- 'edu': '本科毕业',
|
|
|
- chosed: false
|
|
|
- },
|
|
|
- {
|
|
|
- 'edu': '本科在读',
|
|
|
- chosed: false
|
|
|
- },
|
|
|
- {
|
|
|
- 'edu': '专科毕业',
|
|
|
- chosed: false
|
|
|
- },
|
|
|
- {
|
|
|
- 'edu': '专科在读',
|
|
|
+ 'attr': '专职老师',
|
|
|
chosed: false
|
|
|
}
|
|
|
+ ],
|
|
|
+ // 老师学历列表
|
|
|
+ educationList: [
|
|
|
+ [{
|
|
|
+ 'edu': '博士在读',
|
|
|
+ chosed: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'edu': '硕士在读',
|
|
|
+ chosed: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'edu': '本科在读',
|
|
|
+ chosed: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'edu': '专科在读',
|
|
|
+ chosed: false
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ [{
|
|
|
+ 'edu': '博士毕业',
|
|
|
+ chosed: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'edu': '硕士毕业',
|
|
|
+ chosed: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'edu': '本科毕业',
|
|
|
+ chosed: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'edu': '专科毕业',
|
|
|
+ chosed: false
|
|
|
+ }
|
|
|
+ ]
|
|
|
]
|
|
|
-
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -121,7 +124,7 @@ Page({
|
|
|
// console.log('idLength:' + idLength)
|
|
|
// console.log(idNumber.charAt(16))
|
|
|
// 判断性别
|
|
|
- if (idLength < 18) {
|
|
|
+ if (idLength != 18) {
|
|
|
this.setData({
|
|
|
sex: ''
|
|
|
})
|
|
@@ -139,6 +142,57 @@ Page({
|
|
|
// console.log(this.data.sex)
|
|
|
},
|
|
|
|
|
|
+ // 选择老师身份属性
|
|
|
+ // 打开老师身份选项区,并重置老师学历为空
|
|
|
+ chooseTeachAttr() {
|
|
|
+ this.setData({
|
|
|
+ showIdAttr: true,
|
|
|
+ chosedEducation: ''
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //老师身份选择
|
|
|
+ onidAttrSelect(e) {
|
|
|
+ // console.log(e)
|
|
|
+ let index = e.currentTarget.dataset.index
|
|
|
+ let teachAttrList = this.data.teachAttrList
|
|
|
+ for (let i = 0; i < teachAttrList.length; i++) {
|
|
|
+ if (i == index) {
|
|
|
+ teachAttrList[i].chosed = !teachAttrList[i].chosed;
|
|
|
+ } else {
|
|
|
+ teachAttrList[i].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ teachAttrList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 定义一个退出选项的方法
|
|
|
+ // 退出老师身份选项的方法
|
|
|
+ hiddenTeachId() {
|
|
|
+ this.setData({
|
|
|
+ showIdAttr: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 老师身份的确定按钮点击事件
|
|
|
+ confirmTeachId() {
|
|
|
+ let teachAttrList = this.data.teachAttrList
|
|
|
+ let index
|
|
|
+ for (let i = 0; i < teachAttrList.length; i++) {
|
|
|
+ if (teachAttrList[i].chosed) {
|
|
|
+ index = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let chosedTeachAttr = teachAttrList[index]?.attr || ''
|
|
|
+ let teachAttrIndex = index
|
|
|
+ // let chosedTeachAttr = teachAttrList[teachAttrList.findIndex(item => item.chosed)]?.attr || ''
|
|
|
+ this.setData({
|
|
|
+ chosedTeachAttr,
|
|
|
+ teachAttrIndex
|
|
|
+ })
|
|
|
+ this.hiddenTeachId()
|
|
|
+ },
|
|
|
+
|
|
|
// 选择身份证的正面照片
|
|
|
chooseIdFront() {
|
|
|
let that = this
|
|
@@ -146,10 +200,10 @@ Page({
|
|
|
count: 1,
|
|
|
mediaType: ['image'],
|
|
|
sourceType: ['album', 'camera'],
|
|
|
- sizeType:['compressed'],
|
|
|
+ sizeType: ['compressed'],
|
|
|
success(res) {
|
|
|
// console.log(res.tempFiles[0].tempFilePath)
|
|
|
- console.log(res.tempFiles[0].size)
|
|
|
+ console.log(res.tempFiles[0].size)
|
|
|
that.setData({
|
|
|
idImgFontPath: res.tempFiles[0].tempFilePath
|
|
|
})
|
|
@@ -167,7 +221,7 @@ Page({
|
|
|
// sizeType:['compressed'],
|
|
|
success(res) {
|
|
|
// console.log(res.tempFiles[0].tempFilePath)
|
|
|
- console.log(res.tempFiles[0].size)
|
|
|
+ console.log(res.tempFiles[0].size)
|
|
|
that.setData({
|
|
|
idImgBackPath: res.tempFiles[0].tempFilePath
|
|
|
})
|
|
@@ -176,7 +230,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 选择毕业证
|
|
|
- chooseDiploma(){
|
|
|
+ chooseDiploma() {
|
|
|
let that = this
|
|
|
wx.chooseMedia({
|
|
|
count: 1,
|
|
@@ -185,7 +239,7 @@ Page({
|
|
|
// sizeType:['compressed'],
|
|
|
success(res) {
|
|
|
// console.log(res.tempFiles[0].tempFilePath)
|
|
|
- console.log(res.tempFiles[0].size)
|
|
|
+ console.log(res.tempFiles[0].size)
|
|
|
that.setData({
|
|
|
diplomaPath: res.tempFiles[0].tempFilePath
|
|
|
})
|
|
@@ -194,7 +248,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 选择学生证
|
|
|
- chooseStuCard(){
|
|
|
+ chooseStuCard() {
|
|
|
let that = this
|
|
|
wx.chooseMedia({
|
|
|
count: 1,
|
|
@@ -203,7 +257,7 @@ Page({
|
|
|
// sizeType:['compressed'],
|
|
|
success(res) {
|
|
|
// console.log(res.tempFiles[0].tempFilePath)
|
|
|
- console.log(res.tempFiles[0].size)
|
|
|
+ console.log(res.tempFiles[0].size)
|
|
|
that.setData({
|
|
|
stuCardPath: res.tempFiles[0].tempFilePath
|
|
|
})
|
|
@@ -211,7 +265,7 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
// 选择头像
|
|
|
- chooseHeadImg(){
|
|
|
+ chooseHeadImg() {
|
|
|
let that = this
|
|
|
wx.chooseMedia({
|
|
|
count: 1,
|
|
@@ -220,7 +274,7 @@ Page({
|
|
|
// sizeType:['compressed'],
|
|
|
success(res) {
|
|
|
// console.log(res.tempFiles[0].tempFilePath)
|
|
|
- console.log(res.tempFiles[0].size)
|
|
|
+ console.log(res.tempFiles[0].size)
|
|
|
that.setData({
|
|
|
headImgPath: res.tempFiles[0].tempFilePath
|
|
|
})
|
|
@@ -228,90 +282,59 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- // 选择老师身份属性
|
|
|
- chooseTeachAttr() {
|
|
|
- this.setData({
|
|
|
- showIdAttr: true
|
|
|
- })
|
|
|
- },
|
|
|
- //老师身份选择
|
|
|
- onidAttrSelect(e) {
|
|
|
- // console.log(e)
|
|
|
- let index = e.currentTarget.dataset.index
|
|
|
- let attributeList = this.data.attributeList
|
|
|
- for (let i = 0; i < attributeList.length; i++) {
|
|
|
- if (i == index) {
|
|
|
- attributeList[i].chosed = !attributeList[i].chosed;
|
|
|
- } else {
|
|
|
- attributeList[i].chosed = false
|
|
|
- }
|
|
|
+ // 老师学历
|
|
|
+ // 打开学历选项区
|
|
|
+ chooseEducation() {
|
|
|
+ if (!this.data.chosedTeachAttr) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请先选择老师身份',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
}
|
|
|
this.setData({
|
|
|
- attributeList
|
|
|
- })
|
|
|
- },
|
|
|
- // 定义一个退出选项的方法
|
|
|
- // 退出老师身份选项的方法
|
|
|
- hiddenTeachId() {
|
|
|
- this.setData({
|
|
|
- showIdAttr: false
|
|
|
+ showEdu: true
|
|
|
})
|
|
|
},
|
|
|
- // 退出学历选项的方法
|
|
|
+ // 定义退出学历选区的方法
|
|
|
hiddenEdu() {
|
|
|
this.setData({
|
|
|
showEdu: false
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- // 老师身份选择确定
|
|
|
- confirmTeachId() {
|
|
|
- let attributeList = this.data.attributeList
|
|
|
- // let index
|
|
|
- // for(let i = 0;i < attributeList.length;i++){
|
|
|
- // if(attributeList.chosed){
|
|
|
- // index = i
|
|
|
- // }
|
|
|
- // }
|
|
|
- // let chosedTeachAttr = attributeList[index].attr
|
|
|
- let chosedTeachAttr = attributeList[attributeList.findIndex(item => item.chosed)]?.attr || ''
|
|
|
- this.setData({
|
|
|
- chosedTeachAttr
|
|
|
- })
|
|
|
- this.hiddenTeachId()
|
|
|
- },
|
|
|
-
|
|
|
- // 学历选择区
|
|
|
- chooseEducation() {
|
|
|
- this.setData({
|
|
|
- showEdu: true
|
|
|
- })
|
|
|
- },
|
|
|
- // 学历选择
|
|
|
+ // 从下拉区选择学历
|
|
|
onEduSelect(e) {
|
|
|
- // console.log(e)
|
|
|
let index = e.currentTarget.dataset.index
|
|
|
let educationList = this.data.educationList
|
|
|
- for (let i = 0; i < educationList.length; i++) {
|
|
|
+ let teachAttrIndex = this.data.teachAttrIndex
|
|
|
+ for (let i = 0; i < educationList[teachAttrIndex].length; i++) {
|
|
|
if (i == index) {
|
|
|
- educationList[i].chosed = !educationList[i].chosed;
|
|
|
+ educationList[teachAttrIndex][i].chosed = !educationList[teachAttrIndex][i].chosed
|
|
|
} else {
|
|
|
- educationList[i].chosed = false
|
|
|
+ educationList[teachAttrIndex][i].chosed = false
|
|
|
}
|
|
|
}
|
|
|
this.setData({
|
|
|
educationList
|
|
|
})
|
|
|
},
|
|
|
- // 学历选择确定
|
|
|
+ // 老师学历确定按钮的点击事件
|
|
|
confirmEdu() {
|
|
|
let educationList = this.data.educationList
|
|
|
- let chosedEducation = educationList[educationList.findIndex(item => item.chosed)]?.edu || ''
|
|
|
+ let teachAttrIndex = this.data.teachAttrIndex
|
|
|
+ let index
|
|
|
+ for (let i = 0; i < educationList[teachAttrIndex].length; i++) {
|
|
|
+ if (educationList[teachAttrIndex][i].chosed) {
|
|
|
+ index = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let chosedEducation = educationList[teachAttrIndex][index]?.edu || ''
|
|
|
this.setData({
|
|
|
chosedEducation
|
|
|
})
|
|
|
this.hiddenEdu()
|
|
|
},
|
|
|
+
|
|
|
// 获取输入的学校名称
|
|
|
getSchool(e) {
|
|
|
this.setData({
|
|
@@ -417,6 +440,50 @@ Page({
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ // 判断身份证照片是否上传
|
|
|
+ let idImgFontPath = this.data.idImgFontPath
|
|
|
+ let idImgBackPath = this.data.idImgBackPath
|
|
|
+ if (!idImgFontPath || !idImgBackPath) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '身份证照片未传',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断毕业证或学生证是否上传
|
|
|
+ // 判断学生证是否上传
|
|
|
+ let teachAttrIndex = this.data.teachAttrIndex
|
|
|
+ let stuCardPath = this.data.stuCardPath
|
|
|
+ let diplomaPath = this.data.diplomaPath
|
|
|
+ if(teachAttrIndex == 0){
|
|
|
+ if(!stuCardPath){
|
|
|
+ wx.showToast({
|
|
|
+ title: '学生证未上传',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ this.setData({
|
|
|
+ diplomaPath:''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 判断毕业证是否上传
|
|
|
+ if(teachAttrIndex == 1){
|
|
|
+ if(!diplomaPath){
|
|
|
+ wx.showToast({
|
|
|
+ title: '毕业证未上传',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ this.setData({
|
|
|
+ stuCardPath:''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 判断学校是否为空
|
|
|
let school = this.data.school
|
|
|
if (!school) {
|
|
@@ -445,24 +512,7 @@ Page({
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- if (chosedTeachAttr == '专职老师') {
|
|
|
- if (chosedEducation == '博士在读' || chosedEducation == '硕士在读' || chosedEducation == '本科在读' || chosedEducation == '专科在读') {
|
|
|
- wx.showToast({
|
|
|
- title: '学历与身份不符',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- if (chosedTeachAttr == '在校大学生') {
|
|
|
- if (chosedEducation == '博士毕业' || chosedEducation == '硕士毕业' || chosedEducation == '本科毕业' || chosedEducation == '专科毕业') {
|
|
|
- wx.showToast({
|
|
|
- title: '学历与身份不符',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
// 判断籍贯是否为空
|
|
|
// 判断省份是否为空
|
|
|
let province = this.data.province
|
|
@@ -501,6 +551,10 @@ Page({
|
|
|
idNum: this.data.idNum,
|
|
|
sex: this.data.sex,
|
|
|
chosedTeachAttr: this.data.chosedTeachAttr,
|
|
|
+ idImgFontPath: this.data.idImgFontPath,
|
|
|
+ idImgBackPath: this.data.idImgBackPath,
|
|
|
+ diplomaPath: this.data.diplomaPath,
|
|
|
+ stuCardPath: this.data.stuCardPath,
|
|
|
shcool: this.data.school,
|
|
|
major: this.data.major,
|
|
|
chosedEducation: this.data.chosedEducation,
|