config.js 1.1 KB

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