zdg #197
|
@ -88,6 +88,15 @@ export function signIn(data) {
|
|||
})
|
||||
}
|
||||
|
||||
//登录模块-找回密码
|
||||
export function retrievePwd(data) {
|
||||
return request({
|
||||
url: '/smarttalk/register/authRetrievePwd',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//注册模块-获取学校
|
||||
export function deptTree(data) {
|
||||
return request({
|
||||
|
|
|
@ -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">
|
||||
|
@ -67,7 +67,7 @@
|
|||
</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!')
|
||||
}
|
||||
|
@ -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
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
>
|
||||
</el-form-item>
|
||||
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
|
||||
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="RegisterModel">注册账号</a>
|
||||
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="RegisterModel(1)">注册账号</a>
|
||||
<!-- | -->
|
||||
<!-- <a style="margin-left: 10px;">忘记密码</a> -->
|
||||
<a class="hover:text-sky-500" style="margin-left: 10px;" @click="RegisterModel(2)">忘记密码</a>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
@ -98,8 +98,8 @@ ipcRenderer.on('update-app-progress', (e, prop) => {
|
|||
showDownLoading.value = prop !== 100
|
||||
})
|
||||
// 打开弹窗
|
||||
const RegisterModel = () =>{
|
||||
RegModel.value.OpenModel()
|
||||
const RegisterModel = type =>{
|
||||
RegModel.value.OpenModel(type)
|
||||
}
|
||||
//登录
|
||||
const submitForm = async (formEl) => {
|
||||
|
|
Loading…
Reference in New Issue