index.js 732 B

1234567891011121314151617181920212223242526272829
  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. config.baseURL = 'https://t18.9026.com/api'
  8. // config.baseURL = 'http://jmapi.tangyuhao.cn/index.php'
  9. config.header = {
  10. // 'Content-Type': 'application/x-www-form-urlencoded',
  11. 'Content-type': 'application/json',
  12. 'X-Requested-With': 'XMLHttpRequest',
  13. 'Accept': 'application/vnd.api.v1+json'
  14. }
  15. // if (store.getters.token) {
  16. if (true) {
  17. // config.header['Authorization'] = store.getters.token
  18. }
  19. return config
  20. })
  21. module.exports = (vm) => {
  22. require('./requestInterceptors')(vm)
  23. require('./responseInterceptors')(vm)
  24. }