Skip to content

Commit 87feb6a

Browse files
committed
add(view): router and views
1 parent e98b163 commit 87feb6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+7321
-1
lines changed

admin/src/router/index.js

Lines changed: 310 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,315 @@ import Layout from '@/layout'
3030
* a base page that does not have permission requirements
3131
* all roles can be accessed
3232
*/
33+
const Super = 'Super Administrator'
34+
const Admin = 'Admin'
35+
36+
// 管理一般路由
37+
export const routeAdmin = [
38+
{
39+
path: '/api_excel',
40+
component: Layout,
41+
redirect: '/api_excel/index',
42+
name: 'Excel-List',
43+
meta: { title: '批量测试管理', icon: 'ico-table', roles: [Super, Admin] },
44+
children: [
45+
{ path: '/api_excel/edit/:id', name: 'EditExcel', component: () => import('@/views/api_excel/edit'), hidden: true },
46+
{
47+
path: '/api_excel/add',
48+
name: 'AddExcel',
49+
component: () => import('@/views/api_excel/add'),
50+
meta: { title: '上传测试', icon: 'excel', roles: [Super, Admin] }
51+
},
52+
{
53+
path: '/api_excel/index',
54+
name: 'Excel',
55+
component: () => import('@/views/api_excel/index'),
56+
meta: { title: '测试管理', icon: 'ico-aliyun', roles: [Super, Admin] }
57+
},
58+
{ path: '/api_param/add', name: 'AddApiParam', component: () => import('@/views/api_param/add'), hidden: true },
59+
{ path: '/api_param/edit/:id', name: 'EditApiParam', component: () => import('@/views/api_param/edit'), hidden: true },
60+
{
61+
path: '/api_param/index',
62+
name: 'ApiParam',
63+
component: () => import('@/views/api_param/index'),
64+
meta: { title: '接口列表', icon: 'api', roles: [Super, Admin] }
65+
}
66+
]
67+
}
68+
]
69+
// 超级管理员路由
70+
export const routeSuper = [
71+
// { path: '/', redirect: '/index', hidden: true },
72+
73+
{
74+
path: '/category',
75+
component: Layout,
76+
redirect: '/category/index',
77+
name: 'Category-Nav',
78+
meta: { title: '栏目菜单', icon: 'category', roles: [Super] },
79+
children: [
80+
{ path: '/category/add', name: 'AddCategory', component: () => import('@/views/category/add'), meta: { title: '添加栏目' }, hidden: true },
81+
{ path: '/category/edit/:id', name: 'EditCategory', component: () => import('@/views/category/edit'), hidden: true },
82+
{
83+
path: '/category/index',
84+
name: 'Category',
85+
component: () => import('@/views/category/index'),
86+
meta: { title: '栏目管理', icon: 'ico-category', roles: [Super] }
87+
},
88+
{ path: '/nav/add', name: 'AddNav', component: () => import('@/views/nav/add'), hidden: true },
89+
{ path: '/nav/edit/:id', name: 'EditNav', component: () => import('@/views/nav/edit'), hidden: true },
90+
{
91+
path: '/nav',
92+
name: 'Nav',
93+
component: () => import('@/views/nav'),
94+
meta: { title: '导航管理', icon: 'nav', roles: [Super] }
95+
},
96+
{ path: '/tag/add', name: 'AddTag', component: () => import('@/views/tag/add'), meta: { title: '添加标签' }, hidden: true },
97+
{ path: '/tag/edit/:id', name: 'EditTag', component: () => import('@/views/tag/edit'), hidden: true },
98+
{
99+
path: '/tag',
100+
name: 'Tag',
101+
component: () => import('@/views/tag/index'),
102+
meta: { title: '标签列表', icon: 'tag', roles: [Super] }
103+
}
104+
]
105+
},
106+
107+
{
108+
path: '/article',
109+
component: Layout,
110+
// redirect: '/article',
111+
name: 'Article-List',
112+
meta: { title: '文章管理', icon: 'article', roles: [Super] },
113+
children: [
114+
{ path: '/article/edit/:id', name: 'EditArticle', component: () => import('@/views/article/edit'), hidden: true },
115+
{
116+
path: '/article/index',
117+
name: 'Article',
118+
component: () => import('@/views/article/index'),
119+
meta: { title: '文章管理', icon: 'ico-article', roles: [Super] }
120+
},
121+
{
122+
path: '/article/add',
123+
name: 'AddArticle',
124+
component: () => import('@/views/article/add'),
125+
meta: { title: '添加文章', icon: 'add', roles: [Super] }
126+
}
127+
]
128+
},
129+
130+
{
131+
path: '/list',
132+
component: Layout,
133+
redirect: '/task',
134+
name: '公交',
135+
meta: { title: '公交管理', icon: 'bus', roles: [Super] },
136+
children: [
137+
{ path: '/task/search', name: 'search', component: () => import('@/views/task/search'), hidden: true },
138+
{ path: '/task/newBus', name: 'NewBus', component: () => import('@/views/task/newBus'), hidden: true },
139+
{ path: '/task/edit/:id', name: 'taskEdit', component: () => import('@/views/task/edit'), hidden: true },
140+
{
141+
path: '/task',
142+
name: '定时任务',
143+
component: () => import('@/views/task/index'),
144+
meta: { title: '定时任务', icon: 'task', roles: [Super] }
145+
},
146+
{ path: 'lines/add', name: 'linesAdd', component: () => import('@/views/lines/add'), hidden: true },
147+
{ path: 'lines/edit/:id', name: 'linesEdit', component: () => import('@/views/lines/edit'), hidden: true },
148+
{
149+
path: 'lines',
150+
name: '公交列表',
151+
component: () => import('@/views/lines/index'),
152+
meta: { title: '公交列表', icon: 'table', roles: [Super] }
153+
},
154+
{
155+
path: 'config',
156+
name: '配置管理',
157+
component: () => import('@/views/config/index'),
158+
meta: { title: '配置列表', icon: 'table', roles: [Super] }
159+
}
160+
]
161+
},
162+
163+
{
164+
path: 'user',
165+
component: Layout,
166+
redirect: '/user',
167+
name: '权限',
168+
meta: { title: '权限管理', icon: 'auth', roles: [Super] },
169+
children: [
170+
{ path: 'index', name: 'userIndex', component: () => import('@/views/user/index'), hidden: true },
171+
{ path: 'password', name: 'userPassword', component: () => import('@/views/user/password'), hidden: true },
172+
{ path: '/user/add', name: 'AddUser', component: () => import('@/views/user/add'), hidden: true },
173+
{ path: '/user/edit/:id', name: 'EditUser', component: () => import('@/views/user/edit'), hidden: true },
174+
{
175+
path: '/user',
176+
name: '用户管理',
177+
component: () => import('@/views/user/index'),
178+
meta: { title: '用户列表', icon: 'user', roles: [Super] }
179+
},
180+
{ path: '/permission/add', name: 'AddPermission', component: () => import('@/views/permission/add'), hidden: true },
181+
{ path: '/permission/edit/:id', name: 'EditPermission', component: () => import('@/views/permission/edit'), hidden: true },
182+
{
183+
path: '/permission',
184+
name: '权限列表',
185+
component: () => import('@/views/permission/index'),
186+
meta: { title: '权限列表', icon: 'permission', roles: [Super] }
187+
},
188+
189+
{ path: '/role/add', name: 'Addroles', component: () => import('@/views/role/add'), hidden: true },
190+
{ path: '/role/edit/:id', name: 'Editroles', component: () => import('@/views/role/edit'), hidden: true },
191+
{
192+
path: '/role',
193+
name: '角色管理',
194+
component: () => import('@/views/role/index'),
195+
meta: { title: '角色管理', icon: 'role', roles: [Super] }
196+
}
197+
]
198+
}
199+
200+
]
201+
202+
// 基础路由
203+
const routeBase = [
204+
{ path: '/', name: 'index', component: () => import('@/views/home/index'), hidden: true },
205+
{ path: '/line', name: 'line', component: () => import('@/views/home/line'), hidden: true },
206+
{ path: '/home', component: () => import('@/views/home/home'), hidden: true },
207+
{ path: '/md', name: 'md', component: () => import('@/views/markdown/index'), hidden: true },
208+
{ path: '/out', name: 'out', component: () => import('@/views/home/out'), hidden: true },
209+
{ path: '/excel', name: 'excel', component: () => import('@/views/home/excel'), hidden: true },
210+
{ path: '/upload', name: 'upload', component: () => import('@/views/home/upload'), hidden: true },
211+
{ path: '/websocket', name: 'websocket', component: () => import('@/views/home/websocket'), hidden: true },
212+
{ path: '/echarts', name: 'echarts', component: () => import('@/views/echarts/index'), hidden: true },
213+
// { path: '/index', component: () => import('@/views/home/index'), hidden: true },
214+
{ path: '/login', component: () => import('@/views/login/index'), hidden: true },
215+
{ path: '/404', component: () => import('@/views/404'), hidden: true },
216+
217+
{
218+
path: '/admin',
219+
component: Layout,
220+
redirect: '/admin/dashboard',
221+
name: 'Dashboard',
222+
hidden: true,
223+
children: [{
224+
path: 'dashboard',
225+
component: () => import('@/views/dashboard/index'),
226+
meta: { title: 'Dashboard', icon: 'dashboard' }
227+
}]
228+
}
229+
]
230+
231+
const routeTest = [
232+
{
233+
path: '/example',
234+
component: Layout,
235+
redirect: '/example/table',
236+
name: 'Example',
237+
meta: { title: 'Example', icon: 'example' },
238+
children: [
239+
{
240+
path: 'table',
241+
name: 'Table',
242+
component: () => import('@/views/table/index'),
243+
meta: { title: 'Table', icon: 'table' }
244+
},
245+
{
246+
path: 'tree',
247+
name: 'Tree',
248+
component: () => import('@/views/tree/index'),
249+
meta: { title: 'Tree', icon: 'tree' }
250+
}
251+
]
252+
},
253+
254+
{
255+
path: '/form',
256+
component: Layout,
257+
children: [
258+
{
259+
path: 'index',
260+
name: 'Form',
261+
component: () => import('@/views/form/index'),
262+
meta: { title: 'Form', icon: 'form' }
263+
}
264+
]
265+
},
266+
267+
{
268+
path: '/nested',
269+
component: Layout,
270+
redirect: '/nested/menu1',
271+
name: 'Nested',
272+
meta: {
273+
title: 'Nested',
274+
icon: 'nested'
275+
},
276+
children: [
277+
{
278+
path: 'menu1',
279+
component: () => import('@/views/nested/menu1/index'), // Parent router-view
280+
name: 'Menu1',
281+
meta: { title: 'Menu1' },
282+
children: [
283+
{
284+
path: 'menu1-1',
285+
component: () => import('@/views/nested/menu1/menu1-1'),
286+
name: 'Menu1-1',
287+
meta: { title: 'Menu1-1' }
288+
},
289+
{
290+
path: 'menu1-2',
291+
component: () => import('@/views/nested/menu1/menu1-2'),
292+
name: 'Menu1-2',
293+
meta: { title: 'Menu1-2' },
294+
children: [
295+
{
296+
path: 'menu1-2-1',
297+
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
298+
name: 'Menu1-2-1',
299+
meta: { title: 'Menu1-2-1' }
300+
},
301+
{
302+
path: 'menu1-2-2',
303+
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
304+
name: 'Menu1-2-2',
305+
meta: { title: 'Menu1-2-2' }
306+
}
307+
]
308+
},
309+
{
310+
path: 'menu1-3',
311+
component: () => import('@/views/nested/menu1/menu1-3'),
312+
name: 'Menu1-3',
313+
meta: { title: 'Menu1-3' }
314+
}
315+
]
316+
},
317+
{
318+
path: 'menu2',
319+
component: () => import('@/views/nested/menu2/index'),
320+
meta: { title: 'menu2' }
321+
}
322+
]
323+
},
324+
325+
{
326+
path: 'external-link',
327+
component: Layout,
328+
children: [
329+
{
330+
path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
331+
meta: { title: 'External Link', icon: 'link' }
332+
}
333+
]
334+
},
335+
336+
// 404 page must be placed at the end !!!
337+
{ path: '*', redirect: '/404', hidden: true }
338+
]
339+
340+
export const constantRouterMap = [...routeAdmin, ...routeSuper, ...routeBase, ...routeTest]
341+
33342
export const constantRoutes = [
34343
{
35344
path: '/login',
@@ -166,7 +475,7 @@ export const constantRoutes = [
166475
const createRouter = () => new Router({
167476
// mode: 'history', // require service support
168477
scrollBehavior: () => ({ y: 0 }),
169-
routes: constantRoutes
478+
routes: constantRouterMap
170479
})
171480

172481
const router = createRouter()

0 commit comments

Comments
 (0)