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) {
|
export function deptTree(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="dialogVisible"
|
v-model="dialogVisible"
|
||||||
title="注册账号"
|
:title="type==1?'注册账号':'找回密码'"
|
||||||
:fullscreen="true"
|
:fullscreen="true"
|
||||||
center
|
center
|
||||||
:before-close="handleClose"
|
: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="1.基本信息" @click="activeIndex=1" />
|
||||||
<el-step title="2.在校信息" />
|
<el-step title="2.在校信息" />
|
||||||
</el-steps>
|
</el-steps>
|
||||||
|
@ -18,10 +18,10 @@
|
||||||
status-icon
|
status-icon
|
||||||
ref="ruleFormRef"
|
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-input v-model="ruleForm.name" />
|
||||||
</el-form-item>
|
</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-input v-model="ruleForm.idNumber" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="手机号" prop="phoneNumber" v-if="activeIndex==1">
|
<el-form-item label="手机号" prop="phoneNumber" v-if="activeIndex==1">
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="activeIndex==1">
|
<el-form-item v-if="activeIndex==1">
|
||||||
<div class="centerDiv">
|
<div class="centerDiv">
|
||||||
<el-button type="primary" @click="nextStep(ruleFormRef)">下一步</el-button>
|
<el-button type="primary" @click="nextStep(ruleFormRef)">{{ ['下一步','重置密码'][type-1]||'未知异常' }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="activeIndex==2">
|
<el-form-item v-if="activeIndex==2">
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, defineExpose, reactive ,onMounted} from 'vue'
|
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 { ElMessage } from 'element-plus'
|
||||||
import {setToken, removeToken } from '@/utils/auth'
|
import {setToken, removeToken } from '@/utils/auth'
|
||||||
import { regionData, codeToText } from 'element-china-area-data'
|
import { regionData, codeToText } from 'element-china-area-data'
|
||||||
|
@ -225,8 +225,12 @@ const rules = reactive({
|
||||||
},]
|
},]
|
||||||
})
|
})
|
||||||
const dialogVisible = ref(false)
|
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
|
dialogVisible.value=true
|
||||||
}
|
}
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
|
@ -241,6 +245,23 @@ const nextStep = (formEl) => {
|
||||||
if (!formEl) return
|
if (!formEl) return
|
||||||
formEl.validate((valid) => {
|
formEl.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
// 如果 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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
activeIndex.value=2
|
activeIndex.value=2
|
||||||
// 获取部门列表
|
// 获取部门列表
|
||||||
deptTree({phone:ruleForm.phoneNumber}).then(res=>{
|
deptTree({phone:ruleForm.phoneNumber}).then(res=>{
|
||||||
|
@ -268,6 +289,7 @@ const nextStep = (formEl) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
})
|
})
|
||||||
console.log('submit!')
|
console.log('submit!')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('error submit!')
|
console.log('error submit!')
|
||||||
}
|
}
|
||||||
|
@ -296,7 +318,7 @@ const submitForm = async (formEl) => {
|
||||||
schoolId:ruleForm.school[2],
|
schoolId:ruleForm.school[2],
|
||||||
classIds:ruleForm.class.join(','),
|
classIds:ruleForm.class.join(','),
|
||||||
subjectIds:ruleForm.discipline.map(o=>o.id).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(','),
|
areaIds:ruleForm.address.join(','),
|
||||||
area:araname
|
area:araname
|
||||||
}
|
}
|
||||||
|
@ -333,7 +355,7 @@ const sendcaptchaImg=()=>{
|
||||||
if(ruleForm.phoneNumber){
|
if(ruleForm.phoneNumber){
|
||||||
const pattern = /^1[3-9]\d{9}$/;
|
const pattern = /^1[3-9]\d{9}$/;
|
||||||
if( pattern.test(ruleForm.phoneNumber) ){
|
if( pattern.test(ruleForm.phoneNumber) ){
|
||||||
captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
|
captchaImg({mobile:ruleForm.phoneNumber, type: type.value}).then(res=>{
|
||||||
ruleForm.imgCode=null
|
ruleForm.imgCode=null
|
||||||
isImg.value=true
|
isImg.value=true
|
||||||
isPeopleImg.value='data:image/jpg;base64,'+res.img
|
isPeopleImg.value='data:image/jpg;base64,'+res.img
|
||||||
|
@ -354,7 +376,7 @@ const sendcaptchaImg=()=>{
|
||||||
}
|
}
|
||||||
// 刷新
|
// 刷新
|
||||||
const refreshImg=()=>{
|
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
|
isPeopleImg.value='data:image/jpg;base64,'+res.img
|
||||||
if(res.token){
|
if(res.token){
|
||||||
setToken(res.token)
|
setToken(res.token)
|
||||||
|
@ -365,7 +387,14 @@ const refreshImg=()=>{
|
||||||
// 提交人机验证
|
// 提交人机验证
|
||||||
const sbmitImg=()=>{
|
const sbmitImg=()=>{
|
||||||
if(ruleForm.imgCode){
|
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){
|
if(res.code==200){
|
||||||
ruleForm.Code=res.data
|
ruleForm.Code=res.data
|
||||||
isImg.value=false
|
isImg.value=false
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
>
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
|
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
|
||||||
<a 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>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -98,8 +98,8 @@ ipcRenderer.on('update-app-progress', (e, prop) => {
|
||||||
showDownLoading.value = prop !== 100
|
showDownLoading.value = prop !== 100
|
||||||
})
|
})
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const RegisterModel = () =>{
|
const RegisterModel = type =>{
|
||||||
RegModel.value.OpenModel()
|
RegModel.value.OpenModel(type)
|
||||||
}
|
}
|
||||||
//登录
|
//登录
|
||||||
const submitForm = async (formEl) => {
|
const submitForm = async (formEl) => {
|
||||||
|
|
Loading…
Reference in New Issue