chore: 前置快照-assetUrl前缀与学校切换收敛会话遗留(执行方案B1~B5前既有未提交变更)
This commit is contained in:
+16
-11
@@ -41,10 +41,11 @@ function get<T>(url: string, params?: IObj): Method {
|
||||
return alovaInstance.Get<T>(url, { params });
|
||||
}
|
||||
|
||||
/** POST JSON(@RequestBody) */
|
||||
function postJSON<T>(url: string, data?: unknown): Method {
|
||||
/** POST JSON(@RequestBody);params 为追加到 URL 的 query 参数(alova Post config 同 Get) */
|
||||
function postJSON<T>(url: string, data?: unknown, params?: IObj): Method {
|
||||
return alovaInstance.Post<T>(url, data, {
|
||||
headers: { "Content-Type": "application/json;charset=UTF-8" },
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,6 +59,16 @@ export function portalBase(siteCode: string): string {
|
||||
return `${conf.isMock ? "" : conf.serviceHost}/portal/${siteCode}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端下发的站内资产路径补 serviceHost 前缀(如主题截图 /api/theme/{name}/asset/screenshot.png)。
|
||||
* 生产 context-path=/yschcms,裸 /api 绝对路径会打到网关根上 404(破图);
|
||||
* dev/mock 下 serviceHost 为空串,拼接后与原路径一致不受影响。
|
||||
*/
|
||||
export function assetUrl(url: string): string {
|
||||
if (!url || /^(https?:|data:|blob:)/i.test(url)) return url;
|
||||
return `${conf.isMock ? "" : conf.serviceHost}${url}`;
|
||||
}
|
||||
|
||||
class AuthApi {
|
||||
/** 登录态:用户 + 可管理站点 + 是否超管 */
|
||||
getUser() {
|
||||
@@ -137,21 +148,15 @@ class ArticleApi {
|
||||
|
||||
/** 发布(publishTime 为未来时间即定时发布) */
|
||||
publish(siteId: number, id: number) {
|
||||
return postJSON<void>(`${ARTICLE}/publish/${id}`, undefined, {
|
||||
params: { siteId },
|
||||
});
|
||||
return postJSON<void>(`${ARTICLE}/publish/${id}`, undefined, { siteId });
|
||||
}
|
||||
|
||||
offline(siteId: number, id: number) {
|
||||
return postJSON<void>(`${ARTICLE}/offline/${id}`, undefined, {
|
||||
params: { siteId },
|
||||
});
|
||||
return postJSON<void>(`${ARTICLE}/offline/${id}`, undefined, { siteId });
|
||||
}
|
||||
|
||||
topmost(siteId: number, id: number, enable: boolean) {
|
||||
return postJSON<void>(`${ARTICLE}/topmost/${id}`, undefined, {
|
||||
params: { siteId, enable },
|
||||
});
|
||||
return postJSON<void>(`${ARTICLE}/topmost/${id}`, undefined, { siteId, enable });
|
||||
}
|
||||
|
||||
delete(data: DeleteRequest) {
|
||||
|
||||
Reference in New Issue
Block a user