mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-16 06:16:51 +08:00
feat(login): 增加登录相关功能和验证码处理- 在 user store 中添加新的错误码处理逻辑- 在登录页面添加验证码输入框和重置密码对话框- 实现强制修改密码的功能-优化密码修改后的处理逻辑
This commit is contained in:
@@ -53,12 +53,20 @@ const actions = {
|
|||||||
case 51001:
|
case 51001:
|
||||||
// 需要发送 短信验证码
|
// 需要发送 短信验证码
|
||||||
resolve({
|
resolve({
|
||||||
code: 51001
|
code: numberResult
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 50024:
|
case 50024:
|
||||||
|
// 需要验证码
|
||||||
resolve({
|
resolve({
|
||||||
code: 50024,
|
code: numberResult,
|
||||||
|
message: res.content.resultMessage
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 51003:
|
||||||
|
// 需要验证码
|
||||||
|
resolve({
|
||||||
|
code: numberResult,
|
||||||
message: res.content.resultMessage
|
message: res.content.resultMessage
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -117,6 +117,11 @@
|
|||||||
:user-name="loginForm.userName"
|
:user-name="loginForm.userName"
|
||||||
@handleSubmit="handleSubmit"
|
@handleSubmit="handleSubmit"
|
||||||
></send-phone-code>
|
></send-phone-code>
|
||||||
|
|
||||||
|
<reset-password-dialog
|
||||||
|
:visible.sync="resetPasswordVisible"
|
||||||
|
:hideDialog="true"
|
||||||
|
></reset-password-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -130,9 +135,11 @@ import {
|
|||||||
} from '@/api/app/user'
|
} from '@/api/app/user'
|
||||||
import { setToken } from '@/assets/js/utils/auth'
|
import { setToken } from '@/assets/js/utils/auth'
|
||||||
import uuid from 'uuid'
|
import uuid from 'uuid'
|
||||||
|
import ResetPasswordDialog from '@/views/system/user/components/ResetPasswordDialog.vue'
|
||||||
// import { indexUser } from '@/api/app/user'
|
// import { indexUser } from '@/api/app/user'
|
||||||
export default {
|
export default {
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
|
components: { ResetPasswordDialog },
|
||||||
data() {
|
data() {
|
||||||
const validateuserName = (rule, value, callback) => {
|
const validateuserName = (rule, value, callback) => {
|
||||||
if (!validUsername(value)) {
|
if (!validUsername(value)) {
|
||||||
@@ -194,6 +201,7 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
passwordType: 'password',
|
passwordType: 'password',
|
||||||
redirect: undefined,
|
redirect: undefined,
|
||||||
|
resetPasswordVisible: false,
|
||||||
minute: 120 // 默认120秒 发送间隔
|
minute: 120 // 默认120秒 发送间隔
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -302,7 +310,7 @@ export default {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
// this.sendPhoneCode()
|
// this.sendPhoneCode()
|
||||||
}
|
}
|
||||||
|
// 展示验证码
|
||||||
if (res.code === 50024) {
|
if (res.code === 50024) {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if (res.message) {
|
if (res.message) {
|
||||||
@@ -310,6 +318,11 @@ export default {
|
|||||||
}
|
}
|
||||||
this.getCaptChaCode()
|
this.getCaptChaCode()
|
||||||
}
|
}
|
||||||
|
// 强制修改密码
|
||||||
|
if (res.code === 51003) {
|
||||||
|
this.loading = false
|
||||||
|
this.resetPasswordVisible = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (this.captchaKey) {
|
if (this.captchaKey) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
{{ minute }}
|
|
||||||
<r-dialog
|
<r-dialog
|
||||||
title="修改密码"
|
title="修改密码"
|
||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
@@ -81,6 +80,10 @@ export default {
|
|||||||
userId: {
|
userId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
hideDialog: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -124,9 +127,15 @@ export default {
|
|||||||
smsCode: code
|
smsCode: code
|
||||||
}).then(async res => {
|
}).then(async res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
this.$message.success('密码修改成功')
|
if (!this.hideDialog) {
|
||||||
await this.$store.dispatch('user/logout')
|
this.$message.success('密码修改成功')
|
||||||
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
await this.$store.dispatch('user/logout')
|
||||||
|
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
||||||
|
} else {
|
||||||
|
this.$message.success('密码修改成功')
|
||||||
|
await this.$store.dispatch('user/logout')
|
||||||
|
this.handleClose()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user