config.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. const PRO_ROOM_TYPE_PIC_URL = "https://pro.cloud.boyuantech.net/img"
  5. //测试
  6. const TEST_BASE_URL = "https://test.cloud.boyuantech.net/mp/api/v1"
  7. const TEST_IMG_BASE_URL = "https://test.cloud.boyuantech.net/img"
  8. const TEST_ROOM_TYPE_PIC_URL = "https://test.cloud.boyuantech.net/hotel-room-type-img"
  9. //本地
  10. const DEV_BASE_URL = "http://localhost:9041/api/v1"
  11. const DEV_IMG_BASE_URL = "https://pro.cloud.boyuantech.net/img"
  12. const DEV_ROOM_TYPE_PIC_URL = "https://pro.cloud.boyuantech.net/img"
  13. let BASE_URL
  14. let IMG_BASE_URL
  15. let ROOM_TYPE_PIC_URL
  16. const accountInfo = uni.getAccountInfoSync();
  17. const env = accountInfo.miniProgram.envVersion
  18. if (env === 'release') {
  19. BASE_URL = PRO_BASE_URL
  20. IMG_BASE_URL = PRO_IMG_BASE_URL
  21. ROOM_TYPE_PIC_URL = PRO_ROOM_TYPE_PIC_URL
  22. } else {
  23. // 生产环境
  24. // BASE_URL = PRO_BASE_URL
  25. // IMG_BASE_URL = PRO_IMG_BASE_URL
  26. // ROOM_TYPE_PIC_URL = PRO_ROOM_TYPE_PIC_URL
  27. // 测试环境
  28. BASE_URL = TEST_BASE_URL
  29. IMG_BASE_URL = TEST_IMG_BASE_URL
  30. ROOM_TYPE_PIC_URL =TEST_ROOM_TYPE_PIC_URL
  31. // 开发环境
  32. // BASE_URL = DEV_BASE_URL
  33. // IMG_BASE_URL = DEV_IMG_BASE_URL
  34. // ROOM_TYPE_PIC_URL= DEV_ROOM_TYPE_PIC_URL
  35. }
  36. export {
  37. BASE_URL,
  38. IMG_BASE_URL,
  39. ROOM_TYPE_PIC_URL
  40. }