| | |
| | | import NProgress from 'nprogress' |
| | | import 'nprogress/nprogress.css' |
| | | |
| | | // 请求超时时间,10s |
| | | const requestTimeOut = 10 * 1000 |
| | | // 请求超时时间,4分钟 |
| | | const requestTimeOut = 4 * 60 * 1000 |
| | | const success = 200 |
| | | // 更换令牌的时间区间 |
| | | const checkRegion = 5 * 60 * 1000 |
| | |
| | | }) |
| | | break |
| | | case 401: |
| | | Message({ |
| | | message: '很抱歉,认证已失效,请重新登录', |
| | | type: 'error', |
| | | duration: messageDuration |
| | | MessageBox.alert('很抱歉,认证已失效', '温馨提示', { |
| | | confirmButtonText: '确定', |
| | | showClose: false, |
| | | callback: action => { |
| | | router.push('/login') |
| | | } |
| | | }) |
| | | break |
| | | default: |
| | |
| | | return tansParams(params) |
| | | }], |
| | | headers: { |
| | | 'Authorization': authorizationValue |
| | | 'Authorization': authorizationValue, |
| | | 'Content-Type': 'application/x-www-form-urlencoded' |
| | | } |
| | | }) |
| | | }, |
| | |
| | | transformRequest: [(params) => { |
| | | return tansParams(params) |
| | | }], |
| | | headers: { |
| | | 'Content-Type': 'application/x-www-form-urlencoded' |
| | | }, |
| | | responseType: 'blob' |
| | | }).then((r) => { |
| | | const content = r.data |