Browse Source

登录后页面跳转

chenrui 4 years ago
parent
commit
16c1af0643

+ 1 - 1
src/pages/bundleDetail/index.vue

@@ -80,7 +80,7 @@ export default {
             url: `/pages/placeOrder/main?id=${id}&couponId=${couponId}&customerCouponId=${customerCouponId}`
             url: `/pages/placeOrder/main?id=${id}&couponId=${couponId}&customerCouponId=${customerCouponId}`
           });
           });
         } else {
         } else {
-          wx.navigateTo({
+          wx.redirectTo({
             url: `/pages/login/main?lanuch=false&path=` + encodeURIComponent(`/pages/bundleDetail/main?id=${id}`)
             url: `/pages/login/main?lanuch=false&path=` + encodeURIComponent(`/pages/bundleDetail/main?id=${id}`)
           });
           });
         }
         }

+ 2 - 2
src/pages/index/index.vue

@@ -156,8 +156,8 @@ export default {
     },
     },
     toLogin(){
     toLogin(){
       wx.navigateTo({
       wx.navigateTo({
-        url: '/pages/login/main'
-      });
+        url: '/pages/login/main?lanuch=true&path=' + encodeURIComponent('/pages/index/main')
+      })
     },
     },
     toViewOrder(){
     toViewOrder(){
       wx.navigateTo({
       wx.navigateTo({

+ 6 - 2
src/pages/login/index.vue

@@ -73,7 +73,11 @@ export default {
             // } else {
             // } else {
             //   wx.redirectTo({ url: this.path });  //  关闭当前页面,跳转到应用内的某个页面
             //   wx.redirectTo({ url: this.path });  //  关闭当前页面,跳转到应用内的某个页面
             // }
             // }
-            wx.reLaunch({ url: '/pages/index/main' })  //  关闭所有页面,打开到应用内的某个页面
+            if(this.path === '/pages/index/main' || this.path === '/pages/member/main'){  //  tab页
+              wx.switchTab({ url: this.path })
+            }else{  //  普通页
+              wx.redirectTo({ url: this.path })
+            }
           } else {
           } else {
             wx.showToast({
             wx.showToast({
               title: res.message,
               title: res.message,
@@ -100,7 +104,7 @@ export default {
   },
   },
   onUnload() {
   onUnload() {
     //  避免从登录页返回到个人中心页(能跳转登录页则是未登录的,不应看到个人中心信息)
     //  避免从登录页返回到个人中心页(能跳转登录页则是未登录的,不应看到个人中心信息)
-    this.gotoHome()
+    // this.gotoHome()
   }
   }
 };
 };
 </script>
 </script>

+ 9 - 2
src/pages/member/index.vue

@@ -33,7 +33,6 @@
 import { getCouponCount } from '@/api/coupon';
 import { getCouponCount } from '@/api/coupon';
 import { checkLogin, zyycLogout } from '@/api/login';
 import { checkLogin, zyycLogout } from '@/api/login';
 export default {
 export default {
-
   data() {
   data() {
     return {
     return {
       canUsedCount: 0,
       canUsedCount: 0,
@@ -115,7 +114,15 @@ export default {
     });
     });
   },
   },
   onShow() {
   onShow() {
-
+    checkLogin().then(res => {
+      if (res.status === '200') {
+        
+      } else {
+        wx.navigateTo({
+          url: '/pages/login/main?lanuch=true&path=' + encodeURIComponent('/pages/member/main')
+        });
+      }
+    })
   }
   }
 };
 };
 </script>
 </script>