sso登录

This commit is contained in:
qq787203167
2022-06-09 18:14:13 +08:00
parent 9f5761fcf2
commit 6a65b9c0df
2 changed files with 15 additions and 8 deletions
+13 -6
View File
@@ -42,8 +42,12 @@ router.beforeEach((to, from, next) => {
fullPath = to.path
}
let query = to.query
let status = {}
if (query.state) {
status = JSON.parse(query.state)
}
delete query.code
next({ path: fullPath, query: query })
next({ path: fullPath, query: status })
}
})
return
@@ -90,9 +94,10 @@ router.beforeEach((to, from, next) => {
if (to.fullPath == '/') {
fullPath = INDEX_MAIN_PAGE_PATH
} else {
fullPath = to.fullPath
fullPath = to.path
}
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' + encodeURIComponent('http://grp.nioint.com' + fullPath) + '&response_type=code'
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri='
// + encodeURIComponent('http://localhost:3000' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query)
})
})
} else {
@@ -107,11 +112,13 @@ router.beforeEach((to, from, next) => {
next({ path: '/user/login', query: { redirect: to.fullPath } })
let fullPath = ''
if (to.fullPath == '/') {
fullPath = INDEX_MAIN_PAGE_PATH + '?id=123'
fullPath = INDEX_MAIN_PAGE_PATH
} else {
fullPath = to.fullPath
fullPath = to.path
}
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri=' + encodeURIComponent('http://grp.nioint.com' + fullPath) + '&response_type=code'
// http://grp.nioint.com
// window.location.href = 'https://signin-test.nio.com/oauth2/authorize?client_id=100679&redirect_uri='
// + encodeURIComponent('http://localhost:3000' + fullPath) + '&response_type=code&state=' + JSON.stringify(to.query)
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
}
}