mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-18 22:22:59 +08:00
feat: 修改正则表达式
This commit is contained in:
parent
b7d55801cd
commit
5b7872d896
@ -67,6 +67,19 @@ const checkLinuxName = (rule: any, value: any, callback: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
const checkDomain = (rule: any, value: any, callback: any) => {
|
||||
if (value === '' || typeof value === 'undefined' || value == null) {
|
||||
callback(new Error(i18n.global.t('commons.rule.domain')));
|
||||
} else {
|
||||
const reg = /^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/;
|
||||
if (!reg.test(value) && value !== '') {
|
||||
callback(new Error(i18n.global.t('commons.rule.domain')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
interface CommonRule {
|
||||
requiredInput: FormItemRule;
|
||||
requiredSelect: FormItemRule;
|
||||
@ -79,6 +92,7 @@ interface CommonRule {
|
||||
number: FormItemRule;
|
||||
ip: FormItemRule;
|
||||
port: FormItemRule;
|
||||
domain: FormItemRule;
|
||||
}
|
||||
|
||||
export const Rules: CommonRule = {
|
||||
@ -145,4 +159,9 @@ export const Rules: CommonRule = {
|
||||
type: 'number',
|
||||
message: i18n.global.t('commons.rule.port'),
|
||||
},
|
||||
domain: {
|
||||
required: true,
|
||||
validator: checkDomain,
|
||||
trigger: 'blur',
|
||||
},
|
||||
};
|
||||
|
@ -104,12 +104,13 @@ export default {
|
||||
imageName: '支持英文、中文、数字、:.-_,长度1-30',
|
||||
complexityPassword: '请输入 8 位以上、必须含有字母、数字、特殊符号的密码',
|
||||
commonPassword: '请输入 6 位以上长度密码',
|
||||
linuxName: '支持英文、数字、._,长度1-30',
|
||||
linuxName: '支持英文、数字、._长度1-30',
|
||||
email: '请输入正确的邮箱',
|
||||
number: '请输入正确的数字',
|
||||
ip: '请输入正确的 IP 地址',
|
||||
port: '请输入正确的端口',
|
||||
selectHelper: '请选择正确的 {0} 文件',
|
||||
domain: '域名格式错误',
|
||||
},
|
||||
res: {
|
||||
paramError: '请求失败,请稍后重试!',
|
||||
|
@ -169,7 +169,7 @@ let rules = reactive({
|
||||
appType: [Rules.requiredInput],
|
||||
proxy: [Rules.requiredInput],
|
||||
appinstall: {
|
||||
name: [Rules.linuxName],
|
||||
name: [Rules.name],
|
||||
appId: [Rules.requiredSelectBusiness],
|
||||
params: {},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user