|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
<template>
|
|
|
|
|
<el-dialog
|
|
|
|
|
v-model="dialogVisible"
|
|
|
|
|
title="注册账号"
|
|
|
|
|
:title="type==1?'注册账号':'找回密码'"
|
|
|
|
|
:fullscreen="true"
|
|
|
|
|
center
|
|
|
|
|
:before-close="handleClose"
|
|
|
|
|
>
|
|
|
|
|
<el-steps style="max-width: 100%;-webkit-app-region: no-drag;height:35px" :active="activeIndex" finish-status="success" simple>
|
|
|
|
|
<el-steps v-if="type==1" style="max-width: 100%;-webkit-app-region: no-drag;height:35px" :active="activeIndex" finish-status="success" simple>
|
|
|
|
|
<el-step title="1.基本信息" @click="activeIndex=1" />
|
|
|
|
|
<el-step title="2.在校信息" />
|
|
|
|
|
</el-steps>
|
|
|
|
@ -18,10 +18,10 @@
|
|
|
|
|
status-icon
|
|
|
|
|
ref="ruleFormRef"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="姓名" prop="name" v-if="activeIndex==1">
|
|
|
|
|
<el-form-item label="姓名" prop="name" v-if="type==1 && activeIndex==1">
|
|
|
|
|
<el-input v-model="ruleForm.name" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="身份证号" prop="idNumber" v-if="activeIndex==1">
|
|
|
|
|
<el-form-item label="身份证号" prop="idNumber" v-if="type==1 && activeIndex==1">
|
|
|
|
|
<el-input v-model="ruleForm.idNumber" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="手机号" prop="phoneNumber" v-if="activeIndex==1">
|
|
|
|
@ -60,14 +60,14 @@
|
|
|
|
|
<el-form-item label="学科" prop="discipline" v-if="activeIndex==2">
|
|
|
|
|
<div v-for="item in schoolSubject" style="display: flex;">
|
|
|
|
|
<span style="width:50px">{{ item.name }}:</span>
|
|
|
|
|
<el-checkbox-group style="width:100%" v-model="ruleForm.discipline" >
|
|
|
|
|
<el-checkbox-group style="width:100%" v-model="ruleForm.discipline">
|
|
|
|
|
<el-checkbox style="margin-right:10px" v-for="el in item.children" :key="el.id" :label="el.itemtitle" :value="el" />
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="activeIndex==1">
|
|
|
|
|
<div class="centerDiv">
|
|
|
|
|
<el-button type="primary" @click="nextStep(ruleFormRef)">下一步</el-button>
|
|
|
|
|
<el-button type="primary" @click="nextStep(ruleFormRef)">{{ ['下一步','重置密码'][type-1]||'未知异常' }}</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="activeIndex==2">
|
|
|
|
@ -109,7 +109,7 @@
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ref, defineExpose, reactive ,onMounted} from 'vue'
|
|
|
|
|
import {captchaImg,sendCode,deptTree,getDept,listClassmain,listEvaluation,signIn} from '@/api/login'
|
|
|
|
|
import {captchaImg,sendCode,deptTree,getDept,listClassmain,listEvaluation,signIn, retrievePwd} from '@/api/login'
|
|
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
import {setToken, removeToken } from '@/utils/auth'
|
|
|
|
|
import { regionData, codeToText } from 'element-china-area-data'
|
|
|
|
@ -225,8 +225,12 @@ const rules = reactive({
|
|
|
|
|
},]
|
|
|
|
|
})
|
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
|
|
|
|
|
const type = ref(1) // 1注册 2找回密码
|
|
|
|
|
// 打开弹窗
|
|
|
|
|
const OpenModel = () =>{
|
|
|
|
|
const OpenModel = v =>{
|
|
|
|
|
if (!v) return ElMessage.success('操作失败')
|
|
|
|
|
type.value = v
|
|
|
|
|
dialogVisible.value=true
|
|
|
|
|
}
|
|
|
|
|
// 关闭弹窗
|
|
|
|
@ -241,33 +245,51 @@ const nextStep = (formEl) => {
|
|
|
|
|
if (!formEl) return
|
|
|
|
|
formEl.validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
activeIndex.value=2
|
|
|
|
|
// 获取部门列表
|
|
|
|
|
deptTree({phone:ruleForm.phoneNumber}).then(res=>{
|
|
|
|
|
optionsSchool.value=res.data
|
|
|
|
|
optionsSchool.value.forEach(item=>{
|
|
|
|
|
item.value=item.id
|
|
|
|
|
if(!item.children){
|
|
|
|
|
item.disabled=true
|
|
|
|
|
}
|
|
|
|
|
if(item.children){
|
|
|
|
|
item.children.forEach(child=>{
|
|
|
|
|
child.value=child.id
|
|
|
|
|
if(!child.children){
|
|
|
|
|
child.disabled=true
|
|
|
|
|
}
|
|
|
|
|
if(child.children){
|
|
|
|
|
child.children.forEach(grandson=>{
|
|
|
|
|
grandson.value=grandson.id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 如果 type 1 注册,2 找回密码
|
|
|
|
|
if (type.value == 2) {
|
|
|
|
|
let params = {
|
|
|
|
|
mobile:ruleForm.phoneNumber,
|
|
|
|
|
code:ruleForm.Code,
|
|
|
|
|
password:ruleForm.password,
|
|
|
|
|
confirmPassword:ruleForm.confirmPassword,
|
|
|
|
|
}
|
|
|
|
|
retrievePwd(params).then(res=>{
|
|
|
|
|
if(res.code==200){
|
|
|
|
|
ElMessage.success(res.msg)
|
|
|
|
|
handleClose()
|
|
|
|
|
}else{
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
getSubject()
|
|
|
|
|
console.log(res)
|
|
|
|
|
})
|
|
|
|
|
console.log('submit!')
|
|
|
|
|
} else {
|
|
|
|
|
activeIndex.value=2
|
|
|
|
|
// 获取部门列表
|
|
|
|
|
deptTree({phone:ruleForm.phoneNumber}).then(res=>{
|
|
|
|
|
optionsSchool.value=res.data
|
|
|
|
|
optionsSchool.value.forEach(item=>{
|
|
|
|
|
item.value=item.id
|
|
|
|
|
if(!item.children){
|
|
|
|
|
item.disabled=true
|
|
|
|
|
}
|
|
|
|
|
if(item.children){
|
|
|
|
|
item.children.forEach(child=>{
|
|
|
|
|
child.value=child.id
|
|
|
|
|
if(!child.children){
|
|
|
|
|
child.disabled=true
|
|
|
|
|
}
|
|
|
|
|
if(child.children){
|
|
|
|
|
child.children.forEach(grandson=>{
|
|
|
|
|
grandson.value=grandson.id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
getSubject()
|
|
|
|
|
console.log(res)
|
|
|
|
|
})
|
|
|
|
|
console.log('submit!')
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.log('error submit!')
|
|
|
|
|
}
|
|
|
|
@ -296,7 +318,7 @@ const submitForm = async (formEl) => {
|
|
|
|
|
schoolId:ruleForm.school[2],
|
|
|
|
|
classIds:ruleForm.class.join(','),
|
|
|
|
|
subjectIds:ruleForm.discipline.map(o=>o.id).join(','),
|
|
|
|
|
subject:ruleForm.discipline.map(o=>o.itemtitle).join(','),
|
|
|
|
|
subject:ruleForm.discipline.map(o=>`${o.edustage}-${o.edusubject}`).join(','),
|
|
|
|
|
areaIds:ruleForm.address.join(','),
|
|
|
|
|
area:araname
|
|
|
|
|
}
|
|
|
|
@ -333,7 +355,7 @@ const sendcaptchaImg=()=>{
|
|
|
|
|
if(ruleForm.phoneNumber){
|
|
|
|
|
const pattern = /^1[3-9]\d{9}$/;
|
|
|
|
|
if( pattern.test(ruleForm.phoneNumber) ){
|
|
|
|
|
captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
|
|
|
|
|
captchaImg({mobile:ruleForm.phoneNumber, type: type.value}).then(res=>{
|
|
|
|
|
ruleForm.imgCode=null
|
|
|
|
|
isImg.value=true
|
|
|
|
|
isPeopleImg.value='data:image/jpg;base64,'+res.img
|
|
|
|
@ -354,7 +376,7 @@ const sendcaptchaImg=()=>{
|
|
|
|
|
}
|
|
|
|
|
// 刷新
|
|
|
|
|
const refreshImg=()=>{
|
|
|
|
|
captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
|
|
|
|
|
captchaImg({mobile:ruleForm.phoneNumber, type: type.value}).then(res=>{
|
|
|
|
|
isPeopleImg.value='data:image/jpg;base64,'+res.img
|
|
|
|
|
if(res.token){
|
|
|
|
|
setToken(res.token)
|
|
|
|
@ -365,7 +387,14 @@ const refreshImg=()=>{
|
|
|
|
|
// 提交人机验证
|
|
|
|
|
const sbmitImg=()=>{
|
|
|
|
|
if(ruleForm.imgCode){
|
|
|
|
|
sendCode({mobile:ruleForm.phoneNumber,code:ruleForm.imgCode,uuid:resImg.imgData.uuid}).then(res=>{
|
|
|
|
|
// {mobile:ruleForm.phoneNumber,code:ruleForm.imgCode,uuid:resImg.imgData.uuid}
|
|
|
|
|
const { phoneNumber:mobile,imgCode:code } = ruleForm
|
|
|
|
|
const params = {
|
|
|
|
|
mobile, code,
|
|
|
|
|
uuid: resImg.imgData.uuid,
|
|
|
|
|
type: type.value
|
|
|
|
|
}
|
|
|
|
|
sendCode(params).then(res=>{
|
|
|
|
|
if(res.code==200){
|
|
|
|
|
ruleForm.Code=res.data
|
|
|
|
|
isImg.value=false
|
|
|
|
|