路由判断调整
This commit is contained in:
parent
3f69644b11
commit
25f7b4f0c9
@ -2,7 +2,6 @@ import Vue from 'vue';
|
||||
import store from '@/store';
|
||||
import router from './router';
|
||||
import NProgress from 'nprogress'; // Progress 进度条
|
||||
// import 'nprogress/nprogress.css';// Progress 进度条样式
|
||||
import { admin, userDesign} from './router';
|
||||
import { getToken, getDesignToken} from '@/utils/auth'; // 验权
|
||||
import { LoginParams } from '@/utils/login';
|
||||
@ -17,6 +16,14 @@ function hasPermission(roles, permissionRoles) {
|
||||
|
||||
const whiteList = ['/login', '/design/login', '/xty/login', '/designxty/login']; // 不重定向白名单
|
||||
|
||||
const designPageRegex = [/^\/design/, /^\/scriptDisplay/, /^\/publish/, /^\/orderauthor/, /^\/system/, /^\/display\/record/, /^\/display\/manage/, /^\/apply/, /^\/plan/, /^\/display\/plan/];
|
||||
|
||||
function isDesignPage(toRoutePath) {
|
||||
return designPageRegex.some(item => {
|
||||
return item.test(toRoutePath);
|
||||
});
|
||||
}
|
||||
|
||||
const loginPage = whiteList[0];
|
||||
|
||||
const loginDesignPage = whiteList[1];
|
||||
@ -35,20 +42,10 @@ function getRouteInfo(to) {
|
||||
loginPath = loginDesignXtyPage;
|
||||
getTokenInfo = getDesignToken;
|
||||
clientId = LoginParams.Design.clientId;
|
||||
} else if (/^\/design/.test(toRoutePath) || /^\/scriptDisplay/.test(toRoutePath) || /^\/publish/.test(toRoutePath) || /^\/orderauthor/.test(toRoutePath) || /^\/system/.test(toRoutePath) || /^\/display\/record/.test(toRoutePath) || /^\/display\/manage/.test(toRoutePath) || /^\/apply/.test(toRoutePath)) {
|
||||
} else if (isDesignPage(toRoutePath)) {
|
||||
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
|
||||
getTokenInfo = getDesignToken;
|
||||
clientId = LoginParams.Design.clientId;
|
||||
} else if (/^\/plan/.test(toRoutePath) || /^\/display\/plan/.test(toRoutePath)) {
|
||||
if (getSessionStorage('project').startsWith('design')) {
|
||||
loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage;
|
||||
getTokenInfo = getDesignToken;
|
||||
clientId = LoginParams.Design.clientId;
|
||||
} else {
|
||||
loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage;
|
||||
getTokenInfo = getToken;
|
||||
clientId = null;
|
||||
}
|
||||
} else if ( /^\/xty/.test(toRoutePath)) {
|
||||
loginPath = loginXtyPage;
|
||||
getTokenInfo = getToken;
|
||||
@ -58,7 +55,6 @@ function getRouteInfo(to) {
|
||||
getTokenInfo = getToken;
|
||||
clientId = null;
|
||||
}
|
||||
|
||||
return { clientId, loginPath, getTokenInfo };
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user