diff --git a/src/views/basicSettings/siteSettings/components/normalSettings.vue b/src/views/basicSettings/siteSettings/components/normalSettings.vue
index d4e4313..c7a9a37 100644
--- a/src/views/basicSettings/siteSettings/components/normalSettings.vue
+++ b/src/views/basicSettings/siteSettings/components/normalSettings.vue
@@ -18,7 +18,7 @@
>
@@ -33,7 +33,7 @@
>
@@ -48,7 +48,7 @@
>
@@ -119,6 +119,18 @@ const normalRules: FormRules = {
sitename: [{ required: true, message: "请输入站点名称", trigger: "blur" }],
};
+const getPreviewUrl = (url: string) => {
+ const value = String(url || "").trim().replace(/\\/g, "/");
+ if (!value) return "";
+ if (/^(https?:\/\/|\/\/|data:|blob:)/i.test(value)) {
+ return value;
+ }
+
+ const base = String(API_BASE_URL || "").replace(/\/+$/, "");
+ const path = value.startsWith("/") ? value : `/${value}`;
+ return `${base}${path}`;
+};
+
//调用基础数据
const initNormalInfos = async () => {
const res = await getNormalInfos(authStore.user.tid);
diff --git a/src/views/system/fileManager/index.vue b/src/views/system/fileManager/index.vue
index 66a3ec9..1f9daf6 100644
--- a/src/views/system/fileManager/index.vue
+++ b/src/views/system/fileManager/index.vue
@@ -589,9 +589,20 @@ const getUserCateData = async () => {
}
};
-//图片拼接接口地址
+// 图片拼接接口地址
+// 七牛云等云存储会返回完整 http/https 地址,直接使用;本地存储返回相对路径时再拼接接口地址
const getFileUrl = (url: string) => {
- return `${import.meta.env.VITE_API_BASE_URL}${url}`;
+ if (!url) return "";
+
+ const normalizedUrl = String(url).trim().replace(/\\/g, "/");
+ if (/^(https?:\/\/|data:|blob:)/i.test(normalizedUrl)) {
+ return normalizedUrl;
+ }
+
+ const baseUrl = String(import.meta.env.VITE_API_BASE_URL || "").replace(/\/$/, "");
+ const path = normalizedUrl.startsWith("/") ? normalizedUrl : `/${normalizedUrl}`;
+
+ return `${baseUrl}${path}`;
};
// 未分类分组(固定,不可编辑)