| | |
| | | baseURL: process.env.VUE_APP_API_BASE_URL, |
| | | // content-type: application/x-www-form-urlencoded |
| | | headers: { |
| | | 'Content-Type': 'application/x-www-form-urlencoded' |
| | | 'Content-Type': 'application/x-www-form-urlencoded', |
| | | }, |
| | | timeout: 6000 // 请求超时时间 |
| | | timeout: 6000, // 请求超时时间 |
| | | }) |
| | | |
| | | // 异常拦截处理器 |
| | |
| | | if (error.response.status === 403) { |
| | | notification.error({ |
| | | message: 'Forbidden', |
| | | description: data.msg |
| | | description: data.msg, |
| | | }) |
| | | } |
| | | if (error.response.status === 401 && !(data.result && data.result.isLogin)) { |
| | | notification.error({ |
| | | message: 'Unauthorized', |
| | | description: 'Authorization verification failed' |
| | | description: 'Authorization verification failed', |
| | | }) |
| | | if (token) { |
| | | store.dispatch('Logout').then(() => { |
| | |
| | | if (msg == '請先登錄,無權限訪問admin') { |
| | | notification.error({ |
| | | message: '重新登陆', |
| | | description: '未登录或登录过期,请重新登录' |
| | | description: '未登录或登录过期,请重新登录', |
| | | }) |
| | | store.dispatch('Logout').then(() => { |
| | | setTimeout(() => { |
| | |
| | | } else if (!res.data) { |
| | | notification.error({ |
| | | message: '网络错误', |
| | | description: '网络错误,请稍后刷新页面重试!' |
| | | description: '网络错误,请稍后刷新页面重试!', |
| | | }) |
| | | } |
| | | return res.data |
| | |
| | | |
| | | const installer = { |
| | | vm: {}, |
| | | install (Vue) { |
| | | install(Vue) { |
| | | Vue.use(VueAxios, request) |
| | | } |
| | | }, |
| | | } |
| | | |
| | | export default request |