2025-06-16 14:42:26 +08:00
|
|
|
/*
|
2025-06-23 03:16:55 -04:00
|
|
|
* @Author: RenXiaoDong
|
|
|
|
|
* @Date: 2025-06-22 22:59:16
|
2025-06-16 14:42:26 +08:00
|
|
|
*/
|
|
|
|
|
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
|
2025-06-23 05:58:04 -04:00
|
|
|
// console.log({ appRoutes });
|
2025-06-16 14:42:26 +08:00
|
|
|
const router = createRouter({
|
|
|
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
|
|
|
routes: [
|
|
|
|
|
{
|
2025-06-17 11:18:39 +08:00
|
|
|
path: '/login',
|
2025-06-23 01:46:41 -04:00
|
|
|
name: 'UserLogin',
|
2025-06-17 11:18:39 +08:00
|
|
|
component: () => import('@/views/components/login'),
|
2025-06-23 03:16:55 -04:00
|
|
|
meta: {
|
2025-06-23 05:58:04 -04:00
|
|
|
requiresAuth: false,
|
2025-06-23 03:16:55 -04:00
|
|
|
},
|
2025-06-17 11:18:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-06-23 23:59:08 -04:00
|
|
|
path: '/',
|
|
|
|
|
name: 'Home',
|
2025-06-16 14:42:26 +08:00
|
|
|
component: () => import('@/views/components/workplace'),
|
2025-06-22 22:52:03 -04:00
|
|
|
meta: {
|
|
|
|
|
hideSidebar: true,
|
2025-06-23 05:58:04 -04:00
|
|
|
requiresAuth: true,
|
2025-06-22 22:52:03 -04:00
|
|
|
},
|
2025-06-16 14:42:26 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/permission',
|
|
|
|
|
name: 'permission',
|
|
|
|
|
component: () => import('@/views/components/permission/choose-enterprise.vue'),
|
2025-06-23 03:16:55 -04:00
|
|
|
meta: {
|
2025-06-23 05:58:04 -04:00
|
|
|
requiresAuth: true,
|
2025-06-23 03:16:55 -04:00
|
|
|
},
|
2025-06-16 14:42:26 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
path: '/auth',
|
|
|
|
|
name: 'auth',
|
|
|
|
|
component: () => import('@/views/components/permission/auth.vue'),
|
2025-06-23 03:16:55 -04:00
|
|
|
meta: {
|
2025-06-23 05:58:04 -04:00
|
|
|
requiresAuth: false,
|
2025-06-23 03:16:55 -04:00
|
|
|
},
|
2025-06-18 18:00:33 +08:00
|
|
|
},
|
2025-06-23 22:03:57 -04:00
|
|
|
{
|
|
|
|
|
path: '/',
|
2025-06-23 23:59:08 -04:00
|
|
|
name: '',
|
2025-06-23 22:03:57 -04:00
|
|
|
children: [...appRoutes, REDIRECT_MAIN, NOT_FOUND_ROUTE],
|
|
|
|
|
meta: {
|
|
|
|
|
requiresAuth: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-06-16 14:42:26 +08:00
|
|
|
],
|
|
|
|
|
scrollBehavior() {
|
|
|
|
|
return { top: 0 };
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
createRouteGuard(router);
|
|
|
|
|
|
|
|
|
|
export default router;
|