Commit 92907699 authored by 皮倩雯's avatar 皮倩雯

修改用户管理表单验证

parent cdf52348
Pipeline #32437 skipped with stages
...@@ -757,11 +757,7 @@ const WebDic = () => { ...@@ -757,11 +757,7 @@ const WebDic = () => {
<Form.Item <Form.Item
name='nodeName1' name='nodeName1'
label="名称" label="名称"
rules={ rules={[{ required: true, message: '不能为空' }]}
[
{ required: true, message: '不能为空' },
]
}
> >
<Input placeholder="请输入名称" /> <Input placeholder="请输入名称" />
</Form.Item> </Form.Item>
......
...@@ -38,9 +38,15 @@ const AddUserModal = props => { ...@@ -38,9 +38,15 @@ const AddUserModal = props => {
} else if (password.length < 6) { } else if (password.length < 6) {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
description: '密码至少为6位!', description: '密码至少为6位,且包含数字和字母!',
}); });
} else if (userName === '') { }
else if (password === '') {
notification.error({
message: '提交失败',
description: '密码不能为空!',
});
}else if (userName === '') {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
description: '用户名称不能为空!', description: '用户名称不能为空!',
...@@ -117,8 +123,14 @@ const AddUserModal = props => { ...@@ -117,8 +123,14 @@ const AddUserModal = props => {
label="账户密码" label="账户密码"
rules={[{ rules={[{
pattern: /^[^\s]*$/, pattern: /^[^\s]*$/,
message: '不能为空' }, message: '不能为空'
]} },
{
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/,
message: '密码长度必须大于6,且必须包含数字和字母'
}
]
}
> >
<Input placeholder="请输入账户密码,至少6位" /> <Input placeholder="请输入账户密码,至少6位" />
</Form.Item> </Form.Item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment