From 0232999ff6abf8889e2b3473c15ad10e5c88673c Mon Sep 17 00:00:00 2001 From: yiqiuyang Date: Mon, 31 Aug 2026 16:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=85=E7=BD=91=E7=9A=84?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/config.js | 5 +++++ src/views/pc/download/index.vue | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/public/config.js b/public/config.js index 0b0d293..bd7e2e6 100644 --- a/public/config.js +++ b/public/config.js @@ -7,4 +7,9 @@ window.config = { assetsUrl: 'https://insider.rangutech.com/app_static_data/images/', // 演示系统 featureUrl: 'http://192.168.3.32:5174/#/', + + // 内网文件下载地址 + oldDownLoadUrl: 'http://192.168.3.5:9193', + // 重定向文件下载链接 + redirectDownloadUrl: 'https://work.rangutech.cn:1006', } diff --git a/src/views/pc/download/index.vue b/src/views/pc/download/index.vue index 221d470..46ce9e8 100644 --- a/src/views/pc/download/index.vue +++ b/src/views/pc/download/index.vue @@ -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) => { console.log('res===>', res) 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) => {