From 3fcb20d24cec35902bba15706e37c5936760162b Mon Sep 17 00:00:00 2001 From: John Bro <42930107+john1298308460@users.noreply.github.com> Date: Tue, 23 Apr 2024 22:10:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9B=E5=BB=BA=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=BD=BF=E7=94=A8=E7=9B=B8=E5=90=8C=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=20(#4669)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #4624 --- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + .../src/views/website/website/create/index.vue | 18 +++++++++++++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 2600edbfc..21179b14e 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1936,6 +1936,7 @@ const message = { acmeAccountType: 'Account Type', keyType: 'Key algorithm', tencentCloud: 'Tencent Cloud', + containWarn: 'The domain name contains the main domain, please re-enter', }, php: { short_open_tag: 'Short tag support', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index d5c5f3e43..14c35f71c 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1811,6 +1811,7 @@ const message = { acmeAccountType: '賬號類型', keyType: '密鑰演算法', tencentCloud: '騰訊雲', + containWarn: '其他域名中包含主域名,请重新輸入', }, php: { short_open_tag: '短標簽支持', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 14b9c124e..a8befb235 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1811,6 +1811,7 @@ const message = { acmeAccountType: '账号类型', keyType: '密钥算法', tencentCloud: '腾讯云', + containWarn: '其他域名中包含主域名,请重新输入', }, php: { short_open_tag: '短标签支持', diff --git a/frontend/src/views/website/website/create/index.vue b/frontend/src/views/website/website/create/index.vue index 7ac01b48a..bdddd4616 100644 --- a/frontend/src/views/website/website/create/index.vue +++ b/frontend/src/views/website/website/create/index.vue @@ -349,7 +349,7 @@ import { ElForm, FormInstance } from 'element-plus'; import { reactive, ref } from 'vue'; import Params from '@/views/app-store/detail/params/index.vue'; import Check from '../check/index.vue'; -import { MsgSuccess } from '@/utils/message'; +import { MsgError, MsgSuccess } from '@/utils/message'; import { GetGroupList } from '@/api/modules/group'; import { Group } from '@/api/interface/group'; import { SearchRuntimes } from '@/api/modules/runtime'; @@ -582,6 +582,16 @@ const changeAppType = (type: string) => { } }; +function isSubsetOfStrArray(primaryDomain: string, otherDomains: string): boolean { + const arr: string[] = otherDomains.split('\n'); + for (const item of arr) { + if (primaryDomain === item) { + return false; + } + } + return true; +} + const submit = async (formEl: FormInstance | undefined) => { if (!formEl) return; await formEl.validate((valid) => { @@ -589,6 +599,12 @@ const submit = async (formEl: FormInstance | undefined) => { return; } loading.value = true; + const flag = isSubsetOfStrArray(website.value.primaryDomain, website.value.otherDomains); + if (!flag) { + MsgError(i18n.global.t('website.containWarn')); + loading.value = false; + return false; + } PreCheck({}) .then((res) => { if (res.data) {