fix(web): get the parent domain name adaptation IP

This commit is contained in:
zhaoying
2025-12-26 11:58:21 +08:00
parent 44aac44a05
commit 00e061023e

View File

@@ -302,6 +302,10 @@ export const request = {
// 获取父级域名
const getParentDomain = () => {
const hostname = window.location.hostname
// 检查是否为IP地址
if (/^\d+\.\d+\.\d+\.\d+$/.test(hostname)) {
return hostname
}
const parts = hostname.split('.')
return parts.length > 2 ? `.${parts.slice(-2).join('.')}` : hostname
}