重构了main.html的主函数
重构了大量的页面的sidebar 优化了代码结构
This commit is contained in:
21
web/js/api.js
Normal file
21
web/js/api.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* API 配置模块
|
||||
* 提供 API 基础地址和常用配置
|
||||
*/
|
||||
|
||||
// API 基础地址配置
|
||||
(function() {
|
||||
if (typeof window.getApiBase !== 'function') {
|
||||
window.getApiBase = () => {
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
return `${protocol}//${hostname}:7861/api`;
|
||||
};
|
||||
}
|
||||
if (typeof window.API_BASE === 'undefined') {
|
||||
window.API_BASE = window.getApiBase();
|
||||
}
|
||||
})();
|
||||
|
||||
// 导出 API_BASE 供其他模块使用
|
||||
window.API_BASE = window.getApiBase();
|
||||
Reference in New Issue
Block a user