update: 增加密码校验

This commit is contained in:
admin 2024-05-11 14:32:42 +08:00
parent f3fd202083
commit 7402e4ee5c
1 changed files with 16 additions and 1 deletions

View File

@ -32,7 +32,7 @@
clearable clearable
:customStyle="{}" :customStyle="{}"
border="none" border="none"
:maxlength="item.key === 'password' ? 6 : -1" :maxlength="item.key === 'password' ? 8 : -1"
@change="(e:any) => {handleInput(e, item)}" @change="(e:any) => {handleInput(e, item)}"
:disabled="item.type === 'select'" :disabled="item.type === 'select'"
:disabledColor="['性别', '用户角色'].indexOf(item.name) > -1?'#ffffff':'#f5f7fa'" :disabledColor="['性别', '用户角色'].indexOf(item.name) > -1?'#ffffff':'#f5f7fa'"
@ -82,6 +82,12 @@ const handleInput = (e: any, item: any) => {
model1.formData[item.key] = temp; model1.formData[item.key] = temp;
}, 10); }, 10);
} }
if (item.key === "password") {
const temp = e?.replace(valid.valid_no_cn, "");
setTimeout(() => {
(model1.formData as any)[item.key] = temp;
}, 10);
}
}; };
const model1 = reactive<any>({ const model1 = reactive<any>({
formData: { formData: {
@ -205,6 +211,15 @@ const save = () => {
return; return;
} }
} }
if (model1.formData.password) {
if (!valid.valid_password.pattern.test(model1.formData.password)) {
uni.showToast({
icon: "none",
title: valid.valid_password.message,
});
return;
}
}
check().then((res) => { check().then((res) => {
if (res) { if (res) {
startSave(); startSave();