index.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // 引入配置
  2. import config from '@/common/config.js'
  3. // import store from '@/store'
  4. uni.$u.http.setConfig((config) => {
  5. console.log('到config配置');
  6. /* config 为默认全局配置 */
  7. // 数趣Ai项目接口根路径
  8. // config.baseURL = 'https://www.ai5566.top/api/'
  9. /* 根域名 */
  10. if (process.env.NODE_ENV === 'development') {
  11. console.log('开发环境---------------------');
  12. config.baseURL = 'https://t20.9026.com/api/'
  13. }
  14. if (process.env.NODE_ENV === 'production') {
  15. console.log('生产环境------------------');
  16. config.baseURL = 'https://t20.9026.com/api/'
  17. // config.baseURL = 'https://www.ai5566.top/api/'
  18. }
  19. config.header = {
  20. // 'Content-Type': 'application/x-www-form-urlencoded',
  21. 'Content-type': 'application/json',
  22. 'X-Requested-With': 'XMLHttpRequest',
  23. 'Accept': 'application/vnd.api.v1+json'
  24. }
  25. // if (store.getters.token) {
  26. if (true) {
  27. // config.header['Authorization'] = store.getters.token
  28. }
  29. return config
  30. })
  31. module.exports = (vm) => {
  32. require('./requestInterceptors')(vm)
  33. require('./responseInterceptors')(vm)
  34. }