Browse Source

默认进入离港管理

zhongxiaoyu 1 year ago
parent
commit
3b8c33ccba
1 changed files with 30 additions and 21 deletions
  1. 30 21
      src/router/index.js

+ 30 - 21
src/router/index.js

@@ -48,27 +48,31 @@ export const constantRoutes = [
   {
     path: '/login',
     component: () => import('@/views/login/index'),
-    hidden: true
+    hidden: true,
   },
   {
     path: '/404',
     component: () => import('@/views/404'),
-    hidden: true
+    hidden: true,
   },
+  // {
+  //   path: '/',
+  //   redirect: '/dashboard',
+  //   component: Layout,
+  //   meta: { title: '首页' },
+  //   children: [
+  //     {
+  //       path: '/dashboard',
+  //       name: 'Dashboard',
+  //       component: () => import('@/views/dashboard/index.vue'),
+  //       meta: { title: '首页' },
+  //     },
+  //   ],
+  // },
   {
-  path: '/',
-  redirect: '/dashboard',
-  component: Layout,
-  meta: { title: '首页' },
-  children: [
-    {
-      path: '/dashboard',
-      name: 'Dashboard',
-      component: () => import('@/views/dashboard/index.vue'),
-      meta: { title: '首页' }
-    }
-  ]
-}
+    path: '/',
+    redirect: '/newDeparture',
+  },
   // { path: '/', redirect: '/nopower', component: () => import('@/views/noPower'), hidden: true }
   // 404 page must be placed at the end !!!
 ]
@@ -80,21 +84,23 @@ export const asyncRoutes = []
 asyncRoutes.push({
   path: '*',
   component: () => import('@/views/404'),
-  hidden: true
+  hidden: true,
 })
 
 const createRouter = () =>
   new Router({
     // mode: 'history', // require service support
     scrollBehavior: () => ({ y: 0 }),
-    routes: constantRoutes
+    routes: constantRoutes,
   })
 
 const router = createRouter()
 
 router.beforeEach((to, from, next) => {
   if (
-    (from.path.includes('flightView') && from.query.flightNO && from.query.flightDate) ||
+    (from.path.includes('flightView') &&
+      from.query.flightNO &&
+      from.query.flightDate) ||
     (from.path.includes('containerView') &&
       from.query.flightNO &&
       from.query.flightDate &&
@@ -106,7 +112,8 @@ router.beforeEach((to, from, next) => {
   }
   if (
     from.meta?.keepAlive &&
-    ((to.path.includes('flightView') && (!to.query.flightNO || !to.query.flightDate)) ||
+    ((to.path.includes('flightView') &&
+      (!to.query.flightNO || !to.query.flightDate)) ||
       (to.path.includes('containerView') &&
         (!to.query.flightNO ||
           !to.query.flightDate ||
@@ -114,7 +121,9 @@ router.beforeEach((to, from, next) => {
           !to.query.landingAirport ||
           !to.query.containerID)))
   ) {
-    const savedPage = store.getters.savedPages.find(savedPage => savedPage.name === to.name)
+    const savedPage = store.getters.savedPages.find(
+      savedPage => savedPage.name === to.name
+    )
     if (savedPage) {
       next(savedPage.fullPath)
     }
@@ -123,7 +132,7 @@ router.beforeEach((to, from, next) => {
 })
 
 // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
-export function resetRouter () {
+export function resetRouter() {
   const newRouter = createRouter()
   router.matcher = newRouter.matcher // reset router
 }