config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // 本地开发环境
  2. const local = {
  3. web_pc: 'http://127.0.0.1:7001',
  4. spjj: 'http://127.0.0.1:7001/index.html#',
  5. openapi: 'https://openapi.bozedu.top',
  6. api: 'https://aimoocapi.bozedu.top',
  7. oss: 'https://oss.bozedu.net',
  8. uc: 'https://uc.dev.bozedu.net/',
  9. origin: window.location.origin,
  10. }
  11. // 测试服环境
  12. const development = {
  13. web_pc: 'https://aimooc.bozedu.top',
  14. spjj: 'https://aimoocspjj.bozedu.top/#',
  15. openapi: 'https://openapi.dev.bozedu.top',
  16. api: 'https://aimoocapi.bozedu.top',
  17. oss: 'https://oss.bozedu.net',
  18. uc: 'https://uc.dev.bozedu.net/',
  19. origin: window.location.origin,
  20. }
  21. // // 正式服环境
  22. const production = {
  23. web_pc: 'https://aimooc.bozedu.net',
  24. spjj: 'https://aimoocspjj.bozedu.net/#',
  25. openapi: 'https://openapi.bozedu.net',
  26. api: 'https://aimoocapi.bozedu.net',
  27. oss: 'https://oss.bozedu.net',
  28. uc: 'https://uc.bozedu.net/',
  29. origin: window.location.origin,
  30. }
  31. function isWhich() {
  32. if (window.location.href.startsWith(development.web_pc)) {
  33. return development
  34. } else if (window.location.href.startsWith(production.web_pc)) {
  35. return production
  36. } else {
  37. return local
  38. }
  39. }
  40. window.GLOBAL_CONFIG = isWhich()