| | |
| | | } |
| | | } |
| | | }; |
| | | // router.beforeEach((to, from, next) => { |
| | | // console.log(to.path) |
| | | // store.state.select = to.path |
| | | // document.title = to.meta.title || '亿点通' |
| | | // // 判断是否登录 |
| | | // console.log(document.cookie) |
| | | // // console.log(checkCookie(),'checkCookie()') |
| | | // if(!to.meta.requireAuth){ |
| | | // next() |
| | | // return |
| | | // } |
| | | // if (document.cookie && to.meta.requireAuth) { |
| | | // if (to.path === '/login') { |
| | | // next({ path: '/' }) |
| | | // } else { |
| | | // if (!to.query.url && from.query.url) { |
| | | // to.query.url = from.query.url |
| | | // } |
| | | // next() |
| | | // } |
| | | // }else{ |
| | | // if (to.path === '/login') { |
| | | // next() |
| | | // } else { |
| | | // next({ path: '/login' }) |
| | | // } |
| | | // } |
| | | // }) |
| | | |
| | | router.beforeEach((to, from, next) => { |
| | | store.state.select = to.path; |
| | | document.title = to.meta.title; |
| | | console.log(store.state, "store.state", !!store.state.token); |
| | | if (to.meta.requireAuth && !!!store.state.token) { |
| | | next("/login"); |
| | | } |
| | | // if (!to.query.url && from.query.url) { |
| | | // to.query.url = from.query.url |
| | | // } |