子域名和自定义域名可以二选一

This commit is contained in:
刘嘉伟 2024-09-25 10:48:43 +08:00
parent acbf075280
commit ed1f3dc378

View File

@ -238,6 +238,18 @@ const handleSubmit = async () => {
return; return;
} }
} }
if (
!(
editForm.value.subdomain ||
editForm.value.customDomains.filter(f => f !== "").length > 0
)
) {
ElMessage({
type: "warning",
message: "请至少添加一个 子域名 / 自定义域名"
});
return;
}
loading.value.form = 1; loading.value.form = 1;
const data = clone(editForm.value); const data = clone(editForm.value);
if (data._id) { if (data._id) {
@ -802,7 +814,7 @@ onUnmounted(() => {
</template> </template>
<template v-if="isHttp || isHttps"> <template v-if="isHttp || isHttps">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="子域名:" prop="remotePort"> <el-form-item label="子域名:" prop="subdomain">
<template #label> <template #label>
<div class="inline-block"> <div class="inline-block">
<div class="flex items-center"> <div class="flex items-center">
@ -846,11 +858,11 @@ onUnmounted(() => {
:label="di === 0 ? '自定义域名:' : ''" :label="di === 0 ? '自定义域名:' : ''"
:prop="`customDomains.${di}`" :prop="`customDomains.${di}`"
:rules="[ :rules="[
{ // {
required: true, // required: true,
message: `自定义域名不能为空`, // message: ``,
trigger: 'blur' // trigger: 'blur'
}, // },
{ {
pattern: pattern:
/^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/, /^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/,