| | |
| | | export type ApiEnvironment = 'development' | 'staging' | 'production' |
| | | |
| | | export const apiEnvironment: ApiEnvironment = 'development' |
| | | // 开发环境地址在运行时解析(见 config/development-server.uts),所以这里必须是 import。 |
| | | import { developmentApiBaseUrl } from './development-server.uts' |
| | | |
| | | // 2026-09-29:体验版指向攀枝花测试环境。本机联调改回 'development';生产上线改 'production'。 |
| | | export const apiEnvironment: ApiEnvironment = 'staging' |
| | | // Separate from demo-data controls; only development builds request a test session. |
| | | export const developmentLoginBypassEnabled: boolean = false |
| | | |
| | | // 后台提供合法域名后仅在此处填写,业务页面不得硬编码域名。 |
| | | // 开发者工具模拟器可用回环地址;真机必须用本机当前的局域网地址,并放行 Windows 防火墙的 8080。 |
| | | // 本机局域网 IP 会随网络环境变化(见过 192.168.110.26 与 192.168.110.15),换网后这里要跟着改; |
| | | // 写错了请求会直接失败——连不上那台机器,表现得像"登录不上"。 |
| | | const developmentBaseUrl = 'http://192.168.110.15:8080' |
| | | const stagingBaseUrl = '' |
| | | // 开发环境地址由 development-server.uts 在启动时自动探测本机局域网 IP,换网后不需要改代码; |
| | | // 本机 IP 会变(见过 192.168.110.26 与 192.168.110.15),写死会表现成"登录不上"。 |
| | | // 必须与微信后台「开发管理 → 服务器域名」里配的完全一致(不带端口时,请求 URL 也不能带端口)。 |
| | | const stagingBaseUrl = 'https://rencaika.dqrcfwpt.com' |
| | | const productionBaseUrl = '' |
| | | |
| | | export const getApiBaseUrl = (): string => { |
| | | if (apiEnvironment == 'production') return productionBaseUrl |
| | | if (apiEnvironment == 'staging') return stagingBaseUrl |
| | | return developmentBaseUrl |
| | | // 每次都现取值:探测是异步完成的,提前取会把启动瞬间的兜底值固化住。 |
| | | return developmentApiBaseUrl() |
| | | } |
| | | |
| | | export const isApiConfigured = (): boolean => getApiBaseUrl().length > 0 |