diff --git a/common/config.js b/common/config.js new file mode 100644 index 0000000..a271d49 --- /dev/null +++ b/common/config.js @@ -0,0 +1,15 @@ +/** + * API 配置 + * 统一管理后端接口地址 + */ + +// API 基础地址 +export const API_BASE_URL = 'https://api.huayang-star.com/' + +// 导出完整的 API URL 构建函数 +export function getApiUrl(path) { + // 确保 path 以 / 开头 + const apiPath = path.startsWith('/') ? path : `/${path}` + return `${API_BASE_URL}${apiPath.replace(/^\//, '')}` +} +