cas sso单点登录对接ok,但后端需要根路径才能使用
This commit is contained in:
@@ -7,7 +7,9 @@ import { getToken } from '@/utils/auth'
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
|
||||
const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
|
||||
const defaultSettings = require('@/settings.js')
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
@@ -48,12 +50,21 @@ router.beforeEach((to, from, next) => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
debugger
|
||||
// 没有token
|
||||
if (whiteList.indexOf(to.path) !== -1) {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
} else {
|
||||
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
// next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
// NProgress.done()
|
||||
if (!defaultSettings.casEnable) {
|
||||
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
||||
}
|
||||
//开启cas
|
||||
if (defaultSettings.casEnable) {
|
||||
window.location.href = defaultSettings.casloginUrl // 否则全部重定向到登录页
|
||||
}
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user