修改home

This commit is contained in:
2025-09-23 19:10:14 +08:00
parent 202954ab68
commit b8b6c5a75f
5 changed files with 197 additions and 127 deletions

23
miniprogram/env.ts Normal file
View File

@@ -0,0 +1,23 @@
// 环境类型定义
type EnvVersion = 'develop' | 'trial' | 'release';
// 配置类型定义
interface EnvConfig {
apiBaseUrl: string;
}
// 获取当前环境
const accountInfo = wx.getAccountInfoSync();
const env = accountInfo.miniProgram.envVersion as EnvVersion;
// 环境配置映射
const config: Record<EnvVersion, EnvConfig> = {
develop: { apiBaseUrl: 'http://localhost:9096' },
trial: { apiBaseUrl: 'https://test-api.example.com' },
release: { apiBaseUrl: 'https://api.example.com' }
};
// 处理未知环境(兜底方案)
const envConfig = config[env] || config.develop;
export default envConfig;