|
|
@@ -40,6 +40,18 @@ const whiteList = ['/login', '/register', '/forget', '/authredirect']
|
|
|
* 权限验证
|
|
|
*/
|
|
|
router.beforeEach(async(to, from, next) => {
|
|
|
+ const parmObj = {}
|
|
|
+ if (window.location.search !== '') {
|
|
|
+ const str = window.location.search.slice(1, window.location.search.length)
|
|
|
+ const strArr = str.split('&')
|
|
|
+ if (strArr.length > 0) {
|
|
|
+ strArr.forEach((e, i) => {
|
|
|
+ const arr = e.split('=')
|
|
|
+ parmObj[arr[0]] = arr[1]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(router, str)
|
|
|
+ }
|
|
|
// 进度条
|
|
|
NProgress.start()
|
|
|
// 这里将cookie里是否存有token作为验证是否登录的条件
|
|
|
@@ -141,14 +153,16 @@ router.beforeEach(async(to, from, next) => {
|
|
|
next({
|
|
|
name: 'login',
|
|
|
query: {
|
|
|
- redirect: to.fullPath
|
|
|
+ redirect: to.fullPath,
|
|
|
+ ...parmObj
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
next({
|
|
|
name: 'login',
|
|
|
query: {
|
|
|
- redirect: '/dashboard'
|
|
|
+ redirect: '/dashboard',
|
|
|
+ ...parmObj
|
|
|
}
|
|
|
})
|
|
|
}
|