Showing
1 changed file
with
18 additions
and
7 deletions
@@ -31,6 +31,11 @@ uni.$u.http.setConfig((config) => { | @@ -31,6 +31,11 @@ uni.$u.http.setConfig((config) => { | ||
31 | // 请求拦截 | 31 | // 请求拦截 |
32 | uni.$u.http.interceptors.request.use( | 32 | uni.$u.http.interceptors.request.use( |
33 | (config) => { | 33 | (config) => { |
34 | + if (store.state.userInfo.isThirdLogin) { | ||
35 | + uni.switchTab({ | ||
36 | + url: "../pages/personal/personal", | ||
37 | + }); | ||
38 | + } | ||
34 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} | 39 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} |
35 | config.data = config.data || {}; | 40 | config.data = config.data || {}; |
36 | // 根据custom参数中配置的是否需要token,添加对应的请求头 | 41 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
@@ -71,7 +76,6 @@ uni.$u.http.interceptors.response.use( | @@ -71,7 +76,6 @@ uni.$u.http.interceptors.response.use( | ||
71 | } else {} | 76 | } else {} |
72 | }, | 77 | }, |
73 | (response) => { | 78 | (response) => { |
74 | - console.log('Response error', response) | ||
75 | // 关闭加载动画 | 79 | // 关闭加载动画 |
76 | store.commit("setLoadingShow", false); | 80 | store.commit("setLoadingShow", false); |
77 | let show = true; | 81 | let show = true; |
@@ -82,12 +86,19 @@ uni.$u.http.interceptors.response.use( | @@ -82,12 +86,19 @@ uni.$u.http.interceptors.response.use( | ||
82 | } else if (message == "request:fail timeout") { | 86 | } else if (message == "request:fail timeout") { |
83 | errorData = "请求超时:请检查网络"; | 87 | errorData = "请求超时:请检查网络"; |
84 | } else if (response.data.status == 401) { | 88 | } else if (response.data.status == 401) { |
85 | - uni.reLaunch({ | ||
86 | - url: "/publicLoginSubPage/public/login", | ||
87 | - }); | ||
88 | - // 清空登录信息 | ||
89 | - store.commit("emptyUserInfo"); | ||
90 | - show = false; | 89 | + if (!store.state.userInfo.isThirdLogin) { |
90 | + uni.reLaunch({ | ||
91 | + url: "/publicLoginSubPage/public/login", | ||
92 | + }); | ||
93 | + // 清空登录信息 | ||
94 | + store.commit("emptyUserInfo"); | ||
95 | + show = false; | ||
96 | + } else { | ||
97 | + uni.switchTab({ | ||
98 | + url: "../pages/personal/personal", | ||
99 | + }); | ||
100 | + show = false; | ||
101 | + } | ||
91 | } else { | 102 | } else { |
92 | errorData = message || ""; | 103 | errorData = message || ""; |
93 | } | 104 | } |