|
@@ -1,91 +1,116 @@
|
1
|
1
|
|
2
|
|
-const routes = [
|
|
2
|
+// 客户页面
|
|
3
|
+const mainPages = [
|
3
|
4
|
{
|
4
|
5
|
title: '首页',
|
5
|
|
- roles: ['person'],
|
6
|
6
|
page: 'pages/index/index',
|
|
7
|
+ isIndex: true,
|
7
|
8
|
},
|
8
|
9
|
{
|
9
|
10
|
title: '搜索',
|
10
|
|
- roles: ['person'],
|
11
|
11
|
page: 'pages/search/search',
|
12
|
12
|
},
|
13
|
13
|
{
|
14
|
14
|
title: '搜索结果',
|
15
|
|
- roles: ['person'],
|
16
|
15
|
page: 'pages/searchResult/searchResult',
|
17
|
16
|
},
|
18
|
17
|
{
|
19
|
18
|
title: '商铺详情',
|
20
|
|
- roles: ['person'],
|
21
|
19
|
page: 'pages/details/foodDetails/foodDetails',
|
22
|
20
|
},
|
23
|
21
|
{
|
24
|
22
|
title: '景点详情',
|
25
|
|
- roles: ['person'],
|
26
|
23
|
page: 'pages/details/mjDetails/sceneryDetails',
|
27
|
24
|
},
|
28
|
|
- {
|
29
|
|
- title: '民宿管理',
|
30
|
|
- roles: ['hotel'],
|
31
|
|
- page: 'pages/landlord/landlord',
|
32
|
|
- },
|
33
|
|
- {
|
34
|
|
- title: '商铺管理',
|
35
|
|
- roles: ['shop'],
|
36
|
|
- page: 'pages/spread/spreadIndex',
|
37
|
|
- },
|
38
|
25
|
{
|
39
|
26
|
title: '订单',
|
40
|
|
- roles: ['person'],
|
41
|
27
|
page: 'pages/PayOrder/index',
|
42
|
28
|
},
|
43
|
29
|
{
|
44
|
30
|
title: '联系我们',
|
45
|
|
- roles: ['person'],
|
46
|
31
|
page: 'pages/MineUserAll/ContactMe/index',
|
47
|
32
|
},
|
48
|
33
|
{
|
49
|
34
|
title: '我的收藏',
|
50
|
|
- roles: ['person'],
|
51
|
35
|
page: 'pages/MineUserAll/Collect/index',
|
52
|
36
|
},
|
53
|
37
|
{
|
54
|
38
|
title: '协议声明',
|
55
|
|
- roles: ['person'],
|
56
|
39
|
page: 'pages/MineUserAll/Rules/index',
|
57
|
40
|
},
|
58
|
41
|
{
|
59
|
42
|
title: '退款申请',
|
60
|
|
- roles: ['person'],
|
61
|
43
|
page: 'pages/MineUserAll/RefundMoney/index',
|
62
|
44
|
},
|
63
|
45
|
{
|
64
|
46
|
title: '确认退款',
|
65
|
|
- roles: ['person'],
|
66
|
47
|
page: 'pages/MineUserAll/RefundMoney/CheckRefund/index',
|
67
|
48
|
},
|
68
|
49
|
{
|
69
|
50
|
title: '我的订单',
|
70
|
|
- roles: ['person'],
|
71
|
51
|
page: 'pages/MineUserAll/AllOrder/index',
|
72
|
52
|
},
|
73
|
53
|
{
|
74
|
54
|
title: '套餐核销',
|
75
|
|
- roles: ['person'],
|
76
|
55
|
page: 'pages/TobeShop/index',
|
77
|
56
|
},
|
78
|
57
|
];
|
79
|
58
|
|
80
|
|
-const pages = routes.map(x => x.page);
|
|
59
|
+// 商户管理页面
|
|
60
|
+const shopPages = [
|
|
61
|
+ {
|
|
62
|
+ title: '商铺管理',
|
|
63
|
+ page: 'pages/spread/spreadIndex',
|
|
64
|
+ isIndex: true,
|
|
65
|
+ },
|
|
66
|
+];
|
|
67
|
+
|
|
68
|
+// 民宿管理页面
|
|
69
|
+const hotelPages = [
|
|
70
|
+ {
|
|
71
|
+ title: '民宿管理',
|
|
72
|
+ page: 'pages/landlord/landlord',
|
|
73
|
+ isIndex: true,
|
|
74
|
+ },
|
|
75
|
+];
|
|
76
|
+
|
|
77
|
+// 所有的页面
|
|
78
|
+const routes = mainPages.concat(shopPages.map(x => ({...x, root: 'shop'})))
|
|
79
|
+ .concat(hotelPages.map(x => ({...x, root: 'hotel'})))
|
|
80
|
+
|
|
81
|
+// 主包
|
|
82
|
+const pages = mainPages.map(x => x.page);
|
|
83
|
+
|
|
84
|
+// 分包
|
|
85
|
+const subPages = routes.reduce((acc, route) => {
|
|
86
|
+ if (!route.root) return acc;
|
|
87
|
+
|
|
88
|
+ const pgs = acc[route.root] || []
|
|
89
|
+
|
|
90
|
+ return {
|
|
91
|
+ ...acc,
|
|
92
|
+ [route.root]: pgs.concat(route.page)
|
|
93
|
+ }
|
|
94
|
+}, {})
|
|
95
|
+
|
|
96
|
+const subPackages = Object.keys(subPages).map((key) => {
|
|
97
|
+ return {
|
|
98
|
+ root: key,
|
|
99
|
+ pages: subPages[key]
|
|
100
|
+ }
|
|
101
|
+})
|
|
102
|
+
|
|
103
|
+function getPages(role) {
|
|
104
|
+ if (role === person) {
|
|
105
|
+ return routes.filter(x => !x.root)
|
|
106
|
+ }
|
81
|
107
|
|
82
|
|
-function getPage(role) {
|
83
|
|
- return routes.filter(x => x.roles.includes(role))
|
84
|
|
- .map(x => x.page);
|
|
108
|
+ return routes.filter(x => x.roo === role)
|
85
|
109
|
}
|
86
|
110
|
|
87
|
111
|
module.exports = {
|
88
|
112
|
routes,
|
89
|
113
|
pages,
|
90
|
|
- getPage
|
|
114
|
+ subPackages,
|
|
115
|
+ getPages
|
91
|
116
|
}
|