index.js 815 B

123456789101112131415161718192021222324252627282930313233
  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. config.baseURL = 'http://192.168.31.102/'
  11. // 线上
  12. config.baseURL = 'http://t3.9026.com/'
  13. config.header = {
  14. // 'Content-Type': 'application/x-www-form-urlencoded',
  15. 'Content-type': 'application/json',
  16. 'X-Requested-With': 'XMLHttpRequest',
  17. 'Accept': 'application/vnd.api.v1+json'
  18. }
  19. // if (store.getters.token) {
  20. if (true) {
  21. // config.header['Authorization'] = store.getters.token
  22. }
  23. return config
  24. })
  25. module.exports = (vm) => {
  26. require('./requestInterceptors')(vm)
  27. require('./responseInterceptors')(vm)
  28. }