111
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled

This commit is contained in:
francis-fh
2026-06-17 21:48:26 +08:00
parent be90f4026b
commit 4f484f1d00
8 changed files with 606 additions and 141 deletions

15
src/utils/fileUrl.ts Normal file
View File

@@ -0,0 +1,15 @@
/**
* 文件展示 URL 拼接工具
* 开发环境走相对路径,生产环境拼接固定域名
*/
const PROD_DOMAIN = 'http://39.98.44.136:6024';
/** 根据服务端返回的 fileUrl 字段拼出可用于 <img>/<video> src 的完整地址 */
export function getFileDisplayUrl(fileUrl: string): string {
const isDev = process.env.NODE_ENV === 'development';
if (isDev) {
return `/data/file/${fileUrl}`;
}
return `${PROD_DOMAIN}/data/file/${fileUrl}`;
}