mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-11 03:46:50 +08:00
feat(system): 实现登录时修改密码功能- 新增 externalUpdatePassword 接口用于登录时修改密码- 修改 ResetPasswordDialog 组件,支持登录时和登录后的不同修改密码流程-优化 login 页面的密码修改逻辑,处理需要验证码的情况- 调整 rule 接口和规则编辑页面的相关显示内容
This commit is contained in:
@@ -66,6 +66,15 @@ export function updatePassword(data) {
|
|||||||
back: true
|
back: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function externalUpdatePassword(data) {
|
||||||
|
return request({
|
||||||
|
url: getUrl(`/sysUserEx/externalUpdatePassword`),
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
// back: true
|
||||||
|
})
|
||||||
|
}
|
||||||
export function verifyUpdatePassword(data) {
|
export function verifyUpdatePassword(data) {
|
||||||
return request({
|
return request({
|
||||||
url: getUrl(`/sysUserEx/verifyUpdatePassword`),
|
url: getUrl(`/sysUserEx/verifyUpdatePassword`),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import getUrl from '@/assets/js/utils/get-url'
|
|||||||
// 分页查询
|
// 分页查询
|
||||||
export function getRulePage(data) {
|
export function getRulePage(data) {
|
||||||
return request({
|
return request({
|
||||||
url: getUrl('/risk/check/rule/page'),
|
url: getUrl('/riskCheckRuleEx/page'),
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -70,6 +70,13 @@ const actions = {
|
|||||||
message: res.content.resultMessage
|
message: res.content.resultMessage
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
case 51004:
|
||||||
|
// 需要验证码
|
||||||
|
resolve({
|
||||||
|
...res.content,
|
||||||
|
code: numberResult
|
||||||
|
})
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
reject(res.content)
|
reject(res.content)
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -121,6 +121,8 @@
|
|||||||
<reset-password-dialog
|
<reset-password-dialog
|
||||||
:visible.sync="resetPasswordVisible"
|
:visible.sync="resetPasswordVisible"
|
||||||
:hideDialog="true"
|
:hideDialog="true"
|
||||||
|
:isLogin="true"
|
||||||
|
:user-name="loginForm.userName"
|
||||||
></reset-password-dialog>
|
></reset-password-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -299,11 +301,13 @@ export default {
|
|||||||
this.$store
|
this.$store
|
||||||
.dispatch('user/login', this.loginForm)
|
.dispatch('user/login', this.loginForm)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0 || res.code === 51004) {
|
||||||
sessionStorage.setItem(
|
if (res.code === 51004) {
|
||||||
'tipMessage',
|
sessionStorage.setItem(
|
||||||
res.content.resultEnMessage ? res.content.resultEnMessage : ''
|
'tipMessage',
|
||||||
)
|
res.content.resultMessage ? res.content.resultMessage : ''
|
||||||
|
)
|
||||||
|
}
|
||||||
this.$router.push({ path: '/home' })
|
this.$router.push({ path: '/home' })
|
||||||
this.loading = false
|
this.loading = false
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -183,9 +183,9 @@ export default {
|
|||||||
{ required: true, message: '请输入规则描述', trigger: 'blur' },
|
{ required: true, message: '请输入规则描述', trigger: 'blur' },
|
||||||
{
|
{
|
||||||
min: 1,
|
min: 1,
|
||||||
max: 300,
|
max: 1000,
|
||||||
message:
|
message:
|
||||||
'规则描述支持录入汉字、大写字母、小写字母、数字、符号,不超过300个字,请重新输入',
|
'规则描述支持录入汉字、大写字母、小写字母、数字、符号,不超过1000个字,请重新输入',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -501,6 +501,54 @@ export default {
|
|||||||
},
|
},
|
||||||
{ prop: 'ruleDesc', key: '规则描述' },
|
{ prop: 'ruleDesc', key: '规则描述' },
|
||||||
{ prop: 'riskScript', key: '风险提示话术' },
|
{ prop: 'riskScript', key: '风险提示话术' },
|
||||||
|
{
|
||||||
|
prop: 'hitCount',
|
||||||
|
key: '触发次数',
|
||||||
|
render: (h, params) => {
|
||||||
|
return h(
|
||||||
|
'el-tag',
|
||||||
|
{
|
||||||
|
props: {
|
||||||
|
type: 'info',
|
||||||
|
size: 'small'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
params.row.hitCount ? params.row.hitCount + '次' : '0次'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'approvedCount',
|
||||||
|
key: '审批通过次数',
|
||||||
|
render: (h, params) => {
|
||||||
|
return h(
|
||||||
|
'el-tag',
|
||||||
|
{
|
||||||
|
props: {
|
||||||
|
type: 'success',
|
||||||
|
size: 'small'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
params.row.approvedCount ? params.row.approvedCount + '次' : '0次'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'refusedCount',
|
||||||
|
key: '审批不通过次数',
|
||||||
|
render: (h, params) => {
|
||||||
|
return h(
|
||||||
|
'el-tag',
|
||||||
|
{
|
||||||
|
props: {
|
||||||
|
type: 'danger',
|
||||||
|
size: 'small'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
params.row.refusedCount ? params.row.refusedCount + '次' : '0次'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'ruleStatus',
|
prop: 'ruleStatus',
|
||||||
key: '规则状态',
|
key: '规则状态',
|
||||||
|
|||||||
@@ -59,14 +59,18 @@
|
|||||||
</r-dialog>
|
</r-dialog>
|
||||||
<send-phone-code
|
<send-phone-code
|
||||||
:visible.sync="phoneVisabled"
|
:visible.sync="phoneVisabled"
|
||||||
:resetPassword="true"
|
:resetPassword="!isLogin"
|
||||||
@handleSubmit="handleSubmit"
|
@handleSubmit="handleSubmit"
|
||||||
></send-phone-code>
|
></send-phone-code>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { updatePassword, verifyUpdatePassword } from '@/api/generatedApi/system'
|
import {
|
||||||
|
externalUpdatePassword,
|
||||||
|
updatePassword,
|
||||||
|
verifyUpdatePassword
|
||||||
|
} from '@/api/generatedApi/system'
|
||||||
import SendPhoneCode from '@/generatedComponents/send-phone-code.vue'
|
import SendPhoneCode from '@/generatedComponents/send-phone-code.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -84,6 +88,14 @@ export default {
|
|||||||
hideDialog: {
|
hideDialog: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
isLogin: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
userName: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -121,23 +133,39 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSubmit(code) {
|
handleSubmit(code) {
|
||||||
verifyUpdatePassword({
|
if (!this.isLogin) {
|
||||||
userPassword: this.form.userPassword,
|
verifyUpdatePassword({
|
||||||
newPassword: this.form.newPassword,
|
userPassword: this.form.userPassword,
|
||||||
smsCode: code
|
newPassword: this.form.newPassword,
|
||||||
}).then(async res => {
|
smsCode: code
|
||||||
if (res) {
|
}).then(async res => {
|
||||||
if (!this.hideDialog) {
|
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')
|
||||||
} else {
|
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
||||||
this.$message.success('密码修改成功')
|
} else {
|
||||||
await this.$store.dispatch('user/logout')
|
this.$message.success('密码修改成功')
|
||||||
|
await this.$store.dispatch('user/logout')
|
||||||
|
this.phoneVisabled = false
|
||||||
|
this.handleClose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
externalUpdatePassword({
|
||||||
|
username: this.userName,
|
||||||
|
userPassword: this.form.userPassword,
|
||||||
|
newPassword: this.form.newPassword,
|
||||||
|
smsCode: code
|
||||||
|
}).then(res => {
|
||||||
|
if (res) {
|
||||||
|
this.$message.success('修改密码成功')
|
||||||
|
this.phoneVisabled = false
|
||||||
this.handleClose()
|
this.handleClose()
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
},
|
},
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.$refs.form.resetFields()
|
this.$refs.form.resetFields()
|
||||||
@@ -146,34 +174,38 @@ export default {
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.form.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
if (!this.isLogin) {
|
||||||
const data = {
|
this.loading = true
|
||||||
userPassword: this.form.userPassword,
|
const data = {
|
||||||
newPassword: this.form.newPassword
|
userPassword: this.form.userPassword,
|
||||||
}
|
newPassword: this.form.newPassword
|
||||||
|
}
|
||||||
|
|
||||||
updatePassword(data)
|
updatePassword(data)
|
||||||
.then(async res => {
|
.then(async res => {
|
||||||
let number = Number(res.content.result)
|
let number = Number(res.content.result)
|
||||||
switch (number) {
|
switch (number) {
|
||||||
case 0:
|
case 0:
|
||||||
this.$message.success('密码修改成功')
|
this.$message.success('密码修改成功')
|
||||||
await this.$store.dispatch('user/logout')
|
await this.$store.dispatch('user/logout')
|
||||||
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
||||||
break
|
break
|
||||||
case 51001:
|
case 51001:
|
||||||
this.phoneVisabled = true
|
this.phoneVisabled = true
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
this.$message.error(res.content.resultMessage)
|
this.$message.error(res.content.resultMessage)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message.error('系统异常,请联系管理员')
|
this.$message.error('系统异常,请联系管理员')
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
this.phoneVisabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user