From fe7fed02eead95c30509dd88d2e498e42cfb9513 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:14:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=20(#2016)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/index.html | 2 +- .../views/setting/panel/systemip/index.vue | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 3941e1ef0..2fd4c0993 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,5 +1,5 @@ - + diff --git a/frontend/src/views/setting/panel/systemip/index.vue b/frontend/src/views/setting/panel/systemip/index.vue index 179df16e2..957f9f268 100644 --- a/frontend/src/views/setting/panel/systemip/index.vue +++ b/frontend/src/views/setting/panel/systemip/index.vue @@ -4,10 +4,17 @@ - + - + {{ $t('commons.rule.hostHelper') }} @@ -31,8 +38,8 @@ import i18n from '@/lang'; import { MsgSuccess } from '@/utils/message'; import { updateSetting } from '@/api/modules/setting'; import { FormInstance } from 'element-plus'; -import { Rules } from '@/global/form-rules'; import DrawerHeader from '@/components/drawer-header/index.vue'; +import { checkDomain, checkIpV4V6 } from '@/utils/util'; const emit = defineEmits<{ (e: 'search'): void }>(); @@ -47,6 +54,18 @@ const form = reactive({ }); const formRef = ref(); +const rules = reactive({ + systemIP: [{ validator: checkSystemIP, trigger: 'blur' }], +}); + +function checkSystemIP(rule: any, value: any, callback: any) { + if (form.systemIP !== '') { + if (checkIpV4V6(form.systemIP) && checkDomain(form.systemIP)) { + return callback(new Error(i18n.global.t('commons.rule.host'))); + } + } + callback(); +} const acceptParams = (params: DialogProps): void => { form.systemIP = params.systemIP;