15815213711
2022-03-07 56f8b51c26bd1fb7e1fdc62acab5151cdf83c860
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import {createRouter, createWebHistory, RouteRecordRaw} from "vue-router"
import Layout from '@/layout/index.vue'
 
type RouterConfig = RouteRecordRaw & { hidden?: boolean }
 
export const constantRoutes: Array<RouterConfig> = [
    {
        path: '/redirect',
        component: Layout,
        hidden: true,
        children: [
            {
                path: '/redirect/:path(.*)',
                component: () => import('@/views/redirect/index.vue')
            }
        ]
    },
    {
        path: '/login',
        component: () => import("@/views/login.vue"),
        hidden:true
    },
    {
        path: '',
        component: Layout,
        redirect: '/index',
        children: [
            {
                path: '/index',
                component: () => import("@/views/index.vue"),
                name: "Index",
                meta: {title: '首页', icon: 'dashboard', affix: true}
            }
        ]
    },
    {
        path: '/:pathMatch(.*)*',
        component:()=>import("@/views/error/404.vue"),
        hidden:true
    },
    {
        path: '/401',
        component:()=>import("@/views/error/401.vue"),
        hidden:true
    },
    {
        path: '/user',
        component: Layout,
        hidden: true,
        redirect: 'noredirect',
        children: [
            {
                path: 'profile',
                component: () => import("@/views/system/user/profile/index.vue"),
                name: 'Profile',
                meta: {title: '个人中心', icon: 'user'}
            }
        ]
    },
    {
        path:'/system/user-auth',
        component:Layout,
        hidden:true,
        children:[
            {
                path: "role/:userId(\\d+)",
                component:()=> import("@/views/system/user/authRole.vue"),
                name: "AuthRole",
                meta: {title: '分配角色',activeMenu:'/system/user'}
            }
        ]
    },
    {
        path:'/system/role-auth',
        component:Layout,
        hidden:true,
        children:[
            {
                path: "user/:roleId(\\d+)",
                component:()=> import("@/views/system/role/authUser.vue"),
                name: "AuthUser",
                meta: {title: '分配用户',activeMenu:'/system/role'}
            }
        ]
    },
    {
        path:'/system/dict-data',
        component:Layout,
        hidden:true,
        children:[
            {
                path: "index/:dictId(\\d+)",
                component:()=> import("@/views/system/dict/data.vue"),
                name: "Data",
                meta: {title: '字典数据',activeMenu:'/system/dict'}
            }
        ]
    },
    {
        path:'/monitor/job-log',
        component:Layout,
        hidden:true,
        children:[
            {
                path: "index",
                component:()=> import("@/views/monitor/job/log.vue"),
                name: "JobLog",
                meta: {title: '调度日志',activeMenu:'/monitor/job'}
            }
        ]
    }
];
 
const router = createRouter({
    history: createWebHistory(),
    routes: constantRoutes,
    scrollBehavior(_to, _from, _savedPosition) {
        if (_savedPosition) {
            return _savedPosition
        } else {
            return {top: 0}
        }
    }
});
 
export default router;