Browse Source

优化逻辑

xiaohaizhao 4 months ago
parent
commit
4699ee219b
1 changed files with 6 additions and 4 deletions
  1. 6 4
      utils/Http.js

+ 6 - 4
utils/Http.js

@@ -72,11 +72,12 @@ class HTTP {
                 }
 
                 // 会话过期处理
-                if (res.data?.msg === '登陆状态已过期,请重新登陆!') {
+                if (res.data.msg === '登陆状态已过期,请重新登陆!') {
                     // 清除过期会话ID
                     this.jsessionid = '';
                     wx.removeStorageSync('JSESSIONID');
-                   let currentPages = getCurrentPages()[getCurrentPages().length - 1];
+                    let currentPages = getCurrentPages()[getCurrentPages().length - 1];
+                    console.log("currentPages", currentPages)
                     // 如果当前页面不是登录页面,则跳转到登录页面
                     if (currentPages.route !== 'pages/login/login') {
                         uni.showModal({
@@ -84,8 +85,9 @@ class HTTP {
                             content: '您的登录状态已过期,请重新登录。',
                             showCancel: false,
                             success: () => {
-                                // 跳转到登录页面
-                                this._redirectToLogin(res);
+                                wx.redirectTo({
+                                    url: '/pages/login/login',
+                                })
                             }
                         });
                     }