用工小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
424 B

7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
7 months ago
  1. /**
  2. * 请求拦截
  3. * @param {Object} http
  4. */
  5. module.exports = (vm) => {
  6. uni.$u.http.interceptors.request.use((config) => {
  7. config.data = config.data || {}
  8. config.header['X-Access-Token'] = uni.getStorageSync('token');
  9. // config.header['Content-Type'] = 'application/json'
  10. config.header['Content-Type'] = 'application/x-www-form-urlencoded'
  11. return config
  12. }, config => {
  13. return Promise.reject(config)
  14. })
  15. }