|
|
|
@ -394,13 +394,24 @@ export function useUser() {
|
|
|
|
|
isIndeterminate.value = value.length !== allRole.value.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 密码正则(密码格式应为8-18位数字、字母、符号的任意两种组合) */
|
|
|
|
|
const REGEXP_PWD =
|
|
|
|
|
/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[()])+$)(?!^.*[\u4E00-\u9FA5].*$)([^(0-9a-zA-Z)]|[()]|[a-z]|[A-Z]|[0-9]){8,18}$/;
|
|
|
|
|
|
|
|
|
|
function resetPassword(row: { username: string; id: any }) {
|
|
|
|
|
ElMessageBox.prompt(
|
|
|
|
|
"请输入用户「" + row.username + "」的新密码",
|
|
|
|
|
"重置密码",
|
|
|
|
|
{
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
cancelButtonText: "取消"
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
inputValidator: val => {
|
|
|
|
|
if (val === null) {
|
|
|
|
|
return true; //初始化的值为null,不做处理的话,刚打开MessageBox就会校验出错,影响用户体验
|
|
|
|
|
}
|
|
|
|
|
return REGEXP_PWD.test(val);
|
|
|
|
|
},
|
|
|
|
|
inputErrorMessage: "密码格式应为8-18位数字、字母、符号的任意两种组合"
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.then(({ value }) => {
|
|
|
|
@ -409,6 +420,29 @@ export function useUser() {
|
|
|
|
|
type: "warning"
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
const params = {
|
|
|
|
|
id: row.id,
|
|
|
|
|
password: value
|
|
|
|
|
};
|
|
|
|
|
updateUser(params)
|
|
|
|
|
.then(res => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.success) {
|
|
|
|
|
message(`${res.msg}`, {
|
|
|
|
|
type: "success"
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
message(`${res.msg}`, {
|
|
|
|
|
type: "warning"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
message(`${error}`, {
|
|
|
|
|
type: "warning"
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {});
|
|
|
|
|