refactor: Update public and API base URL functions in company and detail pages for improved clarity
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user