wujingjing
2024-08-06 0dc8bb825b1fb47e0f477a6e4dc93638b2dedf95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 就是配置当前小程序项目的环境变量
 
// 获取当前小程序的账号信息
const { miniProgram } = wx.getAccountInfoSync()
 
// 获取小程序的版本
const { envVersion } = miniProgram
 
let env = {
  baseURL: 'https://gmall-prod.atguigu.cn/mall-api'
}
 
switch (envVersion) {
  // 开发版
  case 'develop':
    env.baseURL = 'https://gmall-prod.atguigu.cn/mall-api'
    break
 
  // 体验版
  case 'trial':
    env.baseURL = 'https://gmall-prod.atguigu.cn/mall-api'
    break
 
  // 正式版
  case 'release':
    env.baseURL = 'https://gmall-prod.atguigu.cn/mall-api'
    break
 
  default:
    env.baseURL = 'https://gmall-prod.atguigu.cn/mall-api'
    break
}
 
export { env }