--添加测试模块
This commit is contained in:
@ -9,12 +9,19 @@ import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
|
||||
|
||||
import { RootRoute } from '/@/router/routes';
|
||||
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import {useTenantManager} from "/@/utils/tenantManager";
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
const LOGIN_PATH = PageEnum.BASE_LOGIN;
|
||||
|
||||
const ROOT_PATH = RootRoute.path;
|
||||
|
||||
const whitePathList: PageEnum[] = [LOGIN_PATH];
|
||||
|
||||
const tenantEnabled=getAppEnvConfig().VITE_GLOB_TENANT_ENABLED;
|
||||
|
||||
export function createPermissionGuard(router: Router) {
|
||||
const userStore = useUserStoreWithOut();
|
||||
const permissionStore = usePermissionStoreWithOut();
|
||||
@ -22,9 +29,27 @@ export function createPermissionGuard(router: Router) {
|
||||
let isOnlyShowContent=to.query?.isOnlyShowContent;
|
||||
if(isOnlyShowContent=='Y'){
|
||||
window.isOnlyShowContent='Y';
|
||||
}else{
|
||||
}else if(isOnlyShowContent=='N'){
|
||||
window.isOnlyShowContent='N';
|
||||
}
|
||||
let autoToggleTenant=to.query?.autoToggleTenant;
|
||||
if(autoToggleTenant=='Y'){
|
||||
window.autoToggleTenant='Y';
|
||||
}else if(autoToggleTenant=='N'){
|
||||
window.autoToggleTenant='N';
|
||||
}
|
||||
if (tenantEnabled==='true') {
|
||||
let switchTenant = to.query?.switchTenant;
|
||||
let tenantCode = to.query?.tenantCode;
|
||||
if (switchTenant==='Y'&&tenantCode) {
|
||||
const userStore = useUserStore();
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
if(tenantCode!==userInfo?.value?.tenantCode){
|
||||
const {toggleLocal} = useTenantManager();
|
||||
await toggleLocal({tenantCode: tenantCode, goHome: false, tabCloseAction: "none"});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (
|
||||
from.path === ROOT_PATH &&
|
||||
to.path === PageEnum.BASE_HOME &&
|
||||
|
||||
Reference in New Issue
Block a user