|
@@ -116,6 +116,16 @@ const themeOptions = ref<{ label: string; value: string }[]>([]);
|
|
|
// 从全局配置里取后端 baseURL
|
|
// 从全局配置里取后端 baseURL
|
|
|
const baseURL = (window as any).config?.baseURL || "";
|
|
const baseURL = (window as any).config?.baseURL || "";
|
|
|
|
|
|
|
|
|
|
+// 获取图片完整 URL
|
|
|
|
|
+const getImageUrl = (iconPath: string) => {
|
|
|
|
|
+ if (!iconPath) return "";
|
|
|
|
|
+ // 如果路径不是以 http:// 或 https:// 或 / 开头,加上 / 前缀
|
|
|
|
|
+ if (!iconPath.startsWith("http://") && !iconPath.startsWith("https://") && !iconPath.startsWith("/")) {
|
|
|
|
|
+ return "/" + iconPath;
|
|
|
|
|
+ }
|
|
|
|
|
+ return iconPath;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 上传地址和头信息
|
|
// 上传地址和头信息
|
|
|
const fileUpdateUrl = computed(
|
|
const fileUpdateUrl = computed(
|
|
|
() => `${baseURL}/upload/uploadFile.do?fileDir=identityLevel`
|
|
() => `${baseURL}/upload/uploadFile.do?fileDir=identityLevel`
|
|
@@ -298,10 +308,12 @@ onMounted(() => {
|
|
|
form.status = (route.query.status as string) || "1"; // 1=上架, 0=下架
|
|
form.status = (route.query.status as string) || "1"; // 1=上架, 0=下架
|
|
|
form.levelIconLabel = (route.query.icon as string) || "";
|
|
form.levelIconLabel = (route.query.icon as string) || "";
|
|
|
if (form.levelIconLabel) {
|
|
if (form.levelIconLabel) {
|
|
|
|
|
+ // 使用 getImageUrl 确保图片 URL 正确
|
|
|
|
|
+ const fullImageUrl = getImageUrl(form.levelIconLabel);
|
|
|
iconFileList.value = [
|
|
iconFileList.value = [
|
|
|
{
|
|
{
|
|
|
name: "icon",
|
|
name: "icon",
|
|
|
- url: form.levelIconLabel,
|
|
|
|
|
|
|
+ url: fullImageUrl,
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|