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

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