fix: bug#10702、10703 修复网络组件、流媒体服务域名校验
This commit is contained in:
parent
d04e69ba1b
commit
a4b79f2b8f
|
@ -103,18 +103,6 @@
|
|||
:key="cluster.id"
|
||||
:show-arrow="!formData.shareCluster"
|
||||
>
|
||||
<!-- <j-collapse-panel
|
||||
:key="cluster.id"
|
||||
:header="
|
||||
cluster.serverId
|
||||
? cluster.serverId
|
||||
: !formData.shareCluster
|
||||
? `#${index + 1}.配置信息`
|
||||
: ''
|
||||
"
|
||||
collapsible="header"
|
||||
:show-arrow="!formData.shareCluster"
|
||||
> -->
|
||||
<template #header v-if="!shareCluster">
|
||||
<div class="collapse-header">
|
||||
{{
|
||||
|
@ -1136,10 +1124,6 @@ const filterConfigByType = (data: any, type: string) => {
|
|||
});
|
||||
};
|
||||
|
||||
const changeheader = (value: string) => {
|
||||
console.log(22, value);
|
||||
};
|
||||
|
||||
const getPortOptions = (portOptions: object, index = 0) => {
|
||||
if (!portOptions) return;
|
||||
const type = formData.value.type;
|
||||
|
@ -1224,6 +1208,10 @@ const saveData = async () => {
|
|||
});
|
||||
});
|
||||
|
||||
if (!formRef2Data?.cluster) {
|
||||
return onlyMessage('请新增或完善配置', 'error');
|
||||
}
|
||||
|
||||
const { configuration } = formRef2Data?.cluster[0];
|
||||
const params = shareCluster.value
|
||||
? { ...formData.value, configuration }
|
||||
|
@ -1418,5 +1406,6 @@ watch(
|
|||
background: #ffffff;
|
||||
border: 1px solid #e50012;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -113,6 +113,19 @@ export const Validator = {
|
|||
regOnlyNumber: new RegExp(/^\d+$/),
|
||||
};
|
||||
|
||||
const validateAddress = (_rule: any, value: string): Promise<any> =>
|
||||
new Promise(async (resolve, reject) => {
|
||||
if (
|
||||
Validator.regIpv4.test(value) ||
|
||||
Validator.regIPv6.test(value) ||
|
||||
Validator.regDomain.test(value)
|
||||
) {
|
||||
return resolve('');
|
||||
} else {
|
||||
return reject('请输入正确的IP地址或者域名');
|
||||
}
|
||||
});
|
||||
|
||||
export const Rules = {
|
||||
name: [
|
||||
{
|
||||
|
@ -160,10 +173,14 @@ export const Rules = {
|
|||
message: '请输入公网地址',
|
||||
},
|
||||
{
|
||||
pattern:
|
||||
Validator.regIpv4 || Validator.regIPv6 || Validator.regDomain,
|
||||
message: '请输入正确格式的域名或ip',
|
||||
validator: validateAddress,
|
||||
message: '请输入正确的IP地址或者域名',
|
||||
},
|
||||
// {
|
||||
// pattern:
|
||||
// Validator.regIpv4 || Validator.regIPv6 || Validator.regDomain,
|
||||
// message: '请输入正确格式的域名或ip',
|
||||
// },
|
||||
],
|
||||
publicPort: [
|
||||
{
|
||||
|
@ -181,9 +198,7 @@ export const Rules = {
|
|||
message: '请输入远程地址',
|
||||
},
|
||||
{
|
||||
pattern:
|
||||
Validator.regIpv4 || Validator.regIPv6 || Validator.regDomain,
|
||||
|
||||
validator: validateAddress,
|
||||
message: '请输入正确格式的域名或ip',
|
||||
},
|
||||
],
|
||||
|
|
|
@ -76,10 +76,7 @@
|
|||
message: '请输入API Host',
|
||||
},
|
||||
{
|
||||
pattern:
|
||||
Validator.regIpv4 ||
|
||||
Validator.regIPv6 ||
|
||||
Validator.regDomain,
|
||||
validator: validateAddress,
|
||||
message: '请输入正确的IP地址或者域名',
|
||||
},
|
||||
]"
|
||||
|
@ -133,10 +130,7 @@
|
|||
message: '请输入RTP IP',
|
||||
},
|
||||
{
|
||||
pattern:
|
||||
Validator.regIpv4 ||
|
||||
Validator.regIPv6 ||
|
||||
Validator.regDomain,
|
||||
validator: validateAddress,
|
||||
message: '请输入正确的IP地址或者域名',
|
||||
},
|
||||
]"
|
||||
|
@ -197,15 +191,8 @@
|
|||
style="width: 100%"
|
||||
:min="1"
|
||||
:max="
|
||||
Number(
|
||||
formData.configuration
|
||||
.dynamicRtpPortRange1,
|
||||
) < 65535
|
||||
? Number(
|
||||
formData.configuration
|
||||
.dynamicRtpPortRange1,
|
||||
)
|
||||
: 65535
|
||||
.dynamicRtpPortRange1 || 65535
|
||||
"
|
||||
:precision="0"
|
||||
placeholder="起始端口"
|
||||
|
@ -231,7 +218,8 @@
|
|||
<j-input-number
|
||||
style="width: 100%"
|
||||
:min="
|
||||
formData.configuration.dynamicRtpPortRange0
|
||||
formData.configuration
|
||||
.dynamicRtpPortRange0 || 1
|
||||
"
|
||||
:max="65535"
|
||||
:precision="0"
|
||||
|
@ -305,6 +293,19 @@ const Validator = {
|
|||
regOnlyNumber: new RegExp(/^\d+$/),
|
||||
};
|
||||
|
||||
const validateAddress = (_rule: any, value: string): Promise<any> =>
|
||||
new Promise(async (resolve, reject) => {
|
||||
if (
|
||||
Validator.regIpv4.test(value) ||
|
||||
Validator.regIPv6.test(value) ||
|
||||
Validator.regDomain.test(value)
|
||||
) {
|
||||
return resolve('');
|
||||
} else {
|
||||
return reject('请输入正确的IP地址或者域名');
|
||||
}
|
||||
});
|
||||
|
||||
const formData = ref<FormDataType>({
|
||||
name: '',
|
||||
provider: undefined,
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
:status="slotProps.state.value"
|
||||
:statusText="slotProps.state.text"
|
||||
:statusNames="{
|
||||
enabled: 'success',
|
||||
enabled: 'processing',
|
||||
disabled: 'error',
|
||||
}"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue