|
@@ -59,15 +59,15 @@ const router = createRouter({
|
|
|
// 全局前置路由守卫
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
const token = getToken();
|
|
|
- if (to.path === '/login') {
|
|
|
- if (!token) {
|
|
|
+ if (!token) {
|
|
|
+ if (to.path === '/login') {
|
|
|
next();
|
|
|
} else {
|
|
|
- next('/');
|
|
|
+ next('/login');
|
|
|
}
|
|
|
} else {
|
|
|
- if (!token) {
|
|
|
- next('/login');
|
|
|
+ if (to.path === '/login') {
|
|
|
+ next('/');
|
|
|
} else {
|
|
|
next();
|
|
|
}
|