routes.js
5.13 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
import layoutHeaderAside from '@/layout/header-aside'
// 由于懒加载页面太多的话会造成webpack热更新太慢,所以开发环境不使用懒加载,只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)
/**
* 在主框架内显示(children 由后台返回资源点集合 从 resources 中动态过滤加载)
*/
const frameIn = [{
path: '/',
redirect: {
name: 'index'
},
component: layoutHeaderAside,
children: []
}]
/**
* 首页
* icon:element-ui
*/
export const home = {
path: '/index',
name: 'index',
icon: 's-home',
meta: {
title: '总览',
authId: '101',
parentId: '0',
cache: true
},
component: _import('index')
}
export const sys = [
// 系统 前端日志
// {
// path: '/log',
// name: 'log',
// meta: {
// title: '前端日志',
// },
// component: _import('system/log')
// },
// 刷新页面 必须保留
{
path: '/refresh',
name: 'refresh',
hidden: true,
component: _import('system/function/refresh')
},
// 页面重定向 必须保留
{
path: 'redirect/:route*',
name: 'redirect',
hidden: true,
component: _import('system/function/redirect')
}
]
/**
* 所有需动态过滤的资源点
*/
export const resources = {
'102': {
path: '/customer',
icon: 'user-solid',
name: 'customer',
meta: {
title: '客户管理',
authId: '102',
parentId: '0',
cache: true
},
auth: [{
authId: '10201',
parentId: '102',
label: '重置密码',
handle: 'handleResetPassword',
ruleObj: {
attr: 'status',
rule: {
0: '重置密码',
1: '重置密码',
2: ''
}
}
}, {
authId: '10202',
parentId: '102',
label: '启用',
handle: 'handleUpOrDown',
ruleObj: {
attr: 'status',
rule: {
0: '启用',
1: '停用',
2: ''
}
}
}, {
authId: '10203',
parentId: '102',
label: '审核通过',
handle: 'handleExamine',
ruleObj: {
attr: 'status',
rule: {
0: '',
1: '',
2: '审核通过'
}
}
}],
component: _import('customer/customer')
},
'103': {
path: '/device',
icon: 's-platform',
name: 'device',
meta: {
title: '设备管理',
authId: '103',
parentId: '0',
cache: true
},
auth: [{
authId: '10301',
parentId: '103',
label: '导入',
category: 'Button',
handle: 'handleImport'
}],
component: _import('device/device')
},
// '104': {
// path: '/user',
// icon: 'user-solid',
// name: 'user',
// meta: {
// title: '用户管理',
// authId: '104',
// parentId: '0',
// cache: true
// },
// component: _import('user/user')
// },
// '105': {
// path: '/apiManage',
// icon: 's-order',
// name: 'apiManage',
// meta: {
// title: 'API管理',
// authId: '105',
// parentId: '0',
// cache: true
// }
// },
// '10501': {
// path: '/apiList',
// icon: 'document-copy',
// name: 'apiList',
// meta: {
// title: 'API列表',
// authId: '10501',
// parentId: '105',
// cache: true
// },
// auth: [{
// authId: '1050101',
// parentId: '10501',
// label: '启用',
// handle: 'handleUpOrDown',
// ruleObj: {
// attr: 'status',
// rule: { 0: '启用', 1: '停用' }
// }
// }
// ],
// component: _import('apiManage/apiList')
// },
// '10502': {
// path: '/apiRecord',
// icon: 'document-copy',
// name: 'apiRecord',
// meta: {
// title: 'API调用记录',
// authId: '10502',
// parentId: '105',
// cache: true
// },
// component: _import('apiManage/apiRecord')
// }
'106': {
path: '/appMarket',
icon: 'document-copy',
name: 'appMarket',
meta: {
title: 'APP营销管理',
authId: '106',
parentId: '0',
cache: true
// sideHidden: true
},
auth: [{
authId: '10601',
parentId: '106',
label: '新增',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
}, {
authId: '10602',
parentId: '106',
label: '编辑',
handle: 'handleEdit'
}, {
authId: '10603',
parentId: '106',
label: '下架',
handle: 'handleUpOrDown',
ruleObj: {
attr: 'status',
rule: { 0: '上架', 1: '下架' }
}
}],
component: _import('appMarket/appMarket')
}
}
/**
* 在主框架之外显示
*/
const frameOut = [
// 登录
{
path: '/login',
name: 'login',
component: _import('system/login')
}
]
/**
* 错误页面
*/
export const errorPage = {
path: '*',
name: '404',
component: _import('system/error/404')
}
// 导出需要显示菜单的
export const frameInRoutes = frameIn
export const localRoutes = {
...resources,
[home.meta.authId]: home
}
// 重新组织后导出
export default [
...frameOut,
errorPage
]