chore: 更改校验
This commit is contained in:
parent
8b48fb304e
commit
29d24b49e3
@ -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',
|
||||
|
@ -53,12 +53,15 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
drawerApi.drawerLoading(true);
|
||||
/**
|
||||
* 这里解构出来的values只能获取到自定义校验参数的值
|
||||
* 需要自行调用formApi.getValues()获取表单值
|
||||
*/
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = await formApi.getValues();
|
||||
console.log(data);
|
||||
await (isUpdate.value ? ossConfigUpdate(data) : ossConfigAdd(data));
|
||||
emit('reload');
|
||||
await handleCancel();
|
||||
|
Loading…
Reference in New Issue
Block a user