fix import path
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user