增加getOneIDToken方法
This commit is contained in:
parent
79f27be41d
commit
4a86455458
|
@ -9,6 +9,15 @@ export function login(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ONEID登录功能(通过code获取对应的用户token)
|
||||||
|
export function getOneIdToken(code) {
|
||||||
|
return request({
|
||||||
|
url: '/WRD-admin/oneIDLogin',
|
||||||
|
method: 'get',
|
||||||
|
params: { code }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function getInfo() {
|
export function getInfo() {
|
||||||
return request({
|
return request({
|
||||||
url: '/WRD-admin/sys/user/info',
|
url: '/WRD-admin/sys/user/info',
|
||||||
|
|
|
@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title'
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||||
|
|
||||||
const whiteList = ['/login'] // no redirect whitelist
|
const whiteList = ['/login', '/callback'] // no redirect whitelist
|
||||||
|
|
||||||
router.beforeEach(async(to, from, next) => {
|
router.beforeEach(async(to, from, next) => {
|
||||||
// start progress bar
|
// start progress bar
|
||||||
|
@ -21,7 +21,7 @@ router.beforeEach(async(to, from, next) => {
|
||||||
const hasToken = getToken()
|
const hasToken = getToken()
|
||||||
|
|
||||||
if (hasToken) {
|
if (hasToken) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login' || to.path === '/callback') {
|
||||||
// if is logged in, redirect to the home page
|
// if is logged in, redirect to the home page
|
||||||
next({ path: '/nav' })
|
next({ path: '/nav' })
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
|
@ -47,7 +47,6 @@ router.beforeEach(async(to, from, next) => {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* has no token*/
|
/* has no token*/
|
||||||
|
|
||||||
if (whiteList.indexOf(to.path) !== -1) {
|
if (whiteList.indexOf(to.path) !== -1) {
|
||||||
// in the free login whitelist, go directly
|
// in the free login whitelist, go directly
|
||||||
next()
|
next()
|
||||||
|
|
|
@ -56,4 +56,3 @@
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue