hailin
2023-08-03 a4b23bbf535f10c5ecc31b16bc8177bcfc23e996
src/main.js
@@ -40,11 +40,19 @@
  }
  if (token) {
    config.headers['token'] = "" + token
    config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
    // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
    // config.headers['Content-Type'] = 'application/json'
  }
  // console.log(config)
  if (config.method === 'post' || config.method === 'put') {
    config.data = qs.stringify(config.data)
  }
  if(config.headers['Content-Type'] =='application/json'){
    config.data = qs.parse(config.data)
    // console.log(config.data)
  }
  return config
}, function(error) {
  return Promise.reject(error)