57334bfb by renchao@pashanhoo.com

style:权限

1 parent bcb8e998
......@@ -13,7 +13,7 @@ import "nprogress/nprogress.css"; // progress bar style
import getPageTitle from "@/utils/get-page-title";
import getTheme from "@/utils/theme";
import Cookies from "js-cookie";
import {getToken, getUrlParam, setToken} from "@/utils/util";
import { getToken, getUrlParam, setToken } from "@/utils/util";
NProgress.configure({ showSpinner: false });
......@@ -27,7 +27,7 @@ router.beforeEach(async (to, from, next) => {
// cas操作
const token = getToken()
let locationUrl = window.location.origin + window.location.pathname;
function casValidate (ticket){
function casValidate (ticket) {
axios.get(window._config.services.management + "/management/cas/validate", {
params: {
ticket: ticket,
......@@ -65,14 +65,9 @@ router.beforeEach(async (to, from, next) => {
...accessRoutes,
{ path: "*", redirect: "/404", hidden: true }
]);
const routeTo = Cookies.get("routerTo");
if (routeTo && routeTo !== "/") {
next({ ...to, replace: true });
} else {
next(path)
}
}
}
if (window._config.casEnable === true) {
if (!token) {
let ticket = getUrlParam("ticket");
......@@ -98,18 +93,19 @@ router.beforeEach(async (to, from, next) => {
return
} else {
//todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写
localStorage.setItem('sjsb-location',locationUrl)
localStorage.setItem('hash',to.fullPath)
localStorage.setItem('sjsb-location', locationUrl)
localStorage.setItem('hash', to.fullPath)
window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login&`
return
}
}
localStorage.setItem('sjsb-location',locationUrl)
localStorage.setItem('hash',to.fullPath)
localStorage.setItem('sjsb-location', locationUrl)
localStorage.setItem('hash', to.fullPath)
//todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写
window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login`
}
}else{
} else {
permission()
if (to.path === '/login') {
const redirectUrl = getUrlParam('redirectUrl');
if (redirectUrl && redirectUrl !== '') {
......@@ -120,7 +116,6 @@ router.beforeEach(async (to, from, next) => {
return
}
}
permission()
}
}
NProgress.done()
......