diff --git a/arco-design-pro-vite/src/router/index.ts b/arco-design-pro-vite/src/router/index.ts index e230a4b..5e01309 100644 --- a/arco-design-pro-vite/src/router/index.ts +++ b/arco-design-pro-vite/src/router/index.ts @@ -3,7 +3,7 @@ import NProgress from 'nprogress'; // progress bar import 'nprogress/nprogress.css'; import { appRoutes } from './routes'; -import { REDIRECT_MAIN, NOT_FOUND_ROUTE } from './routes/base'; +import { REDIRECT_MAIN, NOT_FOUND_ROUTE, DEFAULT_LAYOUT } from './routes/base'; import createRouteGuard from './guard'; NProgress.configure({ showSpinner: false }); // NProgress Configuration @@ -13,7 +13,9 @@ const router = createRouter({ routes: [ { path: '/', - redirect: 'login', + component: DEFAULT_LAYOUT, + redirect: 'dashboard', + children: [...appRoutes], }, { path: '/login', @@ -23,7 +25,6 @@ const router = createRouter({ requiresAuth: false, }, }, - ...appRoutes, REDIRECT_MAIN, NOT_FOUND_ROUTE, ], diff --git a/arco-design-pro-vite/src/router/routes/modules/dashboard.ts b/arco-design-pro-vite/src/router/routes/modules/dashboard.ts index 61184fc..16ea56a 100644 --- a/arco-design-pro-vite/src/router/routes/modules/dashboard.ts +++ b/arco-design-pro-vite/src/router/routes/modules/dashboard.ts @@ -1,40 +1,40 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const DASHBOARD: AppRouteRecordRaw = { path: '/dashboard', name: 'dashboard', - component: DEFAULT_LAYOUT, + component: () => import('@/views/dashboard/workplace/index.vue'), meta: { locale: 'menu.dashboard', requiresAuth: true, icon: 'icon-dashboard', order: 0, + hideChildrenInMenu: true, }, - children: [ - { - path: 'workplace', - name: 'Workplace', - component: () => import('@/views/dashboard/workplace/index.vue'), - meta: { - locale: 'menu.dashboard.workplace', - requiresAuth: true, - roles: ['*'], - }, - }, - /** simple */ - { - path: 'monitor', - name: 'Monitor', - component: () => import('@/views/dashboard/monitor/index.vue'), - meta: { - locale: 'menu.dashboard.monitor', - requiresAuth: true, - roles: ['admin'], - }, - }, - /** simple end */ - ], + // children: [ + // { + // path: 'workplace', + // name: 'Workplace', + // component: () => import('@/views/dashboard/workplace/index.vue'), + // meta: { + // locale: 'menu.dashboard.workplace', + // requiresAuth: true, + // roles: ['*'], + // }, + // }, + // /** simple */ + // { + // path: 'monitor', + // name: 'Monitor', + // component: () => import('@/views/dashboard/monitor/index.vue'), + // meta: { + // locale: 'menu.dashboard.monitor', + // requiresAuth: true, + // roles: ['admin'], + // }, + // }, + // /** simple end */ + // ], }; export default DASHBOARD; diff --git a/arco-design-pro-vite/src/router/routes/modules/exception.ts b/arco-design-pro-vite/src/router/routes/modules/exception.ts index dac1ccc..65a49ef 100644 --- a/arco-design-pro-vite/src/router/routes/modules/exception.ts +++ b/arco-design-pro-vite/src/router/routes/modules/exception.ts @@ -1,10 +1,9 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const EXCEPTION: AppRouteRecordRaw = { path: '/exception', name: 'exception', - component: DEFAULT_LAYOUT, + redirect: '/exception/403', meta: { locale: 'menu.exception', requiresAuth: true, diff --git a/arco-design-pro-vite/src/router/routes/modules/form.ts b/arco-design-pro-vite/src/router/routes/modules/form.ts index 5c8682f..eb94afb 100644 --- a/arco-design-pro-vite/src/router/routes/modules/form.ts +++ b/arco-design-pro-vite/src/router/routes/modules/form.ts @@ -1,10 +1,9 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const FORM: AppRouteRecordRaw = { path: '/form', name: 'form', - component: DEFAULT_LAYOUT, + redirect: '/form/step', meta: { locale: 'menu.form', icon: 'icon-settings', diff --git a/arco-design-pro-vite/src/router/routes/modules/list.ts b/arco-design-pro-vite/src/router/routes/modules/list.ts index ba0bba6..44c0f5e 100644 --- a/arco-design-pro-vite/src/router/routes/modules/list.ts +++ b/arco-design-pro-vite/src/router/routes/modules/list.ts @@ -1,10 +1,9 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const LIST: AppRouteRecordRaw = { path: '/list', name: 'list', - component: DEFAULT_LAYOUT, + redirect: '/list/search-table', meta: { locale: 'menu.list', requiresAuth: true, diff --git a/arco-design-pro-vite/src/router/routes/modules/monitor.ts b/arco-design-pro-vite/src/router/routes/modules/monitor.ts new file mode 100644 index 0000000..2be976f --- /dev/null +++ b/arco-design-pro-vite/src/router/routes/modules/monitor.ts @@ -0,0 +1,16 @@ +import { AppRouteRecordRaw } from '../types'; + +const DASHBOARD: AppRouteRecordRaw = { + path: '/monitor', + name: 'monitor', + component: () => import('@/views/dashboard/monitor/index.vue'), + meta: { + locale: 'menu.dashboard.monitor', + requiresAuth: true, + roles: ['admin'], + icon: 'icon-dice', + order: 0, + }, +}; + +export default DASHBOARD; diff --git a/arco-design-pro-vite/src/router/routes/modules/profile.ts b/arco-design-pro-vite/src/router/routes/modules/profile.ts index 4c396fc..6aa2d76 100644 --- a/arco-design-pro-vite/src/router/routes/modules/profile.ts +++ b/arco-design-pro-vite/src/router/routes/modules/profile.ts @@ -1,10 +1,9 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const PROFILE: AppRouteRecordRaw = { path: '/profile', name: 'profile', - component: DEFAULT_LAYOUT, + redirect: '/profile/basic', meta: { locale: 'menu.profile', requiresAuth: true, diff --git a/arco-design-pro-vite/src/router/routes/modules/result.ts b/arco-design-pro-vite/src/router/routes/modules/result.ts index 52d281c..4918734 100644 --- a/arco-design-pro-vite/src/router/routes/modules/result.ts +++ b/arco-design-pro-vite/src/router/routes/modules/result.ts @@ -1,10 +1,9 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const RESULT: AppRouteRecordRaw = { path: '/result', name: 'result', - component: DEFAULT_LAYOUT, + redirect: '/result/success', meta: { locale: 'menu.result', icon: 'icon-check-circle', diff --git a/arco-design-pro-vite/src/router/routes/modules/user.ts b/arco-design-pro-vite/src/router/routes/modules/user.ts index 6390474..2f9d340 100644 --- a/arco-design-pro-vite/src/router/routes/modules/user.ts +++ b/arco-design-pro-vite/src/router/routes/modules/user.ts @@ -1,10 +1,9 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const USER: AppRouteRecordRaw = { path: '/user', name: 'user', - component: DEFAULT_LAYOUT, + redirect: '/user/info', meta: { locale: 'menu.user', icon: 'icon-user', diff --git a/arco-design-pro-vite/src/router/routes/modules/visualization.ts b/arco-design-pro-vite/src/router/routes/modules/visualization.ts index aefa2b1..1748ca0 100644 --- a/arco-design-pro-vite/src/router/routes/modules/visualization.ts +++ b/arco-design-pro-vite/src/router/routes/modules/visualization.ts @@ -1,10 +1,9 @@ -import { DEFAULT_LAYOUT } from '../base'; import { AppRouteRecordRaw } from '../types'; const VISUALIZATION: AppRouteRecordRaw = { path: '/visualization', name: 'visualization', - component: DEFAULT_LAYOUT, + redirect: '/visualization/data-analysis', meta: { locale: 'menu.visualization', requiresAuth: true, diff --git a/arco-design-pro-vite/src/router/routes/types.ts b/arco-design-pro-vite/src/router/routes/types.ts index 6b8e8d7..a215879 100644 --- a/arco-design-pro-vite/src/router/routes/types.ts +++ b/arco-design-pro-vite/src/router/routes/types.ts @@ -11,7 +11,7 @@ export interface AppRouteRecordRaw { name?: string | symbol; meta?: RouteMeta; redirect?: string; - component: Component | string; + component?: Component | string; children?: AppRouteRecordRaw[]; alias?: string | string[]; props?: Record;