pref: validation optimization of many edit form. (#223)

pull/230/head
弥枳 2020-08-08 10:10:21 +08:00 committed by GitHub
parent 3e872b551b
commit d72fe025c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 62 additions and 62 deletions

View File

@ -562,7 +562,7 @@ export default {
selectedComment: {},
replyComment: {},
replyCommentRules: {
content: [{ required: true, message: '* 内容不能为空', trigger: ['change', 'blur'] }]
content: [{ required: true, message: '* 内容不能为空', trigger: ['change'] }]
},
loading: false,
commentStatus: commentApi.commentStatus,

View File

@ -279,15 +279,15 @@ export default {
errored: false,
rules: {
name: [
{ required: true, message: '* 菜单名称不能为空', trigger: ['change', 'blur'] },
{ max: 50, message: '* 菜单名称的字符长度不能超过 50', trigger: ['change', 'blur'] }
{ required: true, message: '* 菜单名称不能为空', trigger: ['change'] },
{ max: 50, message: '* 菜单名称的字符长度不能超过 50', trigger: ['change'] }
],
url: [
{ required: true, message: '* 菜单地址不能为空', trigger: ['change', 'blur'] },
{ max: 1023, message: '* 菜单地址的字符长度不能超过 1023', trigger: ['change', 'blur'] }
{ required: true, message: '* 菜单地址不能为空', trigger: ['change'] },
{ max: 1023, message: '* 菜单地址的字符长度不能超过 1023', trigger: ['change'] }
],
icon: [{ max: 50, message: '* 菜单图标的字符长度不能超过 50', trigger: ['change', 'blur'] }],
team: [{ max: 255, message: '* 菜单分组的字符长度不能超过 255', trigger: ['change', 'blur'] }]
icon: [{ max: 50, message: '* 菜单图标的字符长度不能超过 50', trigger: ['change'] }],
team: [{ max: 255, message: '* 菜单分组的字符长度不能超过 255', trigger: ['change'] }]
},
moreField: false
},

View File

@ -308,12 +308,12 @@ export default {
errored: false,
rules: {
name: [
{ required: true, message: '* 分类名称不能为空', trigger: ['change', 'blur'] },
{ max: 255, message: '* 分类名称的字符长度不能超过 255', trigger: ['change', 'blur'] }
{ required: true, message: '* 分类名称不能为空', trigger: ['change'] },
{ max: 255, message: '* 分类名称的字符长度不能超过 255', trigger: ['change'] }
],
slug: [{ max: 255, message: '* 分类别名的字符长度不能超过 255', trigger: ['change', 'blur'] }],
thumbnail: [{ max: 1023, message: '* 封面图链接的字符长度不能超过 1023', trigger: ['change', 'blur'] }],
description: [{ max: 100, message: '* 分类描述的字符长度不能超过 100', trigger: ['change', 'blur'] }]
slug: [{ max: 255, message: '* 分类别名的字符长度不能超过 255', trigger: ['change'] }],
thumbnail: [{ max: 1023, message: '* 封面图链接的字符长度不能超过 1023', trigger: ['change'] }],
description: [{ max: 100, message: '* 分类描述的字符长度不能超过 100', trigger: ['change'] }]
}
},
thumbnailDrawer: {

View File

@ -150,11 +150,11 @@ export default {
errored: false,
rules: {
name: [
{ required: true, message: '* 标签名称不能为空', trigger: ['change', 'blur'] },
{ max: 255, message: '* 标签名称的字符长度不能超过 255', trigger: ['change', 'blur'] }
{ required: true, message: '* 标签名称不能为空', trigger: ['change'] },
{ max: 255, message: '* 标签名称的字符长度不能超过 255', trigger: ['change'] }
],
slug: [{ max: 255, message: '* 标签别名的字符长度不能超过 255', trigger: ['change', 'blur'] }],
thumbnail: [{ max: 1023, message: '* 封面图链接的字符长度不能超过 1023', trigger: ['change', 'blur'] }]
slug: [{ max: 255, message: '* 标签别名的字符长度不能超过 255', trigger: ['change'] }],
thumbnail: [{ max: 1023, message: '* 封面图链接的字符长度不能超过 1023', trigger: ['change'] }]
}
},
thumbnailDrawer: {

View File

@ -311,17 +311,17 @@ export default {
errored: false,
rules: {
name: [
{ required: true, message: '* 友情链接名称不能为空', trigger: ['change', 'blur'] },
{ max: 255, message: '* 友情链接名称的字符长度不能超过 255', trigger: ['change', 'blur'] }
{ required: true, message: '* 友情链接名称不能为空', trigger: ['change'] },
{ max: 255, message: '* 友情链接名称的字符长度不能超过 255', trigger: ['change'] }
],
url: [
{ required: true, message: '* 友情链接地址不能为空', trigger: ['change', 'blur'] },
{ max: 1023, message: '* 友情链接地址的字符长度不能超过 1023', trigger: ['change', 'blur'] },
{ type: 'url', message: '* 友情链接地址格式有误', trigger: ['change', 'blur'] }
{ required: true, message: '* 友情链接地址不能为空', trigger: ['change'] },
{ max: 1023, message: '* 友情链接地址的字符长度不能超过 1023', trigger: ['change'] },
{ type: 'url', message: '* 友情链接地址格式有误', trigger: ['change'] }
],
logo: [{ max: 1023, message: '* 友情链接 Logo 的字符长度不能超过 1023', trigger: ['change', 'blur'] }],
description: [{ max: 255, message: '* 友情链接描述的字符长度不能超过 255', trigger: ['change', 'blur'] }],
team: [{ max: 255, message: '* 友情链接分组的字符长度 255', trigger: ['change', 'blur'] }]
logo: [{ max: 1023, message: '* 友情链接 Logo 的字符长度不能超过 1023', trigger: ['change'] }],
description: [{ max: 255, message: '* 友情链接描述的字符长度不能超过 255', trigger: ['change'] }],
team: [{ max: 255, message: '* 友情链接分组的字符长度 255', trigger: ['change'] }]
}
},
optionsModal: {

View File

@ -234,34 +234,34 @@ export default {
generalRules: {
username: [
{ required: true, message: '* 用户名不能为空', trigger: ['change', 'blur'] },
{ max: 50, message: '* 用户名的字符长度不能超过 50', trigger: ['change', 'blur'] }
{ required: true, message: '* 用户名不能为空', trigger: ['change'] },
{ max: 50, message: '* 用户名的字符长度不能超过 50', trigger: ['change'] }
],
nickname: [
{ required: true, message: '* 用户昵称不能为空', trigger: ['change', 'blur'] },
{ max: 255, message: '* 用户昵称的字符长度不能超过 255', trigger: ['change', 'blur'] }
{ required: true, message: '* 用户昵称不能为空', trigger: ['change'] },
{ max: 255, message: '* 用户昵称的字符长度不能超过 255', trigger: ['change'] }
],
email: [
{ required: true, message: '* 电子邮件地址不能为空', trigger: ['change', 'blur'] },
{ max: 127, message: '* 电子邮件地址的字符长度不能超过 127', trigger: ['change', 'blur'] },
{ required: true, message: '* 电子邮件地址不能为空', trigger: ['change'] },
{ max: 127, message: '* 电子邮件地址的字符长度不能超过 127', trigger: ['change'] },
{
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/g,
message: '* 电子邮件地址的格式不正确',
trigger: ['change', 'blur']
trigger: ['change']
}
],
password: [
{ required: true, message: '* 密码不能为空', trigger: ['change', 'blur'] },
{ min: 8, max: 100, message: '* 密码的字符长度必须在 8 - 100 之间', trigger: ['change', 'blur'] }
{ required: true, message: '* 密码不能为空', trigger: ['change'] },
{ min: 8, max: 100, message: '* 密码的字符长度必须在 8 - 100 之间', trigger: ['change'] }
],
confirmPassword: [
{ required: true, message: '* 确认密码不能为空', trigger: ['change', 'blur'] },
{ validator: confirmPasswordValidate, trigger: ['change', 'blur'] }
{ required: true, message: '* 确认密码不能为空', trigger: ['change'] },
{ validator: confirmPasswordValidate, trigger: ['change'] }
]
},
blogRules: {
url: [{ required: true, message: '* 博客地址不能为空', trigger: ['change', 'blur'] }],
title: [{ required: true, message: '* 博客标题不能为空', trigger: ['change', 'blur'] }]
url: [{ required: true, message: '* 博客地址不能为空', trigger: ['change'] }],
title: [{ required: true, message: '* 博客标题不能为空', trigger: ['change'] }]
}
}
},

View File

@ -114,22 +114,22 @@ export default {
},
rules: {
blog_title: [
{ required: true, message: '* 博客标题不能为空', trigger: ['change', 'blur'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change', 'blur'] }
{ required: true, message: '* 博客标题不能为空', trigger: ['change'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change'] }
],
blog_url: [
{ required: true, message: '* 博客地址不能为空', trigger: ['change', 'blur'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change', 'blur'] }
{ required: true, message: '* 博客地址不能为空', trigger: ['change'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change'] }
],
blog_logo: [
{ type: 'url', message: '* 链接格式不正确', trigger: ['change', 'blur'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change', 'blur'] }
{ type: 'url', message: '* 链接格式不正确', trigger: ['change'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change'] }
],
blog_favicon: [
{ type: 'url', message: '* 链接格式不正确', trigger: ['change', 'blur'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change', 'blur'] }
{ type: 'url', message: '* 链接格式不正确', trigger: ['change'] },
{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change'] }
],
blog_footer_info: [{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change', 'blur'] }]
blog_footer_info: [{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change'] }]
}
}
},

View File

@ -73,8 +73,8 @@ export default {
xs: { span: 24 }
},
rules: {
seo_keywords: [{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change', 'blur'] }],
seo_description: [{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change', 'blur'] }]
seo_keywords: [{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change'] }],
seo_description: [{ max: 1023, message: '* 字符数不能超过 1023', trigger: ['change'] }]
}
}
},

View File

@ -387,19 +387,19 @@ export default {
errored: false,
rules: {
username: [
{ required: true, message: '* 用户名不能为空', trigger: ['change', 'blur'] },
{ max: 50, message: '* 用户名的字符长度不能超过 50', trigger: ['change', 'blur'] }
{ required: true, message: '* 用户名不能为空', trigger: ['change'] },
{ max: 50, message: '* 用户名的字符长度不能超过 50', trigger: ['change'] }
],
nickname: [
{ required: true, message: '* 用户昵称不能为空', trigger: ['change', 'blur'] },
{ max: 255, message: '* 用户昵称的字符长度不能超过 255', trigger: ['change', 'blur'] }
{ required: true, message: '* 用户昵称不能为空', trigger: ['change'] },
{ max: 255, message: '* 用户昵称的字符长度不能超过 255', trigger: ['change'] }
],
email: [
{ required: true, message: '* 电子邮箱地址不能为空', trigger: ['change', 'blur'] },
{ type: 'email', message: '* 电子邮箱地址格式不正确', trigger: ['change', 'blur'] },
{ max: 127, message: '* 电子邮箱的字符长度不能超过 255', trigger: ['change', 'blur'] }
{ required: true, message: '* 电子邮箱地址不能为空', trigger: ['change'] },
{ type: 'email', message: '* 电子邮箱地址格式不正确', trigger: ['change'] },
{ max: 127, message: '* 电子邮箱的字符长度不能超过 255', trigger: ['change'] }
],
description: [{ max: 1023, message: '* 个人说明的字符长度不能超过 1023', trigger: ['change', 'blur'] }]
description: [{ max: 1023, message: '* 个人说明的字符长度不能超过 1023', trigger: ['change'] }]
}
},
statistics: {
@ -416,16 +416,16 @@ export default {
errored: false,
rules: {
oldPassword: [
{ required: true, message: '* 原密码不能为空', trigger: ['change', 'blur'] },
{ required: true, message: '* 原密码不能为空', trigger: ['change'] },
{ max: 100, min: 8, message: '* 密码的字符长度必须在 8 - 100 之间', trigger: ['blur'] }
],
newPassword: [
{ required: true, message: '* 新密码不能为空', trigger: ['change', 'blur'] },
{ max: 100, min: 8, message: '* 密码的字符长度必须在 8 - 100 之间', trigger: ['change', 'blur'] }
{ required: true, message: '* 新密码不能为空', trigger: ['change'] },
{ max: 100, min: 8, message: '* 密码的字符长度必须在 8 - 100 之间', trigger: ['change'] }
],
confirmPassword: [
{ required: true, message: '* 确认密码不能为空', trigger: ['change', 'blur'] },
{ validator: validateConfirmPassword, trigger: ['change', 'blur'] }
{ required: true, message: '* 确认密码不能为空', trigger: ['change'] },
{ validator: validateConfirmPassword, trigger: ['change'] }
]
}
},
@ -444,7 +444,7 @@ export default {
checked: false
},
rules: {
authcode: [{ required: true, message: '* 两步验证码不能为空', trigger: ['change', 'blur'] }]
authcode: [{ required: true, message: '* 两步验证码不能为空', trigger: ['change'] }]
},
saving: false,
errored: false