routes.js
3.7 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
const pages = {
customerGroup: [
{
name: 'index',
meta: {
title: '一客一群',
backgroundColor: '#F7F7F7',
keepAlive: true
}
},
{ name: 'mass' }
],
attractCustomer: [
{
name: 'index',
meta: {
title: '渠道活码',
backgroundColor: '#F7F7F7',
keepAlive: true
}
},
{
name: 'detail',
meta: {
title: '渠道活码',
keepAlive: true
}
}
],
customer: [
{
name: 'index',
meta: {
title: '查看客户详情',
backgroundColor: '#F7F7F7'
}
},
{
name: 'information',
meta: {
title: '完善信息',
backgroundColor: '#F7F7F7'
}
},
{
name: 'detail',
meta: {
title: '客户跟进',
backgroundColor: '#F7F7F7'
// keepAlive: true,
}
},
{
name: 'groupDetail',
meta: {
title: '客户跟进',
backgroundColor: '#F7F7F7',
keepAlive: true
}
},
{
name: 'editDetail',
meta: {
backgroundColor: '#F7F7F7',
keepAlive: true
}
},
{
name: 'editPlat',
meta: {
backgroundColor: '#F7F7F7',
keepAlive: true
}
},
{
name: 'record',
meta: {
title: '客户记录',
backgroundColor: '#F7F7F7'
}
}
],
tag: [
{
name: 'index',
meta: {
title: '批量打标签',
backgroundColor: '#F7F7F7'
}
}
],
friends: [
{
name: 'index',
meta: {
title: '发布朋友圈任务',
backgroundColor: '#F7F7F7'
}
}
],
proxy: [
{
name: 'index',
meta: {
title: '名片访问记录',
backgroundColor: '#F7F7F7'
}
}
],
customerDetails: [
{
name: 'index',
meta: {
title: '查看客户详情',
backgroundColor: '#F7F7F7'
}
},
{
name: 'detail',
meta: {
title: '查看客户详情',
backgroundColor: '#F7F7F7'
}
}
],
solicit: [
{
name: 'index',
meta: {
title: '查看客户详情',
backgroundColor: '#F7F7F7'
}
},
{
name: 'customer',
meta: {
title: '查看客户详情',
backgroundColor: '#F7F7F7'
}
},
{
name: 'marketing',
meta: {
title: '一键营销',
backgroundColor: '#F7F7F7'
}
},
{
name: 'succeed',
meta: {
title: '招揽跟进',
backgroundColor: '#F7F7F7'
}
},
{
name: 'statistic',
meta: {
title: '触达统计',
backgroundColor: '#F7F7F7'
}
},
{
name: 'lookCustomer',
meta: {
title: '查看客户',
backgroundColor: '#F7F7F7'
}
}
],
other:[
{
name: 'index',
meta: {
title: '自定义',
backgroundColor: '#F7F7F7'
}
}
]
}
const redirect = ''
let routes = []
const keepAlives = []
console.log(Object.keys(pages))
Object.keys(pages).map(parent => {
pages[parent].map(val => {
const isIndex = parent == redirect && val.name == 'index'
let childrenPath = `${parent}/${val.name}`
let { meta } = val
const path = isIndex ? '/' : `/${val.name == 'index' ? parent : childrenPath}`
const name = val.name == 'index' ? parent : childrenPath.replace('/', '.')
if (meta && meta.keepAlive) keepAlives.push(name)
let route = {
component: resolve => require([`views/${childrenPath}.vue`], resolve),
path,
name,
meta
}
routes.push(route)
})
})
export const keeps = keepAlives
export default routes