|
1
|
import { UserLayout, TabLayout, RouteView, BlankLayout, PageView } from '@/components/layouts'
|
1
|
import { UserLayout, TabLayout, RouteView, BlankLayout, PageView } from '@/components/layouts'
|
|
|
|
2
|
+import Vue from 'vue'
|
|
|
|
3
|
+import { USER_INFO } from '@/store/mutation-types'
|
|
2
|
|
4
|
|
|
3
|
/**
|
5
|
/**
|
|
4
|
* 走菜单,走权限控制
|
6
|
* 走菜单,走权限控制
|
|
5
|
* @type {[null,null]}
|
7
|
* @type {[null,null]}
|
|
6
|
*/
|
8
|
*/
|
|
7
|
export const asyncRouterMap = [
|
9
|
export const asyncRouterMap = [
|
|
8
|
-
|
|
|
|
9
|
{
|
10
|
{
|
|
10
|
path: '/',
|
11
|
path: '/',
|
|
11
|
name: 'dashboard',
|
12
|
name: 'dashboard',
|
|
12
|
component: TabLayout,
|
13
|
component: TabLayout,
|
|
13
|
meta: { title: '首页' },
|
14
|
meta: { title: '首页' },
|
|
14
|
redirect: '/dashboard/analysis',
|
15
|
redirect: '/dashboard/analysis',
|
|
15
|
- children: [
|
|
|
|
16
|
-
|
|
|
|
17
|
- // // dashboard
|
|
|
|
18
|
- // {
|
|
|
|
19
|
- // path: '/dashboard',
|
|
|
|
20
|
- // name: 'dashboard',
|
|
|
|
21
|
- // redirect: '/dashboard/workplace',
|
|
|
|
22
|
- // component: RouteView,
|
|
|
|
23
|
- // meta: { title: '仪表盘', icon: 'dashboard', permission: [ 'dashboard' ] },
|
|
|
|
24
|
- // children: [
|
|
|
|
25
|
- // {
|
|
|
|
26
|
- // path: '/dashboard/analysis',
|
|
|
|
27
|
- // name: 'Analysis',
|
|
|
|
28
|
- // component: () => import('@/views/dashboard/Analysis'),
|
|
|
|
29
|
- // meta: { title: '分析页', permission: [ 'dashboard' ] }
|
|
|
|
30
|
- // },
|
|
|
|
31
|
- // {
|
|
|
|
32
|
- // path: '/dashboard/monitor',
|
|
|
|
33
|
- // name: 'Monitor',
|
|
|
|
34
|
- // hidden: true,
|
|
|
|
35
|
- // component: () => import('@/views/dashboard/Monitor'),
|
|
|
|
36
|
- // meta: { title: '监控页', permission: [ 'dashboard' ] }
|
|
|
|
37
|
- // },
|
|
|
|
38
|
- // {
|
|
|
|
39
|
- // path: '/dashboard/workplace',
|
|
|
|
40
|
- // name: 'Workplace',
|
|
|
|
41
|
- // component: () => import('@/views/dashboard/Workplace'),
|
|
|
|
42
|
- // meta: { title: '工作台', permission: [ 'dashboard' ] }
|
|
|
|
43
|
- // }
|
|
|
|
44
|
- // ]
|
|
|
|
45
|
- // },
|
|
|
|
46
|
- //
|
|
|
|
47
|
- // // forms
|
|
|
|
48
|
- // {
|
|
|
|
49
|
- // path: '/form',
|
|
|
|
50
|
- // redirect: '/form/basic-form',
|
|
|
|
51
|
- // component: PageView,
|
|
|
|
52
|
- // meta: { title: '表单页', icon: 'form', permission: [ 'form' ] },
|
|
|
|
53
|
- // children: [
|
|
|
|
54
|
- // {
|
|
|
|
55
|
- // path: '/form/base-form',
|
|
|
|
56
|
- // name: 'BaseForm',
|
|
|
|
57
|
- // component: () => import('@/views/form/BasicForm'),
|
|
|
|
58
|
- // meta: { title: '基础表单', permission: [ 'form' ] }
|
|
|
|
59
|
- // },
|
|
|
|
60
|
- // {
|
|
|
|
61
|
- // path: '/form/step-form',
|
|
|
|
62
|
- // name: 'StepForm',
|
|
|
|
63
|
- // component: () => import('@/views/form/stepForm/StepForm'),
|
|
|
|
64
|
- // meta: { title: '分步表单', permission: [ 'form' ] }
|
|
|
|
65
|
- // },
|
|
|
|
66
|
- // {
|
|
|
|
67
|
- // path: '/form/advanced-form',
|
|
|
|
68
|
- // name: 'AdvanceForm',
|
|
|
|
69
|
- // component: () => import('@/views/form/advancedForm/AdvancedForm'),
|
|
|
|
70
|
- // meta: { title: '高级表单', permission: [ 'form' ] }
|
|
|
|
71
|
- // }
|
|
|
|
72
|
- // ]
|
|
|
|
73
|
- // },
|
|
|
|
74
|
- //
|
|
|
|
75
|
- // // list
|
|
|
|
76
|
- // {
|
|
|
|
77
|
- // path: '/list',
|
|
|
|
78
|
- // name: 'list',
|
|
|
|
79
|
- // component: PageView,
|
|
|
|
80
|
- // redirect: '/list/query-list',
|
|
|
|
81
|
- // meta: { title: '列表页', icon: 'table', permission: [ 'table' ] },
|
|
|
|
82
|
- // children: [
|
|
|
|
83
|
- // {
|
|
|
|
84
|
- // path: '/list/query-list',
|
|
|
|
85
|
- // name: 'QueryList',
|
|
|
|
86
|
- // component: () => import('@/views/list/TableList'),
|
|
|
|
87
|
- // meta: { title: '查询表格', permission: [ 'table' ] }
|
|
|
|
88
|
- // },
|
|
|
|
89
|
- // {
|
|
|
|
90
|
- // path: '/list/edit-table',
|
|
|
|
91
|
- // name: 'EditList',
|
|
|
|
92
|
- // component: () => import('@/views/list/TableInnerEditList'),
|
|
|
|
93
|
- // meta: { title: '内联编辑表格', permission: [ 'table' ] }
|
|
|
|
94
|
- // },
|
|
|
|
95
|
- // {
|
|
|
|
96
|
- // path: '/list/user-list',
|
|
|
|
97
|
- // name: 'UserList',
|
|
|
|
98
|
- // component: () => import('@/views/list/UserList'),
|
|
|
|
99
|
- // meta: { title: '用户列表', permission: [ 'table' ] }
|
|
|
|
100
|
- // },
|
|
|
|
101
|
- // {
|
|
|
|
102
|
- // path: '/list/role-list',
|
|
|
|
103
|
- // name: 'RoleList',
|
|
|
|
104
|
- // component: () => import('@/views/list/RoleList'),
|
|
|
|
105
|
- // meta: { title: '角色列表', permission: [ 'table' ] }
|
|
|
|
106
|
- // },
|
|
|
|
107
|
- // {
|
|
|
|
108
|
- // path: '/list/permission-list',
|
|
|
|
109
|
- // name: 'PermissionList',
|
|
|
|
110
|
- // component: () => import('@/views/list/PermissionList'),
|
|
|
|
111
|
- // meta: { title: '权限列表', permission: [ 'table' ] }
|
|
|
|
112
|
- // },
|
|
|
|
113
|
- // {
|
|
|
|
114
|
- // path: '/list/basic-list',
|
|
|
|
115
|
- // name: 'BasicList',
|
|
|
|
116
|
- // component: () => import('@/views/list/StandardList'),
|
|
|
|
117
|
- // meta: { title: '标准列表', permission: [ 'table' ] }
|
|
|
|
118
|
- // },
|
|
|
|
119
|
- // {
|
|
|
|
120
|
- // path: '/list/card',
|
|
|
|
121
|
- // name: 'CardList',
|
|
|
|
122
|
- // component: () => import('@/views/list/CardList'),
|
|
|
|
123
|
- // meta: { title: '卡片列表', permission: [ 'table' ] }
|
|
|
|
124
|
- // },
|
|
|
|
125
|
- // {
|
|
|
|
126
|
- // path: '/list/search',
|
|
|
|
127
|
- // name: 'SearchList',
|
|
|
|
128
|
- // component: () => import('@/views/list/search/SearchLayout'),
|
|
|
|
129
|
- // redirect: '/list/search/article',
|
|
|
|
130
|
- // meta: { title: '搜索列表', permission: [ 'table' ] },
|
|
|
|
131
|
- // children: [
|
|
|
|
132
|
- // {
|
|
|
|
133
|
- // path: '/list/search/article',
|
|
|
|
134
|
- // name: 'SearchArticles',
|
|
|
|
135
|
- // component: () => import('../views/list/TableList'),
|
|
|
|
136
|
- // meta: { title: '搜索列表(文章)', permission: [ 'table' ] }
|
|
|
|
137
|
- // },
|
|
|
|
138
|
- // {
|
|
|
|
139
|
- // path: '/list/search/project',
|
|
|
|
140
|
- // name: 'SearchProjects',
|
|
|
|
141
|
- // component: () => import('../views/list/TableList'),
|
|
|
|
142
|
- // meta: { title: '搜索列表(项目)', permission: [ 'table' ] }
|
|
|
|
143
|
- // },
|
|
|
|
144
|
- // {
|
|
|
|
145
|
- // path: '/list/search/application',
|
|
|
|
146
|
- // name: 'SearchApplications',
|
|
|
|
147
|
- // component: () => import('../views/list/TableList'),
|
|
|
|
148
|
- // meta: { title: '搜索列表(应用)', permission: [ 'table' ] }
|
|
|
|
149
|
- // },
|
|
|
|
150
|
- // ]
|
|
|
|
151
|
- // },
|
|
|
|
152
|
- // ]
|
|
|
|
153
|
- // },
|
|
|
|
154
|
- //
|
|
|
|
155
|
- // // profile
|
|
|
|
156
|
- // {
|
|
|
|
157
|
- // path: '/profile',
|
|
|
|
158
|
- // name: 'profile',
|
|
|
|
159
|
- // component: RouteView,
|
|
|
|
160
|
- // redirect: '/profile/basic',
|
|
|
|
161
|
- // meta: { title: '详情页', icon: 'profile', permission: [ 'profile' ] },
|
|
|
|
162
|
- // children: [
|
|
|
|
163
|
- // {
|
|
|
|
164
|
- // path: '/profile/basic',
|
|
|
|
165
|
- // name: 'ProfileBasic',
|
|
|
|
166
|
- // component: () => import('@/views/profile/basic/Index'),
|
|
|
|
167
|
- // meta: { title: '基础详情页', permission: [ 'profile' ] }
|
|
|
|
168
|
- // },
|
|
|
|
169
|
- // {
|
|
|
|
170
|
- // path: '/profile/advanced',
|
|
|
|
171
|
- // name: 'ProfileAdvanced',
|
|
|
|
172
|
- // component: () => import('@/views/profile/advanced/Advanced'),
|
|
|
|
173
|
- // meta: { title: '高级详情页', permission: [ 'profile' ] }
|
|
|
|
174
|
- // }
|
|
|
|
175
|
- // ]
|
|
|
|
176
|
- // },
|
|
|
|
177
|
- //
|
|
|
|
178
|
- // // result
|
|
|
|
179
|
- // {
|
|
|
|
180
|
- // path: '/result',
|
|
|
|
181
|
- // name: 'result',
|
|
|
|
182
|
- // component: PageView,
|
|
|
|
183
|
- // redirect: '/result/success',
|
|
|
|
184
|
- // meta: { title: '结果页', icon: 'check-circle-o', permission: [ 'result' ] },
|
|
|
|
185
|
- // children: [
|
|
|
|
186
|
- // {
|
|
|
|
187
|
- // path: '/result/success',
|
|
|
|
188
|
- // name: 'ResultSuccess',
|
|
|
|
189
|
- // component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
|
|
|
|
190
|
- // meta: { title: '成功', hiddenHeaderContent: true, permission: [ 'result' ] }
|
|
|
|
191
|
- // },
|
|
|
|
192
|
- // {
|
|
|
|
193
|
- // path: '/result/fail',
|
|
|
|
194
|
- // name: 'ResultFail',
|
|
|
|
195
|
- // component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
|
|
|
|
196
|
- // meta: { title: '失败', hiddenHeaderContent: true, permission: [ 'result' ] }
|
|
|
|
197
|
- // }
|
|
|
|
198
|
- // ]
|
|
|
|
199
|
- // },
|
|
|
|
200
|
- //
|
|
|
|
201
|
- // // Exception
|
|
|
|
202
|
- // {
|
|
|
|
203
|
- // path: '/exception',
|
|
|
|
204
|
- // name: 'exception',
|
|
|
|
205
|
- // component: RouteView,
|
|
|
|
206
|
- // redirect: '/exception/403',
|
|
|
|
207
|
- // meta: { title: '异常页', icon: 'warning', permission: [ 'exception' ] },
|
|
|
|
208
|
- // children: [
|
|
|
|
209
|
- // {
|
|
|
|
210
|
- // path: '/exception/403',
|
|
|
|
211
|
- // name: 'Exception403',
|
|
|
|
212
|
- // component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
|
|
|
|
213
|
- // meta: { title: '403', permission: [ 'exception' ] }
|
|
|
|
214
|
- // },
|
|
|
|
215
|
- // {
|
|
|
|
216
|
- // path: '/exception/404',
|
|
|
|
217
|
- // name: 'Exception404',
|
|
|
|
218
|
- // component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
|
|
|
|
219
|
- // meta: { title: '404', permission: [ 'exception' ] }
|
|
|
|
220
|
- // },
|
|
|
|
221
|
- // {
|
|
|
|
222
|
- // path: '/exception/500',
|
|
|
|
223
|
- // name: 'Exception500',
|
|
|
|
224
|
- // component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
|
|
|
|
225
|
- // meta: { title: '500', permission: [ 'exception' ] }
|
|
|
|
226
|
- // }
|
|
|
|
227
|
- // ]
|
|
|
|
228
|
- // },
|
|
|
|
229
|
- //
|
|
|
|
230
|
- // // account
|
|
|
|
231
|
- // {
|
|
|
|
232
|
- // path: '/account',
|
|
|
|
233
|
- // component: RouteView,
|
|
|
|
234
|
- // name: 'account',
|
|
|
|
235
|
- // meta: { title: '个人页', icon: 'user', keepAlive: true, permission: [ 'user' ] },
|
|
|
|
236
|
- // children: [
|
|
|
|
237
|
- // {
|
|
|
|
238
|
- // path: '/account/center',
|
|
|
|
239
|
- // name: 'center',
|
|
|
|
240
|
- // component: () => import('@/views/account/center/Index'),
|
|
|
|
241
|
- // meta: { title: '个人中心', keepAlive: true, permission: [ 'user' ] }
|
|
|
|
242
|
- // },
|
|
|
|
243
|
- // {
|
|
|
|
244
|
- // path: '/account/settings',
|
|
|
|
245
|
- // name: 'settings',
|
|
|
|
246
|
- // component: () => import('@/views/account/settings/Index'),
|
|
|
|
247
|
- // meta: { title: '个人设置', hideHeader: true, keepAlive: true, permission: [ 'user' ] },
|
|
|
|
248
|
- // redirect: '/account/settings/base',
|
|
|
|
249
|
- // alwaysShow: true,
|
|
|
|
250
|
- // children: [
|
|
|
|
251
|
- // {
|
|
|
|
252
|
- // path: '/account/settings/base',
|
|
|
|
253
|
- // name: 'BaseSettings',
|
|
|
|
254
|
- // component: () => import('@/views/account/settings/BaseSetting'),
|
|
|
|
255
|
- // meta: { title: '基本设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
|
|
|
|
256
|
- // },
|
|
|
|
257
|
- // {
|
|
|
|
258
|
- // path: '/account/settings/security',
|
|
|
|
259
|
- // name: 'SecuritySettings',
|
|
|
|
260
|
- // component: () => import('@/views/account/settings/Security'),
|
|
|
|
261
|
- // meta: { title: '安全设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
|
|
|
|
262
|
- // },
|
|
|
|
263
|
- // {
|
|
|
|
264
|
- // path: '/account/settings/custom',
|
|
|
|
265
|
- // name: 'CustomSettings',
|
|
|
|
266
|
- // component: () => import('@/views/account/settings/Custom'),
|
|
|
|
267
|
- // meta: { title: '个性化设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
|
|
|
|
268
|
- // },
|
|
|
|
269
|
- // {
|
|
|
|
270
|
- // path: '/account/settings/binding',
|
|
|
|
271
|
- // name: 'BindingSettings',
|
|
|
|
272
|
- // component: () => import('@/views/account/settings/Binding'),
|
|
|
|
273
|
- // meta: { title: '账户绑定', hidden: true, keepAlive: true, permission: [ 'user' ] }
|
|
|
|
274
|
- // },
|
|
|
|
275
|
- // {
|
|
|
|
276
|
- // path: '/account/settings/notification',
|
|
|
|
277
|
- // name: 'NotificationSettings',
|
|
|
|
278
|
- // component: () => import('@/views/account/settings/Notification'),
|
|
|
|
279
|
- // meta: { title: '新消息通知', hidden: true, keepAlive: true, permission: [ 'user' ] }
|
|
|
|
280
|
- // },
|
|
|
|
281
|
- // ]
|
|
|
|
282
|
- // },
|
|
|
|
283
|
- // ]
|
|
|
|
284
|
- // }
|
|
|
|
285
|
- ]
|
16
|
+ children: []
|
|
286
|
},
|
17
|
},
|
|
287
|
{
|
18
|
{
|
|
288
|
- path: '*', redirect: '/404', hidden: true
|
19
|
+ path: '*',
|
|
|
|
20
|
+ redirect: (to) => {
|
|
|
|
21
|
+ const userInfo = Vue.ls.get(USER_INFO)
|
|
|
|
22
|
+ if (userInfo && userInfo.id) {
|
|
|
|
23
|
+ return { name: 'dashboard' }
|
|
|
|
24
|
+ } else {
|
|
|
|
25
|
+ return '/404'
|
|
|
|
26
|
+ }
|
|
|
|
27
|
+ },
|
|
|
|
28
|
+ hidden: true
|
|
289
|
}
|
29
|
}
|
|
290
|
]
|
30
|
]
|
|
291
|
|
31
|
|
|
@@ -322,31 +62,6 @@ export const constantRouterMap = [ |
|
@@ -322,31 +62,6 @@ export const constantRouterMap = [ |
|
322
|
},
|
62
|
},
|
|
323
|
]
|
63
|
]
|
|
324
|
},
|
64
|
},
|
|
325
|
-
|
|
|
|
326
|
- // {
|
|
|
|
327
|
- // path: '/',
|
|
|
|
328
|
- // name: 'index',
|
|
|
|
329
|
- // component: TabLayout,
|
|
|
|
330
|
- // meta: {title: '首页'},
|
|
|
|
331
|
- // redirect: '/dashboard/workplace',
|
|
|
|
332
|
- // children: [
|
|
|
|
333
|
- // {
|
|
|
|
334
|
- // path: '/online',
|
|
|
|
335
|
- // name: 'online',
|
|
|
|
336
|
- // redirect: '/online',
|
|
|
|
337
|
- // component: RouteView,
|
|
|
|
338
|
- // meta: {title: '在线开发', icon: 'dashboard', permission: ['dashboard']},
|
|
|
|
339
|
- // children: [
|
|
|
|
340
|
- // {
|
|
|
|
341
|
- // path: '/online/auto/:code',
|
|
|
|
342
|
- // name: 'report',
|
|
|
|
343
|
- // component: () => import('@/views/modules/online/cgreport/OnlCgreportAutoList')
|
|
|
|
344
|
- // },
|
|
|
|
345
|
- // ]
|
|
|
|
346
|
- // },
|
|
|
|
347
|
- // ]
|
|
|
|
348
|
- // },
|
|
|
|
349
|
-
|
|
|
|
350
|
{
|
65
|
{
|
|
351
|
// OAuth2 APP页面路由
|
66
|
// OAuth2 APP页面路由
|
|
352
|
path: '/oauth2-app',
|
67
|
path: '/oauth2-app',
|
|
@@ -361,7 +76,6 @@ export const constantRouterMap = [ |
|
@@ -361,7 +76,6 @@ export const constantRouterMap = [ |
|
361
|
},
|
76
|
},
|
|
362
|
]
|
77
|
]
|
|
363
|
},
|
78
|
},
|
|
364
|
-
|
|
|
|
365
|
{
|
79
|
{
|
|
366
|
path: '/test',
|
80
|
path: '/test',
|
|
367
|
component: BlankLayout,
|
81
|
component: BlankLayout,
|
|
@@ -376,7 +90,14 @@ export const constantRouterMap = [ |
|
@@ -376,7 +90,14 @@ export const constantRouterMap = [ |
|
376
|
},
|
90
|
},
|
|
377
|
{
|
91
|
{
|
|
378
|
path: '/404',
|
92
|
path: '/404',
|
|
379
|
- component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
|
|
|
|
380
|
- },
|
|
|
|
381
|
-
|
93
|
+ component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
|
|
|
|
94
|
+ beforeEnter: (to, from, next) => {
|
|
|
|
95
|
+ const userInfo = Vue.ls.get(USER_INFO)
|
|
|
|
96
|
+ if (userInfo && userInfo.id) {
|
|
|
|
97
|
+ next({ name: 'dashboard' })
|
|
|
|
98
|
+ } else {
|
|
|
|
99
|
+ next()
|
|
|
|
100
|
+ }
|
|
|
|
101
|
+ }
|
|
|
|
102
|
+ }
|
|
382
|
] |
103
|
] |