chore: 更改校验

This commit is contained in:
dap
2024-09-20 08:39:21 +08:00
parent 8b48fb304e
commit 29d24b49e3
2 changed files with 8 additions and 15 deletions

View File

@@ -49,12 +49,10 @@ export const drawerSchema: FormSchemaGetter = () => [
addonBefore: () => (formModel.isHttps === 'Y' ? 'https://' : 'http://'),
}),
rules: z
.string({ message: '请输入服务地址' })
.refine(
(domain) =>
!(domain.startsWith('http://') || domain.startsWith('https://')),
{ message: '请输入正确的域名, 不需要http(s)' },
),
.string()
.refine((domain) => domain && !/^https?:\/\/.*/.test(domain), {
message: '请输入正确的域名, 不需要http(s)',
}),
},
{
component: 'Input',
@@ -63,14 +61,6 @@ export const drawerSchema: FormSchemaGetter = () => [
},
fieldName: 'domain',
label: '自定义域名',
rules: z
.string()
.refine(
(domain) =>
!(domain.startsWith('http://') || domain.startsWith('https://')),
{ message: '请输入正确的域名, 不需要http(s)' },
)
.optional(),
},
{
component: 'Divider',