config.js 918 B

123456789101112131415161718192021222324252627282930313233343536
  1. //生产
  2. const PRO_BASE_URL = "https://pro.cloud.boyuantech.net/manage/api/v1/miniScmApp"
  3. const PRO_IMG_BASE_URL = "https://pro.cloud.boyuantech.net/img"
  4. //测试
  5. const TEST_BASE_URL = "https://test.cloud.boyuantech.net/mp/api/v1"
  6. const TEST_IMG_BASE_URL = "https://test.cloud.boyuantech.net/img"
  7. //本地
  8. const DEV_BASE_URL = "http://localhost:9041/api/v1"
  9. const DEV_IMG_BASE_URL = "https://pro.cloud.boyuantech.net/img"
  10. let BASE_URL
  11. let IMG_BASE_URL
  12. const accountInfo = uni.getAccountInfoSync();
  13. const env = accountInfo.miniProgram.envVersion
  14. if (env === 'release') {
  15. BASE_URL = PRO_BASE_URL
  16. IMG_BASE_URL = PRO_IMG_BASE_URL
  17. } else {
  18. // 生产环境
  19. // BASE_URL = PRO_BASE_URL
  20. // IMG_BASE_URL = PRO_IMG_BASE_URL
  21. // 测试环境
  22. BASE_URL = TEST_BASE_URL
  23. IMG_BASE_URL = TEST_IMG_BASE_URL
  24. // 开发环境
  25. // BASE_URL = DEV_BASE_URL
  26. // IMG_BASE_URL = DEV_IMG_BASE_URL
  27. }
  28. export {
  29. BASE_URL,
  30. IMG_BASE_URL
  31. }