refactor: Update public and API base URL functions in company and detail pages for improved clarity

This commit is contained in:
2026-07-14 23:22:53 +08:00
parent 646b0a87ba
commit 8395b390b0
2 changed files with 17 additions and 7 deletions

View File

@@ -88,14 +88,19 @@
});
}
// 反向代理子路径(如 /api/shihezi依据当前页面路径推导 API 前缀
// 保证 /app/... 请求带上子路径,避免落到根路径 404。
function apiBase() {
// 页面和 API 使用不同的代理前缀
// 页面:/shihezi/h5/...
// API/api/shihezi/...
function publicBase() {
var path = window.location.pathname;
var idx = path.indexOf('/h5/');
return idx > 0 ? path.slice(0, idx) : '';
}
function apiBase() {
return '/api' + publicBase();
}
function render(data) {
var fair = data.fair || {};
pageFairId = (fair.id !== null && fair.id !== undefined) ? fair.id : fairId;