style:权限
Showing
1 changed file
with
8 additions
and
13 deletions
| ... | @@ -13,7 +13,7 @@ import "nprogress/nprogress.css"; // progress bar style | ... | @@ -13,7 +13,7 @@ import "nprogress/nprogress.css"; // progress bar style |
| 13 | import getPageTitle from "@/utils/get-page-title"; | 13 | import getPageTitle from "@/utils/get-page-title"; |
| 14 | import getTheme from "@/utils/theme"; | 14 | import getTheme from "@/utils/theme"; |
| 15 | import Cookies from "js-cookie"; | 15 | import Cookies from "js-cookie"; |
| 16 | import {getToken, getUrlParam, setToken} from "@/utils/util"; | 16 | import { getToken, getUrlParam, setToken } from "@/utils/util"; |
| 17 | 17 | ||
| 18 | NProgress.configure({ showSpinner: false }); | 18 | NProgress.configure({ showSpinner: false }); |
| 19 | 19 | ||
| ... | @@ -27,7 +27,7 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -27,7 +27,7 @@ router.beforeEach(async (to, from, next) => { |
| 27 | // cas操作 | 27 | // cas操作 |
| 28 | const token = getToken() | 28 | const token = getToken() |
| 29 | let locationUrl = window.location.origin + window.location.pathname; | 29 | let locationUrl = window.location.origin + window.location.pathname; |
| 30 | function casValidate (ticket){ | 30 | function casValidate (ticket) { |
| 31 | axios.get(window._config.services.management + "/management/cas/validate", { | 31 | axios.get(window._config.services.management + "/management/cas/validate", { |
| 32 | params: { | 32 | params: { |
| 33 | ticket: ticket, | 33 | ticket: ticket, |
| ... | @@ -65,14 +65,9 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -65,14 +65,9 @@ router.beforeEach(async (to, from, next) => { |
| 65 | ...accessRoutes, | 65 | ...accessRoutes, |
| 66 | { path: "*", redirect: "/404", hidden: true } | 66 | { path: "*", redirect: "/404", hidden: true } |
| 67 | ]); | 67 | ]); |
| 68 | const routeTo = Cookies.get("routerTo"); | ||
| 69 | if (routeTo && routeTo !== "/") { | ||
| 70 | next({ ...to, replace: true }); | ||
| 71 | } else { | ||
| 72 | next(path) | 68 | next(path) |
| 73 | } | 69 | } |
| 74 | } | 70 | } |
| 75 | } | ||
| 76 | if (window._config.casEnable === true) { | 71 | if (window._config.casEnable === true) { |
| 77 | if (!token) { | 72 | if (!token) { |
| 78 | let ticket = getUrlParam("ticket"); | 73 | let ticket = getUrlParam("ticket"); |
| ... | @@ -98,18 +93,19 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -98,18 +93,19 @@ router.beforeEach(async (to, from, next) => { |
| 98 | return | 93 | return |
| 99 | } else { | 94 | } else { |
| 100 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 | 95 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 |
| 101 | localStorage.setItem('sjsb-location',locationUrl) | 96 | localStorage.setItem('sjsb-location', locationUrl) |
| 102 | localStorage.setItem('hash',to.fullPath) | 97 | localStorage.setItem('hash', to.fullPath) |
| 103 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login&` | 98 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login&` |
| 104 | return | 99 | return |
| 105 | } | 100 | } |
| 106 | } | 101 | } |
| 107 | localStorage.setItem('sjsb-location',locationUrl) | 102 | localStorage.setItem('sjsb-location', locationUrl) |
| 108 | localStorage.setItem('hash',to.fullPath) | 103 | localStorage.setItem('hash', to.fullPath) |
| 109 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 | 104 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 |
| 110 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login` | 105 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login` |
| 111 | } | 106 | } |
| 112 | }else{ | 107 | } else { |
| 108 | permission() | ||
| 113 | if (to.path === '/login') { | 109 | if (to.path === '/login') { |
| 114 | const redirectUrl = getUrlParam('redirectUrl'); | 110 | const redirectUrl = getUrlParam('redirectUrl'); |
| 115 | if (redirectUrl && redirectUrl !== '') { | 111 | if (redirectUrl && redirectUrl !== '') { |
| ... | @@ -120,7 +116,6 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -120,7 +116,6 @@ router.beforeEach(async (to, from, next) => { |
| 120 | return | 116 | return |
| 121 | } | 117 | } |
| 122 | } | 118 | } |
| 123 | permission() | ||
| 124 | } | 119 | } |
| 125 | } | 120 | } |
| 126 | NProgress.done() | 121 | NProgress.done() | ... | ... |
-
Please register or sign in to post a comment