diff --git a/src/utils/index.d.ts b/src/utils/index.d.ts index f8a1e40..fc26660 100644 --- a/src/utils/index.d.ts +++ b/src/utils/index.d.ts @@ -272,6 +272,10 @@ export function getIndexColumn(pagination: false | BasePaginationConfig): { * 获取文件url */ export function getFileUrl(): string; +/** + * 从服务器获取文件url + */ +export function getFileUrlFromServer(): Promise; /** * base64转File对象 diff --git a/src/utils/index.js b/src/utils/index.js index 62155a5..0967f5f 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,3 +1,4 @@ +import { request } from "@cqsjjb/jjb-common-lib/http.js"; import dayjs from "dayjs"; import { ID_NUMBER } from "../regular"; @@ -555,5 +556,15 @@ export function normalizeEmptyHtml(html) { * 获取文件url */ export function getFileUrl() { - return process.env.app["fileUrl"]; + return window.fileUrl || process.env.app["fileUrl"]; +} + +/** + * 从服务器获取文件url + */ +export async function getFileUrlFromServer() { + if (window.fileUrl) + return; + const { data } = await request("/basicInfo/imgFiles/getImagePath", "get"); + window.fileUrl = data; }