constant.js 745 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. *
  3. * 全局静态变量
  4. * 通过this.$cons.xx调用
  5. *
  6. * created by uu
  7. */
  8. // 环境修改
  9. const ENV = 'dev'
  10. const BASE_URL = '/wf-api'
  11. // 后端多环境配置
  12. const hostConfig = {
  13. dev: "http://tq.5000v.com:8025",
  14. test: "",
  15. prod: ""
  16. }
  17. /**
  18. * 前端页面配置(公众号重定向需要)
  19. */
  20. const frontIndexConfig = {
  21. dev: "http://www.diboot.com", // 自行替换
  22. test: "",
  23. prod: ""
  24. }
  25. const cons = {
  26. ENV,
  27. BASE_URL,
  28. /**
  29. * 获取当前环境配置
  30. * @param {Object} env {dev、test、prod}
  31. */
  32. host(env = ENV) {
  33. return `${hostConfig[env]}${BASE_URL}`
  34. },
  35. /**
  36. * 获取当前环境配置
  37. * @param {Object} env {dev、test、prod}
  38. */
  39. frontIndex(env = ENV) {
  40. return frontIndexConfig[env]
  41. }
  42. }
  43. export default cons