|
@@ -73,11 +73,10 @@ const router = new VueRouter({
|
|
|
* 路由的钩子函数,处理是否登录的判断
|
|
|
* **/
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
- // 登录后登录页面处理办法
|
|
|
- // if(to.path === '/login' && store.getters.authToken){
|
|
|
- // next({path: '/'})
|
|
|
- // }else
|
|
|
- if (to.matched.some(m => m.meta.requireAuth)) { // 需要登录
|
|
|
+ // 登录后登录处理办法
|
|
|
+ if(to.path === '/login' && store.getters.authToken){
|
|
|
+ next({path: '/'})
|
|
|
+ }else if (to.matched.some(m => m.meta.requireAuth)) { // 需要登录
|
|
|
if(window.localStorage.authToken){
|
|
|
next()
|
|
|
} else if (to.path !== '/login') {
|