fix import path

This commit is contained in:
Timi
2026-04-02 16:52:48 +08:00
parent cdaf858a53
commit c266c9e95b
44 changed files with 180 additions and 194 deletions
+21 -3
View File
@@ -1,7 +1,7 @@
import { SettingKey } from "~/types/Setting";
import { readonly, Ref, ref } from "vue";
import CommonAPI from "~/api/CommonAPI";
import { RunEnv, Toolkit } from "timi-web";
import { RunEnv, SettingKey } from "../types";
import Toolkit from "./Toolkit";
import CommonAPI from "../api/CommonAPI";
export default class SettingMapper {
@@ -100,4 +100,22 @@ export default class SettingMapper {
}
return SettingMapper.instance = new SettingMapper();
}
/**
* 解析资源 URL 协议前缀
*
* @param val 原始值,如 `res@/path/to/file`
* @returns 完整 URL
*/
public static toResURL(val: string): string {
const at = val.indexOf("@");
const start = val.substring(0, at);
const path = val.substring(at + 1);
switch (start) {
case "res": return SettingMapper.getDomainLink(SettingKey.DOMAIN_RESOURCE) + path;
case "dl": return SettingMapper.getDomainLink(SettingKey.DOMAIN_DOWNLOAD) + path;
case "attach": return CommonAPI.getAttachmentReadAPI(path);
}
return val;
}
}