From 8e76c9603a20bb88692d8e7d456545acbbd54f02 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Wed, 8 Mar 2023 22:28:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E9=99=90=E5=88=B6?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/global/form-rules.ts | 24 +++++++++++++------ .../views/app-store/detail/params/index.vue | 2 +- .../views/website/website/create/index.vue | 14 ++++++++++- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/frontend/src/global/form-rules.ts b/frontend/src/global/form-rules.ts index 6a252502a..e3d41542a 100644 --- a/frontend/src/global/form-rules.ts +++ b/frontend/src/global/form-rules.ts @@ -108,11 +108,11 @@ const checkVolumeName = (rule: any, value: any, callback: any) => { const checkLinuxName = (rule: any, value: any, callback: any) => { if (value === '' || typeof value === 'undefined' || value == null) { - callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?"<>|']))); + callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?\'"<>|']))); } else { - const reg = /^((?!\\|\/|:|\*|\?|<|>|\||'|%).){1,30}$/; + const reg = /^[^/\\\"'|<>?*]{1,30}$/; if (!reg.test(value) && value !== '') { - callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?"<>|']))); + callback(new Error(i18n.global.t('commons.rule.linuxName', ['/\\:*?\'"<>|']))); } else { callback(); } @@ -186,6 +186,19 @@ const checkParamUrlAndPort = (rule: any, value: any, callback: any) => { } }; +const checkPort = (rule: any, value: any, callback: any) => { + if (value === '' || typeof value === 'undefined' || value == null) { + callback(new Error(i18n.global.t('commons.rule.port'))); + } else { + const reg = /^([1-9](\d{0,3}))$|^([1-5]\d{4})$|^(6[0-4]\d{3})$|^(65[0-4]\d{2})$|^(655[0-2]\d)$|^(6553[0-5])$/; + if (!reg.test(value) && value !== '') { + callback(new Error(i18n.global.t('commons.rule.port'))); + } else { + callback(); + } + } +}; + const checkDoc = (rule: any, value: any, callback: any) => { if (value === '' || typeof value === 'undefined' || value == null) { callback(new Error(i18n.global.t('commons.rule.nginxDoc'))); @@ -343,10 +356,7 @@ export const Rules: CommonRule = { paramPort: { required: true, trigger: 'blur', - min: 1, - max: 65535, - type: 'number', - message: i18n.global.t('commons.rule.port'), + validator: checkPort, }, paramExtUrl: { required: true, diff --git a/frontend/src/views/app-store/detail/params/index.vue b/frontend/src/views/app-store/detail/params/index.vue index b112bd947..b1fe98281 100644 --- a/frontend/src/views/app-store/detail/params/index.vue +++ b/frontend/src/views/app-store/detail/params/index.vue @@ -9,7 +9,7 @@ :disabled="p.disabled" > { em('close', false); }; +const changeType = (type: string) => { + if (type == 'deployemnt') { + if (appInstalles.value && appInstalles.value.length > 0) { + website.value.appInstallId = appInstalles.value[0].id; + console.log(website.value); + } + } else { + website.value.appInstallId = undefined; + } + website.value.type = type; +}; + const searchAppInstalled = () => { GetAppInstalled({ type: 'website', unused: true }).then((res) => { appInstalles.value = res.data;