Files
lingji-work-fe/src/router/index.ts

62 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-06-16 14:42:26 +08:00
/*
* @Author:
* @Date: 2023-03-05 18:14:17
* @LastEditors:
* @LastEditTime: 2023-03-05 19:20:40
* @Description:
*/
import { createRouter, createWebHistory } from 'vue-router';
import { appRoutes } from './routes';
import { REDIRECT_MAIN, NOT_FOUND_ROUTE } from './routes/base';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import createRouteGuard from './guard';
NProgress.configure({ showSpinner: false }); // NProgress Configuration
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
2025-06-17 11:18:39 +08:00
path: '/login',
name: 'login',
component: () => import('@/views/components/login'),
},
{
path: '/workplace',
2025-06-16 14:42:26 +08:00
name: 'workplace',
component: () => import('@/views/components/workplace'),
},
2025-06-17 11:18:39 +08:00
{
path: '/',
name: 'dataEngine',
redirect: '/dataEngine/dataEngine/hotTranslation',
children: [...appRoutes, REDIRECT_MAIN, NOT_FOUND_ROUTE],
},
2025-06-16 14:42:26 +08:00
{
path: '/dataEngine',
name: 'dataEngine',
2025-06-17 11:18:39 +08:00
redirect: '/dataEngine/dataEngine/hotTranslation',
2025-06-16 14:42:26 +08:00
children: [...appRoutes, REDIRECT_MAIN, NOT_FOUND_ROUTE],
},
{
path: '/permission',
name: 'permission',
component: () => import('@/views/components/permission/choose-enterprise.vue'),
},
{
path: '/auth',
name: 'auth',
component: () => import('@/views/components/permission/auth.vue'),
},
],
scrollBehavior() {
return { top: 0 };
},
});
createRouteGuard(router);
export default router;