Files
template-10556/config/env.ts
赵忠林 fa917639d2 fix(honor): 优化光荣榜列表去重逻辑,防止重复显示
- 列表第一页渲染时根据 articleId 去重,避免重复条目显示
- 翻页追加数据时合并并去重列表,确保展示无重复内容
- 修复因后端数据重复导致的同一条目多次出现问题

feat(config): 新增环境变量配置及配置文件重构

- 新增 config/env.ts 支持开发、测试、生产环境变量配置
- 通过 getEnvConfig 函数动态获取当前环境配置
- config/app.ts 引入环境变量,实现接口地址等配置统一管理
2026-04-06 12:21:06 +08:00

43 lines
897 B
TypeScript

// 环境变量配置
export const ENV_CONFIG = {
// 开发环境
development: {
API_BASE_URL: 'https://cms-api.websoft.top/api',
APP_NAME: '开发环境',
DEBUG: 'true',
},
// 生产环境
production: {
API_BASE_URL: 'https://cms-api.websoft.top/api',
APP_NAME: '九运售电云',
DEBUG: 'false',
},
// 测试环境
test: {
API_BASE_URL: 'https://cms-api.s209.websoft.top/api',
APP_NAME: '测试环境',
DEBUG: 'true',
}
}
// 获取当前环境配置
export function getEnvConfig() {
const env = process.env.NODE_ENV || 'development'
if (env === 'production') {
return ENV_CONFIG.production
} else { // @ts-ignore
if (env === 'test') {
return ENV_CONFIG.test
} else {
return ENV_CONFIG.development
}
}
}
// 导出环境变量
export const {
API_BASE_URL,
APP_NAME,
DEBUG
} = getEnvConfig()