微信小程序页面迁移校验之前 P5任务处理之前
This commit is contained in:
26
apps/miniprogram - 副本/miniprogram/utils/config.ts
Normal file
26
apps/miniprogram - 副本/miniprogram/utils/config.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 环境配置
|
||||
*
|
||||
* 根据小程序运行环境自动切换 API 地址:
|
||||
* - develop(开发版)→ 本机
|
||||
* - trial(体验版)→ 测试环境
|
||||
* - release(正式版)→ 正式环境
|
||||
*/
|
||||
|
||||
function getApiBase(): string {
|
||||
const accountInfo = wx.getAccountInfoSync()
|
||||
const envVersion = accountInfo.miniProgram.envVersion
|
||||
|
||||
switch (envVersion) {
|
||||
case "develop":
|
||||
return "http://127.0.0.1:8000"
|
||||
case "trial":
|
||||
return "https://api.langlangzhuoqiu.cn"
|
||||
case "release":
|
||||
return "https://api.langlangzhuoqiu.cn"
|
||||
default:
|
||||
return "https://api.langlangzhuoqiu.cn"
|
||||
}
|
||||
}
|
||||
|
||||
export const API_BASE = getApiBase()
|
||||
Reference in New Issue
Block a user