DESKTOP-70VPDLK\Administrator hace 1 año
padre
commit
7251e39bea
Se han modificado 2 ficheros con 19 adiciones y 4 borrados
  1. 5 3
      components/en-utils/en-nav/en-nav.vue
  2. 14 1
      service/router.js

+ 5 - 3
components/en-utils/en-nav/en-nav.vue

@@ -30,7 +30,9 @@
 
 <script>
 	// 获取系统状态栏的高度
-	let systemInfo = uni.getSystemInfoSync();
+	import tools from "@/service/tools";
+
+  let systemInfo = uni.getSystemInfoSync();
 	let menuButtonInfo = {};
 	// #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
 	menuButtonInfo = uni.getMenuButtonBoundingClientRect();
@@ -141,7 +143,7 @@
 			onBack() {
         console.log('toBack:',this.toBack)
         if(this.toBack){
-          uni.navigateBack()
+          tools.leftClick()
         }
 				this.$emit('onBack')
 			},
@@ -204,4 +206,4 @@
 	.nav-bg2 {
 		background-image: url("https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/index/index-bg.png?imageMogr2/quality/20");
 	}
-</style>
+</style>

+ 14 - 1
service/router.js

@@ -19,6 +19,18 @@ const whiteList = ['/pages/login/index','/pages/login/register']
 
 router.beforeEach(async (to, from, next) => {
     // tools.showLoading()
+    console.log(to)
+    console.log(from)
+    if(to.path==='/pages/login/index'){
+        uni.setStorageSync('pageFullPath',from.fullPath)
+    }else if(from.path==='/pages/login/index'){
+        let oldFullPath= uni.getStorageSync('pageFullPath')
+        if(oldFullPath){
+            uni.setStorageSync('pageFullPath','')
+            next(oldFullPath);
+        }
+    }
+
     let userToken=''
     if (to.query.token ) {
         userToken = to.query.token;
@@ -33,7 +45,8 @@ router.beforeEach(async (to, from, next) => {
        await tools.weiXinLogin().then(isLogin=>{
            console.log('-----------isLogin-----------')
            if(isLogin){
-               next();
+               // next();
+               next('/pages/login/index');
            }else {
                next('/pages/login/index');
            }