envApi.js 868 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import website from '@/config/index';
  2. //获取请求url
  3. export const getAppApiUrl = () => {
  4. let url = '', {testApi, baseApi} = website;
  5. if (process.env.NODE_ENV === 'development') {
  6. //#ifdef APP-PLUS
  7. url = testApi.api;
  8. //#endif
  9. } else {
  10. //#ifdef APP-PLUS
  11. url = baseApi.api;
  12. //#endif
  13. }
  14. return url
  15. }
  16. //获取表单的url
  17. export const getFormApiUrl = () => {
  18. let url = '', {testApi, baseApi} = website;
  19. if (process.env.NODE_ENV === 'development') {
  20. url = testApi.form;
  21. } else {
  22. url = baseApi.form;
  23. }
  24. return url
  25. }
  26. //获取长连接的地址
  27. export const getWssApiUrl = () => {
  28. let url = '', {testApi, baseApi} = website;
  29. if (process.env.NODE_ENV === 'development') {
  30. url = testApi.wss;
  31. } else {
  32. url = baseApi.wss;
  33. }
  34. return url
  35. }