dengshaobo 1 жил өмнө
parent
commit
ac5b06aedb

+ 9 - 3
src/router/index.ts

@@ -20,21 +20,27 @@ const routes: Array<RouteRecordRaw> = [
     component: Layout,
     children: [
       {
-        path: '/main/school',
+        path: 'school',
         name: 'school',
         component: () => import('@/views/school/index.vue')
       },
       {
-        path: '/main/manager',
+        path: 'manager',
         name: 'manager',
         component: () => import('@/views/manager/index.vue')
       },
       {
-        path: '/main/examination',
+        path: 'examination',
         name: 'examination',
         component: () => import('@/views/examination/index.vue')
       }
     ]
+
+  },
+  {
+    path: '/:pathMatch(.*)*', // 捕获所有未匹配路径
+    name: 'NotFound',
+    component: () => import('../views/login/login.vue') // 未匹配到路由跳转到登录页面
   }
 ]
 

+ 1 - 1
src/views/login/login.vue

@@ -277,7 +277,7 @@ const SubmitLogin = () => {
         localStorage.setItem('userInfo', JSON.stringify(userInfoRes.data))
         ElMessage.success('登录成功');
         // 跳转到主页
-        router.push('/main')
+        router.push('/main/school')
       }
     })
     .catch((err) => {