| | |
| | | |
| | | // 创建axios实例 |
| | | const Service = axios.create({ |
| | | timeout: 1000 |
| | | timeout: 1000 * 30 |
| | | }) |
| | | |
| | | const CancelToken = axios.CancelToken |
| | |
| | | // request拦截器 |
| | | Service.interceptors.request.use( |
| | | config => { |
| | | // 临时追加 |
| | | // if ($store.state.user.account) { |
| | | // config.headers.account = $store.state.user.account |
| | | // } |
| | | // 临时追加 |
| | | // if ($store.state.user.account) { |
| | | // config.headers.account = $store.state.user.account |
| | | // } |
| | | const copyConfig = Object.assign({}, config) |
| | | // copyConfig = filterOauthData(copyConfig) |
| | | // showDebugInfo(copyConfig) |
| | |
| | | params: $T.filterParams(params) |
| | | }) |
| | | } |
| | | $http.post = function (url, data = {}) { |
| | | $http.post = function (url, data = {}, setHeaders) { |
| | | return Service({ |
| | | url: url, |
| | | method: 'post', |
| | | data: data |
| | | data: data, |
| | | headers: setHeaders || { 'Content-Type': 'application/json; charset=UTF-8' } |
| | | }) |
| | | } |
| | | $http.put = function (url, data = {}) { |