| 
					
				 | 
			
			
				@@ -41,13 +41,15 @@ const glob = useGlobSetting(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const userStore = useUserStoreWithOut(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const permissionStore = usePermissionStoreWithOut(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const { doAutoLogin } = useAutoLogin(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  router.beforeEach(async (to, from, next) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  router.beforeEach(async (to, from) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     RootRoute.redirect = glob.homePath || PageEnum.BASE_HOME; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (_.isEmpty(history.state.current)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       _.assign(history.state, { current: from.fullPath }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       from.path === ROOT_PATH && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       to.path === (glob.homePath || PageEnum.BASE_HOME) && 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -55,17 +57,12 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       userStore.getUserInfo.homePath !== (glob.homePath || PageEnum.BASE_HOME) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // mountMicroApp(userStore.getUserInfo.homePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(userStore.getUserInfo.homePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       document.title = '首页'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return userStore.getUserInfo.homePath; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 如果符合自动登录的相关条件则直接执行自动登录,覆盖原有的登录信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const { doAutoLogin } = useAutoLogin(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const redirect = await doAutoLogin(to); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (redirect && to.query.redirect) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(to.query.redirect as string); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    await doAutoLogin(to); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const token = userStore.getToken; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -81,9 +78,8 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (!isSessionTimeout) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            next((to.query?.redirect as string) || '/'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             document.title = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return (to.query?.redirect as string) || '/'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //update-begin---author:wangshuai ---date:20220629  for:[issues/I5BG1I]vue3不支持auth2登录------------ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -94,27 +90,24 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // if (to.query.tenantId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //   setAuthCache(OAUTH2_THIRD_LOGIN_TENANT_ID, to.query.tenantId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        next({ path: OAUTH2_LOGIN_PAGE_PATH }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         document.title = '登录'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return { path: OAUTH2_LOGIN_PAGE_PATH }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //update-end---author:wangshuai ---date:20230224  for:[QQYUN-3440]新建企业微信和钉钉配置表,通过租户模式隔离------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //update-end---author:wangshuai ---date:20220629  for:[issues/I5BG1I]vue3不支持auth2登录------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       document.title = to.meta.title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // token does not exist 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (!token) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // You can access without permission. You need to set the routing meta.ignoreAuth to true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (to.meta.ignoreAuth) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         document.title = to.meta.title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // query如果没有明确要求跳过sso则执行sso登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (to.query[SKIP_SSO_URL_QUERY.key] !== SKIP_SSO_URL_QUERY.val) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -128,10 +121,10 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         await userStore.mockLogin({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           goHome: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return next({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           path: to.path, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           query: to.query, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       //update-begin---author:wangshuai ---date:20220629  for:[issues/I5BG1I]vue3 Auth2未实现------------ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -139,13 +132,13 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (whitePathList.includes(to.path as PageEnum)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 在免登录白名单,如果进入的页面是login页面并且当前是OAuth2app环境,就进入OAuth2登录页面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (to.path === LOGIN_PATH && isOAuth2AppEnv()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          next({ path: OAUTH2_LOGIN_PAGE_PATH }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           document.title = '登录'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return { path: OAUTH2_LOGIN_PAGE_PATH }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           //在免登录白名单,直接进入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           // mountMicroApp(to.path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           document.title = to.meta.title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //update-begin---author:wangshuai ---date:20230302  for:只有首次登陆并且是企业微信或者钉钉的情况下才会调用------------ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -196,16 +189,14 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // mountMicroApp(redirectData.path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(redirectData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       document.title = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return redirectData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //==============================【首次登录并且是企业微信或者钉钉的情况下才会调用】================== 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //判断是免登录页面,如果页面包含/tenantId/,那么就直接前往主页 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (isOAuth2AppEnv() && to.path.indexOf('/tenantId/') != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       document.title = '首页'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return userStore.getUserInfo.homePath || PageEnum.BASE_HOME; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //==============================【首次登录并且是企业微信或者钉钉的情况下才会调用】================== 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -216,9 +207,8 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       to.fullPath !== (userStore.getUserInfo.homePath || glob.homePath || PageEnum.BASE_HOME) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // mountMicroApp(userStore.getUserInfo.homePath || PageEnum.BASE_HOME); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       document.title = '首页'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return userStore.getUserInfo.homePath || PageEnum.BASE_HOME; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // get userinfo while last fetch time is empty 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -228,16 +218,17 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } catch (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         console.info(err); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // mountMicroApp(to.path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         document.title = to.meta.title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('debug getIsDynamicAddedRoute'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (permissionStore.getIsDynamicAddedRoute) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // mountMicroApp(to.path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       document.title = to.meta.title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('debug escape the  404 page exp'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const routes = await permissionStore.buildRoutesAction(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -250,16 +241,17 @@ export function createPermissionGuard(router: Router) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     permissionStore.setDynamicAddedRoute(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('debug reach the last exp'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (to.name === PAGE_NOT_FOUND_ROUTE.name) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('debug redirect'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 动态添加路由后,此处应当重定向到fullPath,否则会加载404页面内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next({ path: to.fullPath, replace: true, query: to.query }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { path: to.fullPath, replace: true, query: to.query }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const redirectPath = (from.query.redirect || to.path) as string; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const redirect = decodeURIComponent(redirectPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // mountMicroApp(nextData.path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      next(nextData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // mountMicroApp(return Data.path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       document.title = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return to.path === redirect ? { ...to, replace: true } : { path: redirect }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |