用户重置密码加确认弹框

This commit is contained in:
fengachen
2021-09-29 09:42:07 +08:00
parent 67d36021e1
commit ed15b9780d
3 changed files with 16 additions and 8 deletions
+2 -2
View File
@@ -25,10 +25,10 @@ export function isURL(s) {
/** /**
* 密码 * 密码
* message: 密码长度至少8位,并包括数字、小写字母、大写字母和特殊符号4类中的3类 * message: 密码长度至少8位,并包括数字、小写字母、大写字母和特殊符号4类
*/ */
export function passwordReg(s) { export function passwordReg(s) {
return /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,30}$/.test(s) return /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,30}$/.test(s)
} }
/** /**
+13 -5
View File
@@ -304,13 +304,21 @@ export default {
* 重置密码 * 重置密码
* */ * */
resetPassword(record) { resetPassword(record) {
resetUserPassword({ username: record.username }).then(res => { const that = this
if (res.success) { this.$confirm({
this.$message.success(res.message) title: '确认重置密码',
} else { content: '是否重置该用户密码',
this.$message.warning(res.message) onOk: function () {
resetUserPassword({ username: record.username }).then(res => {
if (res.success) {
that.$message.success(res.message)
} else {
that.$message.warning(res.message)
}
})
} }
}) })
}, },
/* /*
* 启用禁用 * 启用禁用
+1 -1
View File
@@ -574,7 +574,7 @@ export default {
callback() callback()
} }
if (!passwordReg(value)) { if (!passwordReg(value)) {
callback('密码长度至少8位,并包括数字、小写字母、大写字母和特殊符号4类中的3类') callback('密码长度至少8位,并包括数字、小写字母、大写字母和特殊符号4类')
} }
if (value && this.confirmDirty) { if (value && this.confirmDirty) {
form.validateFields(['confirm'], {force: true}) form.validateFields(['confirm'], {force: true})