Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

perf: adding the necessary validation to the forms #701

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ watch(
label="名称"
type="text"
name="displayName"
validation="required"
validation="required|length:0,50"
></FormKit>
</FormKit>
<template #footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const onVisibleChange = (visible: boolean) => {
label="名称"
type="text"
name="displayName"
validation="required"
validation="required|length:0,50"
></FormKit>
<FormKitSchema
:schema="formSchema"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ watchEffect(() => {
:id="contentInputId"
v-model="formState.raw"
type="textarea"
validation="required"
validation-label="内容"
:rows="6"
validation="required|length:0,1024"
></FormKit>
</FormKit>
<div class="mt-2 flex justify-end">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ const { templates } = useThemeCustomTemplates("page");
label="标题"
type="text"
name="title"
validation="required"
validation="required|length:0,100"
></FormKit>
<FormKit
v-model="formState.spec.slug"
label="别名"
name="slug"
type="text"
validation="required"
validation="required|length:0,100"
></FormKit>
<FormKit
v-model="formState.spec.excerpt.autoGenerate"
Expand All @@ -216,6 +216,7 @@ const { templates } = useThemeCustomTemplates("page");
name="raw"
label="自定义摘要"
type="textarea"
validation="length:0,1024"
:rows="5"
></FormKit>
</FormKit>
Expand Down Expand Up @@ -277,6 +278,7 @@ const { templates } = useThemeCustomTemplates("page");
label="封面图"
type="attachment"
name="cover"
validation="length:0,1024"
></FormKit>
</FormKit>
<!--TODO: add SEO/Metas/Inject Code form-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ const { templates } = useThemeCustomTemplates("category");
name="displayName"
label="名称"
type="text"
validation="required"
validation="required|length:0,50"
></FormKit>
<FormKit
v-model="formState.spec.slug"
help="通常作为分类访问地址标识"
name="slug"
label="别名"
type="text"
validation="required"
validation="required|length:0,50"
></FormKit>
<FormKit
v-model="formState.spec.template"
Expand All @@ -163,14 +163,15 @@ const { templates } = useThemeCustomTemplates("category");
name="cover"
label="封面图"
type="attachment"
validation="required"
validation="length:0,1024"
></FormKit>
<FormKit
v-model="formState.spec.description"
name="description"
help="需要主题适配以支持"
label="描述"
type="textarea"
validation="length:0,200"
></FormKit>
</FormKit>
<template #footer>
Expand Down
6 changes: 4 additions & 2 deletions src/modules/contents/posts/components/PostSettingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ const { templates } = useThemeCustomTemplates("post");
label="标题"
type="text"
name="title"
validation="required"
validation="required|length:0,100"
></FormKit>
<FormKit
v-model="formState.spec.slug"
label="别名"
name="slug"
type="text"
validation="required"
validation="required|length:0,100"
></FormKit>
<FormKit
v-model="formState.spec.categories"
Expand Down Expand Up @@ -219,6 +219,7 @@ const { templates } = useThemeCustomTemplates("post");
name="raw"
type="textarea"
:rows="5"
validation="length:0,1024"
></FormKit>
</FormKit>
</VTabItem>
Expand Down Expand Up @@ -277,6 +278,7 @@ const { templates } = useThemeCustomTemplates("post");
name="cover"
label="封面图"
type="attachment"
validation="length:0,1024"
></FormKit>
</FormKit>
<!--TODO: add SEO/Metas/Inject Code form-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,31 @@ watch(
name="displayName"
label="名称"
type="text"
validation="required"
validation="required|length:0,50"
></FormKit>
<FormKit
v-model="formState.spec.slug"
help="通常作为标签访问地址标识"
label="别名"
name="slug"
type="text"
validation="required"
validation="required|length:0,50"
></FormKit>
<FormKit
v-model="formState.spec.color"
name="color"
help="需要主题适配以支持"
label="颜色"
type="color"
validation="length:0,50"
></FormKit>
<FormKit
v-model="formState.spec.cover"
name="cover"
help="需要主题适配以支持"
label="封面图"
type="attachment"
validation="length:0,1024"
></FormKit>
</FormKit>
<template #footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ watch(
label="菜单名称"
type="text"
name="displayName"
validation="required"
validation="required|length:0,100"
></FormKit>
</FormKit>
<template #footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ const onMenuItemSourceChange = () => {
label="名称"
type="text"
name="displayName"
validation="required"
validation="required|length:0,100"
/>

<FormKit
Expand All @@ -275,7 +275,7 @@ const onMenuItemSourceChange = () => {
label="链接地址"
type="text"
name="href"
validation="required"
validation="required|length:0,1024"
/>

<FormKit
Expand Down
2 changes: 1 addition & 1 deletion src/modules/system/roles/components/RoleEditingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const handleResetForm = () => {
"
label="名称"
type="text"
validation="required"
validation="required|length:0,50"
></FormKit>
</FormKit>
</VTabItem>
Expand Down
10 changes: 6 additions & 4 deletions src/modules/system/users/components/UserEditingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,41 +171,43 @@ const handleRawModeChange = () => {
label="用户名"
type="text"
name="name"
validation="required"
validation="required|alphanumeric|length:0,50"
></FormKit>
<FormKit
id="displayNameInput"
v-model="formState.spec.displayName"
label="显示名称"
type="text"
name="displayName"
validation="required"
validation="required|length:0,50"
></FormKit>
<FormKit
v-model="formState.spec.email"
label="电子邮箱"
type="email"
name="email"
validation="required|email"
validation="required|email|length:0,100"
></FormKit>
<FormKit
v-model="formState.spec.phone"
label="手机号"
type="text"
name="phone"
validation="length:0,20"
></FormKit>
<FormKit
v-model="formState.spec.avatar"
label="头像"
type="attachment"
name="avatar"
validation="url"
validation="url|length:0,1024"
></FormKit>
<FormKit
v-model="formState.spec.bio"
label="描述"
type="textarea"
name="bio"
validation="length:0,2048"
></FormKit>
</FormKit>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ const handleChangePassword = async () => {
label="新密码"
name="password"
type="password"
validation="required"
validation="required|length:0,100"
></FormKit>
<FormKit
label="确认密码"
name="password_confirm"
type="password"
validation="required|confirm"
validation="required|confirm|length:0,50"
></FormKit>
</FormKit>
<template #footer>
Expand Down
2 changes: 1 addition & 1 deletion src/views/system/Setup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ onMounted(async () => {
}"
type="text"
placeholder="站点名称"
validation="required"
validation="required|length:0,100"
></FormKit>
</FormKit>
<VButton
Expand Down