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;