diff --git a/.env.development b/.env.development index a8b3161..fa714ca 100644 --- a/.env.development +++ b/.env.development @@ -17,8 +17,8 @@ VITE_API_STATIC_FILE=http://192.168.65.161:3000/static VITE_API_IMAGE_PREVIEW_URL=http://192.168.65.161:3000/imagePreview # 文件预览地址 VITE_API_FILE_PREVIEW_URL=http://192.168.65.161:3000/preview/onlinePreview -# 文件下载地址(暂未使用) -VITE_API_FILE_URL=http://192.168.65.161:7104 +# 文件下载地址 +VITE_API_DOWNLOAD_URL=http://192.168.65.161:9000 # onlyOffice服务 VITE_API_ONLYOFFICE_URL=http://192.168.65.161:18888 # onlyOffice回调服务 diff --git a/.env.eontec b/.env.eontec index 57ee461..93bf7c0 100644 --- a/.env.eontec +++ b/.env.eontec @@ -17,8 +17,8 @@ VITE_API_STATIC_FILE=http://192.168.65.161:3000/static VITE_API_IMAGE_PREVIEW_URL=http://cidweb.eon.com.cn:3000/imagePreview # 文件预览地址 VITE_API_FILE_PREVIEW_URL=http://cidweb.eon.com.cn:3000/preview/onlinePreview -# 文件下载地址(暂未使用) -VITE_API_FILE_URL=http://192.168.65.161:7104 +# 文件下载地址 +VITE_API_DOWNLOAD_URL=http://cidweb.eon.com.cn:3000 # onlyOffice服务 VITE_API_ONLYOFFICE_URL=http://192.168.65.161:18888 # onlyOffice回调服务 diff --git a/.env.lyric b/.env.lyric index 5aebdcf..2897c59 100644 --- a/.env.lyric +++ b/.env.lyric @@ -17,8 +17,8 @@ VITE_API_STATIC_FILE=http://192.168.30.147:7115/static VITE_API_IMAGE_PREVIEW_URL=http://192.168.30.147:7115/imagePreview # 文件预览地址 VITE_API_FILE_PREVIEW_URL=http://192.168.30.147:7115/preview/onlinePreview -# 文件下载地址(暂未使用) -VITE_API_FILE_URL=http://192.168.30.148:7104 +# 文件下载地址 +VITE_API_DOWNLOAD_URL=http://192.168.30.146:9000 # onlyOffice服务 VITE_API_ONLYOFFICE_URL=http://192.168.30.148:18888 # onlyOffice回调服务 diff --git a/.env.production b/.env.production index 5aa56a0..6d563bd 100644 --- a/.env.production +++ b/.env.production @@ -17,8 +17,8 @@ VITE_API_STATIC_FILE=http://192.168.190.161:3000/static VITE_API_IMAGE_PREVIEW_URL=http://192.168.190.161:3000/imagePreview # 文件预览地址 VITE_API_FILE_PREVIEW_URL=http://192.168.190.161:3000/preview/onlinePreview -# 文件下载地址(暂未使用) -VITE_API_FILE_URL=http://192.168.190.161:7104 +# 文件下载地址 +VITE_API_DOWNLOAD_URL=http://192.168.190.161:9000 # onlyOffice服务 VITE_API_ONLYOFFICE_URL=http://192.168.65.161:18888 # onlyOffice回调服务 diff --git a/.env.test b/.env.test index b4a9dcc..f38e9df 100644 --- a/.env.test +++ b/.env.test @@ -17,8 +17,8 @@ VITE_API_STATIC_FILE=http://192.168.65.161:3000/static VITE_API_IMAGE_PREVIEW_URL=http://192.168.65.161:3000/imagePreview # 文件预览地址 VITE_API_FILE_PREVIEW_URL=http://192.168.65.161:3000/preview/onlinePreview -# 文件下载地址(暂未使用) -VITE_API_FILE_URL=http://192.168.65.161:7104 +# 文件下载地址 +VITE_API_DOWNLOAD_URL=http://192.168.65.161:9000 # onlyOffice服务 VITE_API_ONLYOFFICE_URL=http://192.168.65.161:18888 # onlyOffice回调服务 diff --git a/src/utils/file.ts b/src/utils/file.ts index 2b91812..7715894 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -223,7 +223,7 @@ export const exportFile = (api: any, tableName: string, fileName: string, params export const downloadFileById = async (fileId: number) => { // 1.点击事件下载 // const link = document.createElement('a'); - // link.href = `${env.VITE_API_FILE_URL}/data/downloadFile?fileId=${fileId}`; + // link.href = `${env.VITE_API_DOWNLOAD_URL}/data/downloadFile?fileId=${fileId}`; // document.body.appendChild(link); // link.click(); // document.body.removeChild(link); @@ -232,7 +232,8 @@ export const downloadFileById = async (fileId: number) => { // 3.浏览器下载 getMinioPresignedUrlApi({ fileId }).then((res: any) => { if (res.code === 200) { - const downloadUrl = res.data.minioDownloadUrl; + const { minioDownloadUrl } = res.data; + const downloadUrl = env.VITE_API_DOWNLOAD_URL + minioDownloadUrl.split(':9000')[1]; window.open(downloadUrl, '_blank'); } });