22 lines
571 B
JavaScript
22 lines
571 B
JavaScript
/**
|
|
* 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();
|