env.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * 小程序环境开关(改这一处即可切换测试 / 生产 / 本机)
  3. *
  4. * - local 本机 backend(HBuilderX / 微信开发者工具联调)
  5. * - test 测试门户 121.43.228.102:9911
  6. * - production 生产门户 https://w.shanxiachem.com
  7. *
  8. * 发版前请改为 'production',并执行:npm run release:check-api
  9. */
  10. export const APP_ENV = 'production'
  11. /** 微信小程序 AppID(生产正式号;测试号若不同可按环境再拆) */
  12. export const WECHAT_MP_APPID = 'wx7db1ddb2a90c9425'
  13. /**
  14. * 环境预设(由生产 Web https://w.shanxiachem.com/ 与部署文档核对)
  15. *
  16. * | 项 | 生产实测 |
  17. * |----|----------|
  18. * | Web | https://w.shanxiachem.com/ |
  19. * | API | https://w.shanxiachem.com/api (例:/web/crm/quote/list) |
  20. * | 登录 RSA | GET /api/web/auth/login-rsa-public-key → 200 |
  21. * | 静态资源 | https://w.shanxiachem.com/shanxia-static/ |
  22. * | MinIO 反代 | https://w.shanxiachem.com/ruoyi |
  23. */
  24. export const ENV_PRESETS = {
  25. local: {
  26. key: 'local',
  27. label: '本机',
  28. apiBaseUrl: 'http://127.0.0.1:8000/api',
  29. staticAssetsBaseUrl: 'http://121.43.228.102:9911/shanxia-static/',
  30. webOrigin: 'http://127.0.0.1:3006',
  31. minioBaseUrl: 'http://47.99.164.66:20004/zkxw'
  32. },
  33. test: {
  34. key: 'test',
  35. label: '测试',
  36. apiBaseUrl: 'http://121.43.228.102:9911/api',
  37. staticAssetsBaseUrl: 'http://121.43.228.102:9911/shanxia-static/',
  38. webOrigin: 'http://121.43.228.102:9911',
  39. minioBaseUrl: 'http://121.43.228.102:9911/ruoyi'
  40. },
  41. production: {
  42. key: 'production',
  43. label: '生产',
  44. apiBaseUrl: 'https://w.shanxiachem.com/api',
  45. staticAssetsBaseUrl: 'https://w.shanxiachem.com/shanxia-static/',
  46. webOrigin: 'https://w.shanxiachem.com',
  47. minioBaseUrl: 'https://w.shanxiachem.com/ruoyi'
  48. }
  49. }
  50. const preset = ENV_PRESETS[APP_ENV] || ENV_PRESETS.local
  51. export const CURRENT_ENV = preset
  52. export const IS_PRODUCTION = preset.key === 'production'
  53. export const IS_TEST = preset.key === 'test'
  54. export const IS_LOCAL = preset.key === 'local'
  55. export const API_BASE_URL = preset.apiBaseUrl
  56. export const STATIC_ASSETS_BASE_URL = preset.staticAssetsBaseUrl
  57. export const WEB_ORIGIN = preset.webOrigin
  58. export const MINIO_BASE_URL = preset.minioBaseUrl