修改动态获取域名配置

This commit is contained in:
chenruiye
2025-04-30 17:05:30 +08:00
parent ca308a49a9
commit 543e8bffc3
2 changed files with 32 additions and 4 deletions

View File

@@ -282,8 +282,22 @@ function EnvCheck() {
// 根据域名判断 正式环境(含www)/测试环境(含beta), 并返回所需url前缀
// written by zxfxiong
function getUrlPrefix() {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrl : testUrl;
console.log(window.location, '---------location')
const browser = checkVersion();
if (browser.app) {
console.log(window.location, '---------location')
if (window.location.hostname && window.location.protocol) {
let url = window.location.protocol + '//' + window.location.hostname
console.log(url, '-------url')
return url
} else {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrl : testUrl;
}
} else {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrl : testUrl;
}
}

View File

@@ -278,8 +278,22 @@ function EnvCheck() {
// 根据域名判断 正式环境(含www)/测试环境(含beta), 并返回所需url前缀
// written by zxfxiong
function getUrlPrefix() {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrl : testUrl;
console.log(window.location, '---------location')
const browser = checkVersion();
if (browser.app) {
console.log(window.location, '---------location')
if (window.location.hostname && window.location.protocol) {
let url = window.location.protocol + '//' + window.location.hostname
console.log(url, '-------url')
return url
} else {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrl : testUrl;
}
} else {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrl : testUrl;
}
}