|
@@ -28,6 +28,7 @@ Page({
|
|
|
showTeachSex: false, //老师性别选项是否展示
|
|
|
teacherImg: '不限', //老师头像是否上传默认选项
|
|
|
showTeachImg: false, //老师头像是否上传的选项是否展示
|
|
|
+ toTeacherOtherNeed:'', //对老师的其他需求
|
|
|
// 课程类别
|
|
|
courseList: [{
|
|
|
name: "小学",
|
|
@@ -714,6 +715,10 @@ Page({
|
|
|
chosed: true
|
|
|
}],
|
|
|
[{
|
|
|
+ 'edu': '不限',
|
|
|
+ chosed: true
|
|
|
+ },
|
|
|
+ {
|
|
|
'edu': '博士毕业',
|
|
|
chosed: false
|
|
|
},
|
|
@@ -731,6 +736,10 @@ Page({
|
|
|
}
|
|
|
],
|
|
|
[{
|
|
|
+ 'edu': '不限',
|
|
|
+ chosed: true
|
|
|
+ },
|
|
|
+ {
|
|
|
'edu': '博士在读',
|
|
|
chosed: false
|
|
|
},
|
|
@@ -799,6 +808,20 @@ Page({
|
|
|
sex: '女',
|
|
|
chosed: false
|
|
|
}
|
|
|
+ ],
|
|
|
+ // 是否要求头像上传
|
|
|
+ teacherImgList: [{
|
|
|
+ imgUpload: '不限',
|
|
|
+ choesd: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ imgUpload: '是',
|
|
|
+ choesd: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ imgUpload: '否',
|
|
|
+ choesd: false
|
|
|
+ }
|
|
|
]
|
|
|
},
|
|
|
|
|
@@ -861,7 +884,7 @@ Page({
|
|
|
})
|
|
|
|
|
|
},
|
|
|
- // 确定按钮的点击事件
|
|
|
+ // 课程类别(大类)确定按钮的点击事件
|
|
|
confirmCourseTitle() {
|
|
|
let courseList = this.data.courseList
|
|
|
let index
|
|
@@ -918,7 +941,7 @@ Page({
|
|
|
courseDetail
|
|
|
})
|
|
|
},
|
|
|
- // 确定按钮的点击事件
|
|
|
+ // 课程细分(小类)确定按钮的点击事件
|
|
|
confirmCourseDetail() {
|
|
|
let courseDetail = this.data.courseDetail
|
|
|
let courseChosedIndex = this.data.courseChosedIndex
|
|
@@ -948,7 +971,7 @@ Page({
|
|
|
chosedTeachPosition: false
|
|
|
})
|
|
|
},
|
|
|
- // 从下拉选区选择内容
|
|
|
+ // 从下拉选区选择辅导方式内容
|
|
|
onTeachPosition(e) {
|
|
|
let index = e.currentTarget.dataset.index
|
|
|
let teachPositions = this.data.teachPositions
|
|
@@ -963,7 +986,7 @@ Page({
|
|
|
teachPositions
|
|
|
})
|
|
|
},
|
|
|
- // 确定按钮点击事件
|
|
|
+ // 辅导方式确定按钮点击事件
|
|
|
confirmTeachPosition() {
|
|
|
let teachPositions = this.data.teachPositions
|
|
|
let index
|
|
@@ -983,7 +1006,16 @@ Page({
|
|
|
// 打开学生性别选项区
|
|
|
chooseStuSex() {
|
|
|
this.setData({
|
|
|
- chosedStuSex: true
|
|
|
+ chosedStuSex: true,
|
|
|
+ stuSex: ''
|
|
|
+ })
|
|
|
+ // 点击学生性别的选项后,将原来的选项取消,恢复到默认选项
|
|
|
+ let stuSexList = this.data.stuSexList
|
|
|
+ for (let i = 0; i < stuSexList.length; i++) {
|
|
|
+ stuSexList[i].chosed = false
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ stuSexList
|
|
|
})
|
|
|
},
|
|
|
// 关闭学生性别选项区的方法
|
|
@@ -992,7 +1024,7 @@ Page({
|
|
|
chosedStuSex: false
|
|
|
})
|
|
|
},
|
|
|
- // 从下拉选区选择内容
|
|
|
+ // 从下拉选区选择学生性别
|
|
|
onChosedStuSex(e) {
|
|
|
let index = e.currentTarget.dataset.index
|
|
|
let stuSexList = this.data.stuSexList
|
|
@@ -1042,8 +1074,58 @@ Page({
|
|
|
chooseTeachAttr() {
|
|
|
this.setData({
|
|
|
chosedTeacherAttr: true,
|
|
|
+ // teacherAttr: '不限',
|
|
|
teacherEdu: '不限'
|
|
|
})
|
|
|
+ // 点击老师身份的选项后,将原来的选项取消,恢复到默认选项
|
|
|
+ let teacherAttrList = this.data.teacherAttrList
|
|
|
+ for (let i = 0; i < teacherAttrList.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ teacherAttrList[i].chosed = true
|
|
|
+ } else {
|
|
|
+ teacherAttrList[i].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ teacherAttrList
|
|
|
+ })
|
|
|
+ // console.log(teacherAttrList)
|
|
|
+ let index
|
|
|
+ for (let i = 0; i < teacherAttrList.length; i++) {
|
|
|
+ if (teacherAttrList[i].chosed) {
|
|
|
+ index = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let teacherAttr = teacherAttrList[index]?.attr || teacherAttrList[0].attr
|
|
|
+ let teacherAttrIndex = index
|
|
|
+ this.setData({
|
|
|
+ teacherAttr,
|
|
|
+ teacherAttrIndex
|
|
|
+ })
|
|
|
+ // 点击老师身份后,重置老师学历选项为默认值
|
|
|
+ let educationList = this.data.educationList
|
|
|
+ for (let i = 0; i < educationList.length; i++) {
|
|
|
+ for (let j = 0; j < educationList[i].length; j++) {
|
|
|
+ if (j == 0) {
|
|
|
+ educationList[i][j].chosed = true
|
|
|
+ } else {
|
|
|
+ educationList[i][j].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ educationList
|
|
|
+ })
|
|
|
+ let teacherEduIndex
|
|
|
+ for (let i = 0; i < educationList[teacherAttrIndex].length; i++) {
|
|
|
+ if (educationList[teacherAttrIndex][i].chosed) {
|
|
|
+ teacherEduIndex = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let teacherEdu = educationList[teacherAttrIndex][teacherEduIndex]?.edu || ''
|
|
|
+ this.setData({
|
|
|
+ teacherEdu
|
|
|
+ })
|
|
|
},
|
|
|
// 定义关闭老师身份选项区的方法
|
|
|
hiddenTeacherAttr() {
|
|
@@ -1082,16 +1164,33 @@ Page({
|
|
|
teacherAttrIndex
|
|
|
})
|
|
|
this.hiddenTeacherAttr()
|
|
|
+ // console.log(teacherAttrIndex)
|
|
|
},
|
|
|
|
|
|
// 老师学历(当老师身份不包括“不限”时)
|
|
|
// 打开老师学历选项区
|
|
|
chooseTeachEdu() {
|
|
|
this.setData({
|
|
|
- showTeachEdu: true
|
|
|
+ showTeachEdu: true,
|
|
|
+ teacherEdu: '不限'
|
|
|
+ })
|
|
|
+ let educationList = this.data.educationList
|
|
|
+ // console.log(educationList)
|
|
|
+ // 点击老师学历的选项后,将原来的选项取消,恢复到默认选项
|
|
|
+ for (let i = 0; i < educationList.length; i++) {
|
|
|
+ for (let j = 0; j < educationList[i].length; j++) {
|
|
|
+ if (j == 0) {
|
|
|
+ educationList[i][j].chosed = true
|
|
|
+ } else {
|
|
|
+ educationList[i][j].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ educationList
|
|
|
})
|
|
|
},
|
|
|
- // 关闭老师学历选项区的方方法
|
|
|
+ // 关闭老师学历选项区的方法
|
|
|
hiddenTeachEdu() {
|
|
|
this.setData({
|
|
|
showTeachEdu: false
|
|
@@ -1123,7 +1222,7 @@ Page({
|
|
|
index = i
|
|
|
}
|
|
|
}
|
|
|
- let teacherEdu = educationList[teacherAttrIndex][index]?.edu || ''
|
|
|
+ let teacherEdu = educationList[teacherAttrIndex][index]?.edu || educationList[teacherAttrIndex][0].edu
|
|
|
this.setData({
|
|
|
teacherEdu
|
|
|
})
|
|
@@ -1131,12 +1230,26 @@ Page({
|
|
|
},
|
|
|
// 老师学历2(当老师身份选择“不限”时)
|
|
|
// 打开老师学历选项区
|
|
|
- chooseTeachEdu() {
|
|
|
+ chooseTeachEduTwo() {
|
|
|
+ this.setData({
|
|
|
+ showTeachEdu: true,
|
|
|
+ teacherEdu: '不限',
|
|
|
+ })
|
|
|
+ // 点击老师学历的选项后,将原来的选项取消,恢复到默认选项
|
|
|
+ let educationL = this.data.educationL
|
|
|
+ for (let i = 0; i < educationL.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ educationL[i].chosed = true
|
|
|
+ } else {
|
|
|
+ educationL[i].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- showTeachEdu: true
|
|
|
+ educationL
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
- // 关闭老师学历选项区的方方法
|
|
|
+ // 关闭老师学历选项区的方法
|
|
|
hiddenTeachEduT() {
|
|
|
this.setData({
|
|
|
showTeachEdu: false
|
|
@@ -1144,10 +1257,9 @@ Page({
|
|
|
},
|
|
|
// 从下拉选区选择老师的学历
|
|
|
onChosedTeacherEduT(e) {
|
|
|
- // console.log(e)
|
|
|
let index = e.currentTarget.dataset.index
|
|
|
let educationL = this.data.educationL
|
|
|
- for (let i = 0; i < educationL[i].length; i++) {
|
|
|
+ for (let i = 0; i < educationL.length; i++) {
|
|
|
if (i == index) {
|
|
|
educationL[i].chosed = !educationL[i].chosed
|
|
|
} else {
|
|
@@ -1167,7 +1279,7 @@ Page({
|
|
|
index = i
|
|
|
}
|
|
|
}
|
|
|
- let teacherEdu = educationL[index]?.edu || ''
|
|
|
+ let teacherEdu = educationL[index]?.edu || educationL[0].edu
|
|
|
this.setData({
|
|
|
teacherEdu
|
|
|
})
|
|
@@ -1175,9 +1287,23 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 选择老师性别
|
|
|
+ // 打开老师性别选项区
|
|
|
chooseTeachSex() {
|
|
|
this.setData({
|
|
|
- showTeachSex: true
|
|
|
+ showTeachSex: true,
|
|
|
+ teacherSex: '不限'
|
|
|
+ })
|
|
|
+ // 点击老师性别的选项后,将原来的选项取消,恢复到默认选项
|
|
|
+ let teachSexList = this.data.teachSexList
|
|
|
+ for (let i = 0; i < teachSexList.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ teachSexList[i].chosed = true
|
|
|
+ } else {
|
|
|
+ teachSexList[i].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ teachSexList
|
|
|
})
|
|
|
},
|
|
|
// 关闭老师性别选区的方法
|
|
@@ -1217,9 +1343,157 @@ Page({
|
|
|
this.hiddenTeachSex()
|
|
|
},
|
|
|
|
|
|
+ // 是否要求老师头像上传
|
|
|
+ // 打开老师头像是否上传选项区
|
|
|
+ toTeacherImgUpload() {
|
|
|
+ this.setData({
|
|
|
+ showTeachImg: true,
|
|
|
+ teacherImg: '不限'
|
|
|
+ })
|
|
|
+ // 点击老师头像是否上传的选项后,将原来的选项取消,恢复到默认选项
|
|
|
+ let teacherImgList = this.data.teacherImgList
|
|
|
+ for (let i = 0; i < teacherImgList.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ teacherImgList[i].chosed = true
|
|
|
+ } else {
|
|
|
+ teacherImgList[i].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ teacherImgList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 关闭老师头像是否上传选区的方法
|
|
|
+ hiddenTeacherImgUpload() {
|
|
|
+ this.setData({
|
|
|
+ showTeachImg: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 从下拉选区选择老师头像是否上传
|
|
|
+ onChosedImgUpload(e) {
|
|
|
+ let index = e.currentTarget.dataset.index
|
|
|
+ let teacherImgList = this.data.teacherImgList
|
|
|
+ for (let i = 0; i < teacherImgList.length; i++) {
|
|
|
+ if (i == index) {
|
|
|
+ teacherImgList[i].chosed = !teacherImgList[i].chosed
|
|
|
+ } else {
|
|
|
+ teacherImgList[i].chosed = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ teacherImgList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 老师头像是否上传确定按钮点击事件
|
|
|
+ confirmTeacherImgUpload() {
|
|
|
+ let teacherImgList = this.data.teacherImgList
|
|
|
+ let index
|
|
|
+ for (let i = 0; i < teacherImgList.length; i++) {
|
|
|
+ if (teacherImgList[i].chosed) {
|
|
|
+ index = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let teacherImg = teacherImgList[index]?.imgUpload || teacherImgList[0].imgUpload
|
|
|
+ this.setData({
|
|
|
+ teacherImg
|
|
|
+ })
|
|
|
+ this.hiddenTeacherImgUpload()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 对老师的其他需求
|
|
|
+ getOtherNeed(e){
|
|
|
+ // console.log(e)
|
|
|
+ this.setData({
|
|
|
+ toTeacherOtherNeed:e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
|
|
|
// 提交
|
|
|
toSubmit() {
|
|
|
+ //判断姓名是否为空
|
|
|
+ let stuName = this.data.stuName
|
|
|
+ if(!stuName){
|
|
|
+ wx.showToast({
|
|
|
+ title: '姓名不能为空',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //判断手机号码是否为空
|
|
|
+ let stuPhoneNum = this.data.stuPhoneNum
|
|
|
+ if(!stuPhoneNum){
|
|
|
+ wx.showToast({
|
|
|
+ title: '手机号不能为空',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //判断手机号码是否正确
|
|
|
+ let phoneReg = /^1(3|4|5|6|7|8|9)\d{9}$/;
|
|
|
+ if (!phoneReg.test(stuPhoneNum)) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '手机号格式错误',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //判断微信号码是否为空
|
|
|
+ let stuWeChatNum = this.data.stuWeChatNum
|
|
|
+ if(!stuWeChatNum){
|
|
|
+ wx.showToast({
|
|
|
+ title: '微信号不能为空',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断课程类别(大类)是否选择
|
|
|
+ let chosedCourse = this.data.chosedCourse
|
|
|
+ if(!chosedCourse){
|
|
|
+ wx.showToast({
|
|
|
+ title: '课程类别未选',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断课程细分(小类)是否选择
|
|
|
+ let chosedCourseDetail = this.data.chosedCourseDetail
|
|
|
+ if(!chosedCourseDetail){
|
|
|
+ wx.showToast({
|
|
|
+ title: '课程细分未选',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断辅导方式是否选择
|
|
|
+ let teachPosition = this.data.teachPosition
|
|
|
+ if(!teachPosition){
|
|
|
+ wx.showToast({
|
|
|
+ title: '辅导方式未选',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断学生性别是否选择
|
|
|
+ let stuSex = this.data.stuSex
|
|
|
+ if(!stuSex){
|
|
|
+ wx.showToast({
|
|
|
+ title: '学生性别未选',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //判断课时费是否输入
|
|
|
+ let salary = this.data.salary
|
|
|
+ if(!salary){
|
|
|
+ wx.showToast({
|
|
|
+ title: '课时费不能为空',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 存入本地缓存
|
|
|
wx.setStorageSync('student', {
|
|
|
stuName: this.data.stuName,
|
|
|
stuPhoneNum: this.data.stuPhoneNum,
|
|
@@ -1233,7 +1507,8 @@ Page({
|
|
|
teacherAttr: this.data.teacherAttr,
|
|
|
teacherEdu: this.data.teacherEdu,
|
|
|
teacherSex: this.data.teacherSex,
|
|
|
- teacherImg: this.data.teacherImg
|
|
|
+ teacherImg: this.data.teacherImg,
|
|
|
+ toTeacherOtherNeed:this.data.toTeacherOtherNeed
|
|
|
})
|
|
|
wx.showToast({
|
|
|
title: '提交成功',
|