修改内网的下载地址

This commit is contained in:
yiqiuyang
2026-08-31 16:52:56 +08:00
parent b7d6ee8567
commit 0232999ff6
2 changed files with 20 additions and 1 deletions
+5
View File
@@ -7,4 +7,9 @@ window.config = {
assetsUrl: 'https://insider.rangutech.com/app_static_data/images/', assetsUrl: 'https://insider.rangutech.com/app_static_data/images/',
// 演示系统 // 演示系统
featureUrl: 'http://192.168.3.32:5174/#/', featureUrl: 'http://192.168.3.32:5174/#/',
// 内网文件下载地址
oldDownLoadUrl: 'http://192.168.3.5:9193',
// 重定向文件下载链接
redirectDownloadUrl: 'https://work.rangutech.cn:1006',
} }
+15 -1
View File
@@ -108,6 +108,18 @@ const getList = () => {
}) })
} }
function replaceDomain(url, oldOrigin, newOrigin) {
try {
const u = new URL(url)
// 替换协议、主机名和端口
const newUrlObj = new URL(newOrigin + u.pathname + u.search + u.hash)
return newUrlObj.toString()
} catch (e) {
// 降级处理:字符串替换
return url.replace(oldOrigin, newOrigin)
}
}
/** /**
* 下载文件 * 下载文件
*/ */
@@ -123,7 +135,9 @@ const downloadFileFN = (data) => {
.then((res) => { .then((res) => {
console.log('res===>', res) console.log('res===>', res)
if (res.code === 0 && res.data) { if (res.code === 0 && res.data) {
window.open(res.data) const newUrl = res.data.replace(window.config.oldDownLoadUrl, window.config.redirectDownloadUrl)
console.log(newUrl)
window.open(newUrl)
} }
}) })
.catch((err) => { .catch((err) => {