env.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * 环境变量
  3. * 以下划线 '_' 开头的字段表示只在build命令打包时有效,勿在项目中使用
  4. */
  5. // DOMAIN: 'https://scrm.gooki.com',
  6. // DOMAIN: 'https://gooki.ascrm.cn',
  7. // DOMAIN: 'https://www.ascrm.cn', // 接口域名(站点域名请使用:window.location.origin)
  8. // BASE_API: 'https://scrm.gooki.com/linkwechat-api', // 接口基础路径
  9. // BASE_API: 'https://gooki.ascrm.cn/linkwechat-api',
  10. // BASE_API: 'https://www.ascrm.cn/linkwechat-api', // 接口基础路径
  11. const URL = 'https://xy.gooki.com'
  12. const API = 'https://xy.gooki.com/linkwechat-api'
  13. // const URL = 'https://eg.gooki.com'
  14. // const API = 'https://eg.gooki.com/linkwechat-api'
  15. // const URL = 'https://www.ascrm.cn' //冠客精灵
  16. // const API = 'https://www.ascrm.cn/linkwechat-api' //冠客精灵
  17. // const URL = 'https://gooki.ascrm.cn'
  18. // const API = 'https://gooki.ascrm.cn/linkwechat-api'
  19. // const URL = 'https://scrm.gooki.com' //冠客
  20. // const API = 'https://scrm.gooki.com/linkwechat-api' //冠客
  21. export const envs = {
  22. development: {
  23. DOMAIN: URL,
  24. DOMAIN_MOBILE: 'https://xy.gooki.com/mobile', // linkwe-mobile (vue2) 移动端地址
  25. BASE_URL: '/', // 页面路由基础路径 /*/*/,eg:/lw/,不支持 ’./‘形式的路径
  26. BASE_API: API,
  27. _ISGZIP: true, // 是否开启gzip压缩
  28. _ISCDN: true, // 是否开启cdn加速
  29. // PRIVIEW_URL: 'https://dev.linkwechat.net/fileView/onlinePreview?url=', // kkfileview,素材预览服务地址
  30. // _ISCDN: false, // 是否开启cdn加速
  31. },
  32. test: {
  33. DOMAIN: URL,
  34. DOMAIN_MOBILE: 'https://xy.gooki.com/mobile',
  35. BASE_URL: '/', // 路由基础路径
  36. BASE_API: API,
  37. _ISGZIP: true,
  38. _ISCDN: true,
  39. },
  40. production: {
  41. DOMAIN: URL,
  42. DOMAIN_MOBILE: 'https://xy.gooki.com/mobile',
  43. BASE_URL: '/', // 路由基础路径
  44. BASE_API: API,
  45. _ISGZIP: true,
  46. _ISCDN: true,
  47. },
  48. }
  49. // export const env = envs[process.env.VUE_APP_ENV]
  50. let _env = {}
  51. if (process.env.NODE_ENV == 'development' || !globalThis.document) {
  52. // 本地开发和构建(vite)时使用
  53. _env = envs[process.env.VUE_APP_ENV]
  54. _env.ENV = process.env.VUE_APP_ENV
  55. } else {
  56. // 打包后,根据访问域名动态判断环境
  57. let mode = Object.keys(envs).find((e) => envs[e].DOMAIN === window?.location.origin)
  58. _env = envs[mode]
  59. _env.ENV = mode // 前端系统环境模式 development,test,production
  60. }
  61. export const env = _env
  62. // console.log(1, env)
  63. // module.exports = env