This commit is contained in:
2025-12-12 01:44:41 +08:00
parent 21abcaff53
commit 2f1d732a36
46 changed files with 7756 additions and 484 deletions

41
config/api.config.js Normal file
View File

@@ -0,0 +1,41 @@
/**
* API配置文件
* 统一管理不同环境的API地址
*/
// 开发环境配置
const development = {
// 使用代理,请求会被转发到 vue.config.js 中配置的目标地址
baseURL: 'http://localhost:8123',
timeout: 30000,
// 如果需要代理,可以配置
baseURL: '/api'
}
// 测试环境配置
const test = {
baseURL: 'http://test-api.yourdomain.com',
timeout: 30000
}
// 生产环境配置
const production = {
baseURL: 'https://api.yourdomain.com',
timeout: 30000
}
// 根据 process.env.NODE_ENV 自动切换环境
// uniapp 编译时会自动注入 NODE_ENV
const env = process.env.NODE_ENV || 'development'
const config = {
development,
test,
production
}
// 导出当前环境的配置
export default {
...config[env],
env
}