machinecat520 2 роки тому
батько
коміт
0b5e4dd47d

+ 319 - 3
pages/stuNeed/stuNeed.js

@@ -16,11 +16,18 @@ Page({
         teachPosition: '', //辅导方式
         chosedTeachPosition: false, //辅导方式选项是否展示
         stuSex: '', //学生性别
+        salary: '', //学生输入的酬金
+        stuGoal: '', //学生输入的期望目标或效果
         chosedStuSex: false, //学生性别选项是否展示
         teacherAttr: '不限', //老师身份默认选项
+        chosedTeacherAttr: false, //老师身份选项区是否展示
+        teacherAttrIndex: '', //选中老师身份的索引
         teacherEdu: '不限', //老师学历默认选项
+        showTeachEdu: false, //老师学历选项区是否展示
         teacherSex: '不限', //老师性别默认选项
+        showTeachSex: false, //老师性别选项是否展示
         teacherImg: '不限', //老师头像是否上传默认选项
+        showTeachImg: false, //老师头像是否上传的选项是否展示
         // 课程类别
         courseList: [{
                 name: "小学",
@@ -684,6 +691,114 @@ Page({
                 gender: '女',
                 choesd: false
             }
+        ],
+        // 老师身份列表
+        teacherAttrList: [{
+                'attr': '不限',
+                chosed: true
+            },
+            {
+                'attr': '专职老师',
+                chosed: false
+            },
+            {
+                'attr': '在校大学生',
+                chosed: false
+            }
+
+        ],
+        // 老师学历列表1
+        educationList: [
+            [{
+                'edu': '不限',
+                chosed: true
+            }],
+            [{
+                    'edu': '博士毕业',
+                    chosed: false
+                },
+                {
+                    'edu': '硕士毕业',
+                    chosed: false
+                },
+                {
+                    'edu': '本科毕业',
+                    chosed: false
+                },
+                {
+                    'edu': '专科毕业',
+                    chosed: false
+                }
+            ],
+            [{
+                    'edu': '博士在读',
+                    chosed: false
+                },
+                {
+                    'edu': '硕士在读',
+                    chosed: false
+                },
+                {
+                    'edu': '本科在读',
+                    chosed: false
+                },
+                {
+                    'edu': '专科在读',
+                    chosed: false
+                }
+            ]
+        ],
+        // 老师学历列表2
+        educationL: [{
+                'edu': '不限',
+                chosed: true
+            },
+            {
+                'edu': '博士毕业',
+                chosed: false
+            },
+            {
+                'edu': '硕士毕业',
+                chosed: false
+            },
+            {
+                'edu': '本科毕业',
+                chosed: false
+            },
+            {
+                'edu': '专科毕业',
+                chosed: false
+            },
+            {
+                'edu': '博士在读',
+                chosed: false
+            },
+            {
+                'edu': '硕士在读',
+                chosed: false
+            },
+            {
+                'edu': '本科在读',
+                chosed: false
+            },
+            {
+                'edu': '专科在读',
+                chosed: false
+            }
+        ],
+        // 老师性别列表
+        teachSexList: [{
+                sex: '不限',
+                chosed: true
+            },
+            {
+                sex: '男',
+                chosed: false
+            },
+            {
+                sex: '女',
+                chosed: false
+            }
         ]
     },
 
@@ -892,7 +1007,7 @@ Page({
             stuSexList
         })
     },
-    // 确定按钮点击事件
+    // 学生性别确定按钮点击事件
     confirmChosedStuSex() {
         let stuSexList = this.data.stuSexList
         let index
@@ -901,13 +1016,208 @@ Page({
                 index = i
             }
         }
-        let stuSex = stuSexList[index]?.gender|| ''
+        let stuSex = stuSexList[index]?.gender || ''
         this.setData({
             stuSex
         })
         this.hiddenStuSex()
     },
 
+    // 获取学生输入的课时费
+    getSalary(e) {
+        this.setData({
+            salary: e.detail.value
+        })
+    },
+
+    // 获取学生输入的期望达到的目标或效果
+    getStuGoal(e) {
+        this.setData({
+            stuGoal: e.detail.value
+        })
+    },
+
+    // 选择老师身份
+    // 打开老师身份选项区
+    chooseTeachAttr() {
+        this.setData({
+            chosedTeacherAttr: true,
+            teacherEdu: '不限'
+        })
+    },
+    // 定义关闭老师身份选项区的方法
+    hiddenTeacherAttr() {
+        this.setData({
+            chosedTeacherAttr: false
+        })
+    },
+    // 从下拉选区选择老师身份
+    onChosedTeacherAttr(e) {
+        let index = e.currentTarget.dataset.index
+        let teacherAttrList = this.data.teacherAttrList
+        for (let i = 0; i < teacherAttrList.length; i++) {
+            if (i == index) {
+                teacherAttrList[i].chosed = !teacherAttrList[i].chosed
+            } else {
+                teacherAttrList[i].chosed = false
+            }
+        }
+        this.setData({
+            teacherAttrList
+        })
+    },
+    // 老师身份的确定按钮点击事件
+    confirmTeacherAttr() {
+        let teacherAttrList = this.data.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
+        })
+        this.hiddenTeacherAttr()
+    },
+
+    // 老师学历(当老师身份不包括“不限”时)
+    // 打开老师学历选项区
+    chooseTeachEdu() {
+        this.setData({
+            showTeachEdu: true
+        })
+    },
+    // 关闭老师学历选项区的方方法
+    hiddenTeachEdu() {
+        this.setData({
+            showTeachEdu: false
+        })
+    },
+    // 从下拉选区选择老师的学历
+    onChosedTeacherEdu(e) {
+        let index = e.currentTarget.dataset.index
+        let educationList = this.data.educationList
+        let teacherAttrIndex = this.data.teacherAttrIndex
+        for (let i = 0; i < educationList[teacherAttrIndex].length; i++) {
+            if (i == index) {
+                educationList[teacherAttrIndex][i].chosed = !educationList[teacherAttrIndex][i].chosed
+            } else {
+                educationList[teacherAttrIndex][i].chosed = false
+            }
+        }
+        this.setData({
+            educationList
+        })
+    },
+    // 老师学历确定按钮点击事件
+    confirmTeachEdu() {
+        let educationList = this.data.educationList
+        let teacherAttrIndex = this.data.teacherAttrIndex
+        let index
+        for (let i = 0; i < educationList[teacherAttrIndex].length; i++) {
+            if (educationList[teacherAttrIndex][i].chosed) {
+                index = i
+            }
+        }
+        let teacherEdu = educationList[teacherAttrIndex][index]?.edu || ''
+        this.setData({
+            teacherEdu
+        })
+        this.hiddenTeachEdu()
+    },
+    // 老师学历2(当老师身份选择“不限”时)
+    // 打开老师学历选项区
+    chooseTeachEdu() {
+        this.setData({
+            showTeachEdu: true
+        })
+    },
+    // 关闭老师学历选项区的方方法
+    hiddenTeachEduT() {
+        this.setData({
+            showTeachEdu: false
+        })
+    },
+    // 从下拉选区选择老师的学历
+    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++) {
+            if (i == index) {
+                educationL[i].chosed = !educationL[i].chosed
+            } else {
+                educationL[i].chosed = false
+            }
+        }
+        this.setData({
+            educationL
+        })
+    },
+    // 老师学历确定按钮点击事件
+    confirmTeachEduT() {
+        let educationL = this.data.educationL
+        let index
+        for (let i = 0; i < educationL.length; i++) {
+            if (educationL[i].chosed) {
+                index = i
+            }
+        }
+        let teacherEdu = educationL[index]?.edu || ''
+        this.setData({
+            teacherEdu
+        })
+        this.hiddenTeachEduT()
+    },
+
+    // 选择老师性别
+    chooseTeachSex() {
+        this.setData({
+            showTeachSex: true
+        })
+    },
+    // 关闭老师性别选区的方法
+    hiddenTeachSex() {
+        this.setData({
+            showTeachSex: false
+        })
+    },
+    // 从下拉选区选择老师性别
+    onChosedTeachsex(e) {
+        let index = e.currentTarget.dataset.index
+        let teachSexList = this.data.teachSexList
+        for (let i = 0; i < teachSexList.length; i++) {
+            if (i == index) {
+                teachSexList[i].chosed = !teachSexList[i].chosed
+            } else {
+                teachSexList[i].chosed = false
+            }
+        }
+        this.setData({
+            teachSexList
+        })
+    },
+    // 老师性别确定按钮点击事件
+    confirmTeacherSex() {
+        let teachSexList = this.data.teachSexList
+        let index
+        for (let i = 0; i < teachSexList.length; i++) {
+            if (teachSexList[i].chosed) {
+                index = i
+            }
+        }
+        let teacherSex = teachSexList[index]?.sex || teachSexList[0].sex
+        this.setData({
+            teacherSex
+        })
+        this.hiddenTeachSex()
+    },
+
+
     // 提交
     toSubmit() {
         wx.setStorageSync('student', {
@@ -917,7 +1227,13 @@ Page({
             chosedCourse: this.data.chosedCourse,
             chosedCourseDetail: this.data.chosedCourseDetail,
             teachPosition: this.data.teachPosition,
-            stuSex: this.data.stuSex
+            stuSex: this.data.stuSex,
+            salary: this.data.salary,
+            stuGoal: this.data.stuGoal,
+            teacherAttr: this.data.teacherAttr,
+            teacherEdu: this.data.teacherEdu,
+            teacherSex: this.data.teacherSex,
+            teacherImg: this.data.teacherImg
         })
         wx.showToast({
             title: '提交成功',

+ 86 - 12
pages/stuNeed/stuNeed.wxml

@@ -51,7 +51,7 @@
         <!-- 课时费 -->
         <view class="stuInfo">
             <view class="stuInfo-title">课<text decode="true">&ensp;</text>时<text decode="true">&ensp;</text>费*:</view>
-            <input class="stuInput" type="number" placeholder="请输入课时金额" />
+            <input class="stuInput" type="number" bindinput="getSalary" placeholder="请输入课时金额" />
         </view>
         <!-- 上课时间 -->
         <view>
@@ -108,31 +108,39 @@
         <!-- 期望达到的目标或效果 -->
         <view class="stuGoal">
             <text>期望达到的目标或效果:</text>
-            <textarea class="goal" name="" id="" cols="30" rows="10" maxlength="140"></textarea>
+            <textarea class="goal" name="" id="" cols="30" rows="10" maxlength="140" bindinput="getStuGoal"></textarea>
         </view>
         <!-- 老师身份 -->
         <view class="stuInfo">
             <view>老师身份:</view>
-            <view class="stuCourse">{{teacherAttr}}</view>
-            <view class="iconfont icon-xiangxia"></view>
+            <view class="stuNeedOptions" bindtap="chooseTeachAttr">
+                <view class="stuCourse">{{teacherAttr}}</view>
+                <view class="iconfont icon-xiangxia"></view>
+            </view>
         </view>
         <!-- 老师学历 -->
         <view class="stuInfo">
             <view>老师学历:</view>
-            <view class="stuCourse">{{teacherEdu}}</view>
-            <view class="iconfont icon-xiangxia"></view>
+            <view class="stuNeedOptions" bindtap="chooseTeachEdu">
+                <view class="stuCourse">{{teacherEdu}}</view>
+                <view class="iconfont icon-xiangxia"></view>
+            </view>
         </view>
         <!-- 老师性别 -->
         <view class="stuInfo">
             <view>老师性别:</view>
-            <view class="stuCourse">{{teacherSex}}</view>
-            <view class="iconfont icon-xiangxia"></view>
+            <view class="stuNeedOptions" bindtap="chooseTeachSex">
+                <view class="stuCourse">{{teacherSex}}</view>
+                <view class="iconfont icon-xiangxia"></view>
+            </view>
         </view>
         <!-- 是否要求老师上传头像 -->
         <view class="stuInfo">
             <view>是否要求头像上传:</view>
-            <view class="stuCourse">{{teacherImg}}</view>
-            <view class="iconfont icon-xiangxia"></view>
+            <view class="stuNeedOptions">
+                <view class="stuCourse">{{teacherImg}}</view>
+                <view class="iconfont icon-xiangxia"></view>
+            </view>
         </view>
         <!-- 对老师的其他需求 -->
         <view class="stuGoal">
@@ -192,7 +200,7 @@
     <!-- 空白区(背景) -->
     <view class="mask" bindtap="hiddenTeachPosition"></view>
     <!-- 内容区 -->
-    <view class="teachPosition-wrapper">
+    <view class="options-wrapper">
         <view class="chooseContent-title">
             <view bindtap="hiddenTeachPosition">取消</view>
             <view bindtap="confirmTeachPosition">确定</view>
@@ -209,7 +217,7 @@
     <!-- 空白区(背景) -->
     <view class="mask" bindtap="hiddenStuSex"></view>
     <!-- 内容区 -->
-    <view class="stuSex-wrapper">
+    <view class="options-wrapper">
         <view class="chooseContent-title">
             <view bindtap="hiddenStuSex">取消</view>
             <view bindtap="confirmChosedStuSex">确定</view>
@@ -219,4 +227,70 @@
             <image style="position: absolute;right: 40rpx;" src="{{item.chosed?'/images/selected.png':'/images/selectNull.png'}}"></image>
         </view>
     </view>
+</view>
+
+<!-- 老师身份 -->
+<view wx:if="{{chosedTeacherAttr}}">
+    <!-- 空白区(背景) -->
+    <view class="mask" bindtap="hiddenTeacherAttr"></view>
+    <!-- 内容区 -->
+    <view class="options-wrapper">
+        <view class="chooseContent-title">
+            <view bindtap="hiddenTeacherAttr">取消</view>
+            <view bindtap="confirmTeacherAttr">确定</view>
+        </view>
+        <view class="chooseContent" wx:for="{{teacherAttrList}}" wx:key="key" bindtap="onChosedTeacherAttr" data-index="{{index}}">
+            <view style="position: absolute;left: 40rpx;">{{item.attr}}</view>
+            <image style="position: absolute;right: 40rpx;" src="{{item.chosed?'/images/selected.png':'/images/selectNull.png'}}"></image>
+        </view>
+    </view>
+</view>
+
+<!-- 老师学历 -->
+<view wx:if="{{showTeachEdu && teacherAttr != '不限'}}">
+    <!-- 空白区(背景) -->
+    <view class="mask" bindtap="hiddenTeachEdu"></view>
+    <!-- 内容区 -->
+    <view class="options-wrapper">
+        <view class="chooseContent-title">
+            <view bindtap="hiddenTeachEdu">取消</view>
+            <view bindtap="confirmTeachEdu">确定</view>
+        </view>
+        <view class="chooseContent" wx:for="{{educationList[teacherAttrIndex]}}" wx:key="key" bindtap="onChosedTeacherEdu" data-index="{{index}}">
+            <view style="position: absolute;left: 40rpx;">{{item.edu}}</view>
+            <image style="position: absolute;right: 40rpx;" src="{{item.chosed?'/images/selected.png':'/images/selectNull.png'}}"></image>
+        </view>
+    </view>
+</view>
+<view wx:if="{{showTeachEdu && teacherAttr == '不限'}}">
+    <!-- 空白区(背景) -->
+    <view class="mask" bindtap="hiddenTeachEduT"></view>
+    <!-- 内容区 -->
+    <view class="options-wrapper">
+        <view class="chooseContent-title">
+            <view bindtap="hiddenTeachEduT">取消</view>
+            <view bindtap="confirmTeachEduT">确定</view>
+        </view>
+        <view class="chooseContent" wx:for="{{educationL}}" wx:key="key" bindtap="onChosedTeacherEduT" data-index="{{index}}">
+            <view style="position: absolute;left: 40rpx;">{{item.edu}}</view>
+            <image style="position: absolute;right: 40rpx;" src="{{item.chosed?'/images/selected.png':'/images/selectNull.png'}}"></image>
+        </view>
+    </view>
+</view>
+
+<!-- 老师性别 -->
+<view wx:if="{{showTeachSex}}">
+    <!-- 空白区(背景) -->
+    <view class="mask" bindtap="hiddenTeachSex"></view>
+    <!-- 内容区 -->
+    <view class="options-wrapper">
+        <view class="chooseContent-title">
+            <view bindtap="hiddenTeachSex">取消</view>
+            <view bindtap="confirmTeacherSex">确定</view>
+        </view>
+        <view class="chooseContent" wx:for="{{teachSexList}}" wx:key="key" bindtap="onChosedTeachsex" data-index="{{index}}">
+            <view style="position: absolute;left: 40rpx;">{{item.sex}}</view>
+            <image style="position: absolute;right: 40rpx;" src="{{item.chosed?'/images/selected.png':'/images/selectNull.png'}}"></image>
+        </view>
+    </view>
 </view>

+ 1 - 2
pages/stuNeed/stuNeed.wxss

@@ -177,8 +177,7 @@
 }
 
 /* 辅导方式内容区 */
-.teachPosition-wrapper,
-.stuSex-wrapper{
+.options-wrapper{
     z-index: 3;
     width: 100%;
     background-color: #fff;

+ 181 - 127
pages/teachAuthentication/teachAuthentication.js

@@ -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,

+ 16 - 15
pages/teachAuthentication/teachAuthentication.wxml

@@ -32,7 +32,15 @@
     </view>
     <!-- 性别,根据身份证号自动判断 -->
     <view class="input-item">
-        <text>性别*:<text style="color: #808080;">{{sex || '请先输入完整的身份证号嘛'}}</text></text>
+        <text>性别*:<text style="color: #808080;">{{sex || '请先输入完整的身份证号码'}}</text></text>
+    </view>
+    <!-- 老师的身份 -->
+    <view class="idAttribute">
+        <view>身份*:</view>
+        <view class="idAttribute-container" bindtap="chooseTeachAttr">
+            <view class="teachAttribute">{{chosedTeachAttr || '请选择'}}</view>
+            <view class="iconfont icon-xiangxia"></view>
+        </view>
     </view>
     <!-- 身份证照片上传 -->
     <view class="idCard">
@@ -52,14 +60,14 @@
         </view>
     </view>
     <!-- 毕业证照片上传 -->
-    <view class="myCard">
+    <view class="myCard" wx:if="{{chosedTeachAttr==teachAttrList[1].attr}}">
         <text>毕业证*:</text>
         <text class="explain">需要能看清楚证书编号</text>
         <text wx:if="{{!diplomaPath}}" class="ImgContainer iconfont icon-tupian" bindtap="chooseDiploma"></text>
         <image wx:else src="{{diplomaPath}}" class="ImgContainer" bindtap="chooseDiploma"></image>
     </view>
     <!-- 学生证照片上传 -->
-    <view class="myCard">
+    <view class="myCard" wx:else>
         <text>学生证*:</text>
         <text class="explain">需要能看清头像</text>
         <text wx:if="{{!stuCardPath}}" class="ImgContainer iconfont icon-tupian" bindtap="chooseStuCard"></text>
@@ -67,19 +75,12 @@
     </view>
     <!-- 头像照片上传 -->
     <view class="myHead">
-        <text>头像:</text>
+        <text>头像*:</text>
         <text class="explain">(说明:只能上传证件照,上传其他照片审核不予通过)</text>
         <text wx:if="{{!headImgPath}}" class="ImgContainer iconfont icon-tupian" bindtap="chooseHeadImg"></text>
-        <image wx:else src="{{headImgPath}}"  class="ImgContainer" bindtap="chooseHeadImg"></image>
-    </view>
-    <!-- 老师的身份 -->
-    <view class="idAttribute">
-        <view>身份*:</view>
-        <view class="idAttribute-container" bindtap="chooseTeachAttr">
-            <view class="teachAttribute">{{chosedTeachAttr || '请选择'}}</view>
-            <view class="iconfont icon-xiangxia"></view>
-        </view>
+        <image wx:else src="{{headImgPath}}" class="ImgContainer" bindtap="chooseHeadImg"></image>
     </view>
+
     <!-- 学校填写 -->
     <view class="input-item">
         <text>毕业/就读学校*:</text>
@@ -126,7 +127,7 @@
             <view bindtap="hiddenTeachId">取消</view>
             <view bindtap="confirmTeachId">确定</view>
         </view>
-        <view class="idAttr-content" wx:for="{{attributeList}}" wx:key="key" bindtap="onidAttrSelect" data-index="{{index}}">
+        <view class="idAttr-content" wx:for="{{teachAttrList}}" wx:key="key" bindtap="onidAttrSelect" data-index="{{index}}">
             <view style="position: absolute;left: 40rpx;">{{item.attr}}</view>
             <image style="position: absolute;right: 40rpx;" src="{{item.chosed?'/images/selected.png':'/images/selectNull.png'}}"></image>
         </view>
@@ -144,7 +145,7 @@
             <view bindtap="hiddenEdu">取消</view>
             <view bindtap="confirmEdu">确定</view>
         </view>
-        <view class="edu-content" wx:for="{{educationList}}" wx:key="key" bindtap="onEduSelect" data-index="{{index}}">
+        <view class="edu-content" wx:for="{{educationList[teachAttrIndex]}}" wx:key="key" bindtap="onEduSelect" data-index="{{index}}">
             <view style="position: absolute;left: 40rpx;">{{item.edu}}</view>
             <image style="position: absolute;right: 40rpx;" src="{{item.chosed?'/images/selected.png':'/images/selectNull.png'}}"></image>
         </view>