ソースを参照

优化重复跳转登录问题

warrior 18 時間 前
コミット
3e2a0afd42
1 ファイル変更16 行追加27 行削除
  1. 16 27
      nova-pbf/components/home/index.js

+ 16 - 27
nova-pbf/components/home/index.js

@@ -214,19 +214,14 @@ Component({
      */
     async navigateToHome() {
       const currentUser = Parse.User.current();
-      const isAuth = login.loginNow()
-      
-      if (!currentUser || !isAuth) {
-        console.error('❌ 当前没有登录用户!');
-        wx.showToast({
-          title: '请先登录',
-          icon: 'none'
-        });
-        // 跳转到登录页
-        wx.navigateTo({
-          url: 'plugin://fm-plugin/fm-auth'
-        });
-        return;
+      let userInfo = wx.getStorageSync("userLogin");
+      if (userInfo == '') {
+        // wx.showToast({
+        //   title: '请先登录',
+        //   icon: 'none'
+        // });
+        login.loginNow()
+        return
       }
       
       let token = currentUser.getSessionToken();
@@ -365,20 +360,14 @@ Component({
       console.log('===========================================');
       
       const currentUser = Parse.User.current();
-      console.log('📱 当前用户:', currentUser);
-      const isAuth = login.loginNow()
-      
-      if (!currentUser || !isAuth) {
-        console.error('❌ 当前没有登录用户!');
-        wx.showToast({
-          title: '请先登录',
-          icon: 'none'
-        });
-        // 跳转到登录页
-        wx.navigateTo({
-          url: 'plugin://fm-plugin/fm-auth'
-        });
-        return;
+      let userInfo = wx.getStorageSync("userLogin");
+      if (userInfo == '') {
+        // wx.showToast({
+        //   title: '请先登录',
+        //   icon: 'none'
+        // });
+        login.loginNow()
+        return
       }
       
       let token = currentUser.getSessionToken();