| | |
| | | getUserInfo |
| | | } from "./utils/auth"; |
| | | import getuiUtils from "./utils/getuiUtils"; |
| | | import { overrideUniRequest, cancelAllRequest } from './utils/RequestQueue' |
| | | export default { |
| | | onLaunch: function() { |
| | | console.log('App Launch') |
| | |
| | | } |
| | | }, false); |
| | | // #endif |
| | | |
| | | |
| | | overrideUniRequest() |
| | | |
| | | // 路由跳转时取消所有请求 |
| | | this.setupRouteInterceptor() |
| | | }, |
| | | onShow: function() { |
| | | console.log('App Show') |
| | |
| | | } |
| | | }); |
| | | }, 300) |
| | | }, |
| | | setupRouteInterceptor() { |
| | | const methods = [ |
| | | 'navigateTo', |
| | | 'redirectTo', |
| | | 'navigateBack', |
| | | 'switchTab', |
| | | 'reLaunch' |
| | | ] |
| | | |
| | | methods.forEach((m) => { |
| | | uni.addInterceptor(m, { |
| | | invoke() { |
| | | cancelAllRequest() |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |