import axios from 'axios' import store from '@/store' import Qs from 'qs' import constv from '@/config/constv' import { getToken } from '@/utils/auth' import { Modal, message } from 'ant-design-vue' const service = axios.create({ baseURL: `${constv.API_URL}`, timeout: 20000, transformRequest: params => Qs.stringify(params) // 参数格式化 qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) => 'a=b&a=c' // paramsSerializer: params => Qs.stringify(params, { arrayFormat: 'repeat' }) // 参数格式化 qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) => 'a=b&a=c' }) service.interceptors.request.use(config => { if (config.url.indexOf('get_new_all_order_excel') > -1) { config.timeout = 300000 // 600s 10min } const token = getToken() if (token) { config.headers['token'] = token } return config }, error => { message.error('请求超时,请稍后重试!') return Promise.reject(error) })