Commit 6745f8044c2d76a801490edc2ae21dbd8ea65b3b

Authored by fengtao
1 parent 950b2190

fix:移除打印信息和修改判断跳转为switchTab方式

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