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

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) {
@ -514,7 +526,7 @@ onUnmounted(() => {
class="mr-2" class="mr-2"
type="danger" type="danger"
size="small" size="small"
>已禁用 >已禁用
</el-tag> </el-tag>
<el-tag <el-tag
v-if=" v-if="
@ -529,7 +541,7 @@ onUnmounted(() => {
v-if=" v-if="
proxy.type === 'stcp' && proxy.stcpModel === 'visited' proxy.type === 'stcp' && proxy.stcpModel === 'visited'
" "
>被访问者 >被访问者
</el-tag> </el-tag>
<!-- <el-tag--> <!-- <el-tag-->
<!-- size="small"--> <!-- size="small"-->
@ -699,8 +711,8 @@ onUnmounted(() => {
<el-popover placement="top" trigger="hover" width="300"> <el-popover placement="top" trigger="hover" width="300">
<template #default> <template #default>
对应参数<span class="font-black text-[#5A3DAA]" 对应参数<span class="font-black text-[#5A3DAA]"
>secretKey</span >secretKey</span
> >
只有访问者与被访问者共享密钥一致的用户才能访问该服务 只有访问者与被访问者共享密钥一致的用户才能访问该服务
</template> </template>
<template #reference> <template #reference>
@ -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">
@ -814,8 +826,8 @@ onUnmounted(() => {
> >
<template #default> <template #default>
对应参数<span class="font-black text-[#5A3DAA]" 对应参数<span class="font-black text-[#5A3DAA]"
>subdomain</span >subdomain</span
> >
</template> </template>
<template #reference> <template #reference>
<IconifyIconOffline <IconifyIconOffline
@ -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})+$/,
@ -866,8 +878,8 @@ onUnmounted(() => {
<el-popover placement="top" trigger="hover"> <el-popover placement="top" trigger="hover">
<template #default> <template #default>
对应参数<span class="font-black text-[#5A3DAA]" 对应参数<span class="font-black text-[#5A3DAA]"
>customDomains</span >customDomains</span
> >
</template> </template>
<template #reference> <template #reference>
<IconifyIconOffline <IconifyIconOffline
@ -957,21 +969,21 @@ onUnmounted(() => {
<el-popover placement="top" trigger="hover" width="300"> <el-popover placement="top" trigger="hover" width="300">
<template #default> <template #default>
对应参数<span class="font-black text-[#5A3DAA]" 对应参数<span class="font-black text-[#5A3DAA]"
>bindAddr</span >bindAddr</span
> >
要将被访问者的服务绑定到本地哪个<span 要将被访问者的服务绑定到本地哪个<span
class="font-black text-[#5A3DAA]" class="font-black text-[#5A3DAA]"
>IP</span >IP</span
> >
<br /> <br />
仅本机访问<span class="font-black text-[#5A3DAA]" 仅本机访问<span class="font-black text-[#5A3DAA]"
>127.0.0.1</span >127.0.0.1</span
> >
<br /> <br />
支持局域网其他设备访问<span 支持局域网其他设备访问<span
class="font-black text-[#5A3DAA]" class="font-black text-[#5A3DAA]"
>0.0.0.0</span >0.0.0.0</span
> >
<br /> <br />
</template> </template>
<template #reference> <template #reference>
@ -1003,12 +1015,12 @@ onUnmounted(() => {
<el-popover placement="top" trigger="hover" width="300"> <el-popover placement="top" trigger="hover" width="300">
<template #default> <template #default>
对应参数<span class="font-black text-[#5A3DAA]" 对应参数<span class="font-black text-[#5A3DAA]"
>bindAddr</span >bindAddr</span
> >
要将被访问者的服务绑定到本地哪个<span 要将被访问者的服务绑定到本地哪个<span
class="font-black text-[#5A3DAA]" class="font-black text-[#5A3DAA]"
>端口</span >端口</span
> >
<br /> <br />
请自行确保端口未被占用 请自行确保端口未被占用
</template> </template>