Showing
2 changed files
with
230 additions
and
18 deletions
config/menus.js
0 → 100644
1 | +const normalMenus = [ | ||
2 | + { | ||
3 | + title: 'Dashboard', | ||
4 | + link: '/', | ||
5 | + icon: 'ios-home', | ||
6 | + isClassic: true | ||
7 | + }, | ||
8 | + { | ||
9 | + title: '缓存管理', | ||
10 | + icon: 'document-text', | ||
11 | + subMenus: [{ | ||
12 | + title: 'PageCahe清理', | ||
13 | + link: '/page_cache/query', | ||
14 | + isClassic: true | ||
15 | + }, { | ||
16 | + title: 'CDN清理', | ||
17 | + link: '/cdn_cache/query', | ||
18 | + isClassic: true | ||
19 | + }, { | ||
20 | + title: '商品清理', | ||
21 | + link: '/product_cache/query', | ||
22 | + isClassic: true | ||
23 | + }, { | ||
24 | + title: 'Memcached', | ||
25 | + link: '/api_cache', | ||
26 | + isClassic: true | ||
27 | + }] | ||
28 | + }, | ||
29 | + { | ||
30 | + title: '降级配置', | ||
31 | + icon: 'document-text', | ||
32 | + link: '/degrade', | ||
33 | + isClassic: true | ||
34 | + }, | ||
35 | + { | ||
36 | + title: '滥用防护', | ||
37 | + icon: 'document-text', | ||
38 | + subMenus: [{ | ||
39 | + title: 'IP黑名单', | ||
40 | + link: '/crawler_black/ip', | ||
41 | + isClassic: true | ||
42 | + }, { | ||
43 | + title: 'IP白名单', | ||
44 | + link: '/crawler_white/ip', | ||
45 | + isClassic: true | ||
46 | + }, { | ||
47 | + title: 'UA黑名单', | ||
48 | + link: '/crawler_black/ua', | ||
49 | + isClassic: true | ||
50 | + }, { | ||
51 | + title: 'UA白名单', | ||
52 | + link: '/crawler_white/ua', | ||
53 | + isClassic: true | ||
54 | + }, { | ||
55 | + title: '风险控制', | ||
56 | + link: '/risk_management/risk_management', | ||
57 | + isClassic: true | ||
58 | + }] | ||
59 | + }, | ||
60 | + { | ||
61 | + title: '静态资源', | ||
62 | + icon: 'document-text', | ||
63 | + subMenus: [{ | ||
64 | + title: '活动上传', | ||
65 | + link: '/files/page', | ||
66 | + isClassic: true | ||
67 | + }, { | ||
68 | + title: '单文件上传', | ||
69 | + link: '/files/single-file', | ||
70 | + isClassic: true | ||
71 | + }] | ||
72 | + }, | ||
73 | + { | ||
74 | + title: 'SEO管理', | ||
75 | + icon: 'document-text', | ||
76 | + subMenus: [{ | ||
77 | + title: '词根管理', | ||
78 | + link: '/seo/rootwords', | ||
79 | + isClassic: true | ||
80 | + }, { | ||
81 | + title: '关键词管理', | ||
82 | + link: '/keywords/expand', | ||
83 | + isClassic: true | ||
84 | + }, { | ||
85 | + title: 'TDK管理', | ||
86 | + link: '/seo/tdk', | ||
87 | + isClassic: true | ||
88 | + }, { | ||
89 | + title: '品类描述管理', | ||
90 | + link: '/seo/category', | ||
91 | + isClassic: true | ||
92 | + }, { | ||
93 | + title: '友链管理', | ||
94 | + link: '/seo/friendlink', | ||
95 | + isClassic: true | ||
96 | + }, { | ||
97 | + title: '定时任务管理', | ||
98 | + link: '/seo/task', | ||
99 | + isClassic: true | ||
100 | + }] | ||
101 | + }, | ||
102 | + { | ||
103 | + title: '性能统计', | ||
104 | + icon: 'document-text', | ||
105 | + subMenus: [{ | ||
106 | + title: '浏览器排行榜', | ||
107 | + link: '/profile/sort_client', | ||
108 | + isClassic: true | ||
109 | + }, { | ||
110 | + title: '服务器路由排行榜', | ||
111 | + link: '/profile/sort_route', | ||
112 | + isClassic: true | ||
113 | + }, { | ||
114 | + title: 'api排行榜', | ||
115 | + link: '/profile/sort_api', | ||
116 | + isClassic: true | ||
117 | + }, { | ||
118 | + title: '错误信息统计', | ||
119 | + link: '/profile/error', | ||
120 | + isClassic: true | ||
121 | + }] | ||
122 | + }, | ||
123 | + { | ||
124 | + title: '日志查询', | ||
125 | + icon: 'document-text', | ||
126 | + subMenus: [{ | ||
127 | + title: 'Node 日志', | ||
128 | + link: '/logs/node' | ||
129 | + }] | ||
130 | + } | ||
131 | +] | ||
132 | + | ||
133 | +const masterMenus = [ | ||
134 | + { | ||
135 | + title: '系统管理', | ||
136 | + icon: 'document-text', | ||
137 | + subMenus: [{ | ||
138 | + title: '服务器配置', | ||
139 | + link: '/servers/setting', | ||
140 | + isClassic: true | ||
141 | + }, { | ||
142 | + title: '用户管理', | ||
143 | + link: '/users/setting', | ||
144 | + isClassic: true | ||
145 | + }, { | ||
146 | + title: '操作记录', | ||
147 | + link: '/operation/log', | ||
148 | + isClassic: true | ||
149 | + }] | ||
150 | + } | ||
151 | +] | ||
152 | + | ||
153 | +const businessMenus = [ | ||
154 | + { | ||
155 | + title: 'Dashboard', | ||
156 | + link: '/', | ||
157 | + icon: 'ios-home', | ||
158 | + isClassic: true | ||
159 | + }, | ||
160 | + { | ||
161 | + title: 'CDN清理', | ||
162 | + link: '/cdn_cache/query', | ||
163 | + icon: 'ios-home', | ||
164 | + isClassic: true | ||
165 | + }, | ||
166 | + { | ||
167 | + title: '活动上传', | ||
168 | + link: '/files/page', | ||
169 | + icon: 'ios-home', | ||
170 | + isClassic: true | ||
171 | + } | ||
172 | +] | ||
173 | + | ||
174 | +module.exports = { | ||
175 | + normalMenus, | ||
176 | + masterMenus, | ||
177 | + businessMenus | ||
178 | +} |
1 | <template> | 1 | <template> |
2 | - <Menu class="sidebar-menu" active-name="1-2" theme="light" width="auto" :open-names="['1']"> | ||
3 | - <MenuItem name="1"> | ||
4 | - <a href="/"> | ||
5 | - <Icon type="ios-home"></Icon> | ||
6 | - Dashboard | ||
7 | - </a> | ||
8 | - </MenuItem> | ||
9 | - <Submenu name="2"> | ||
10 | - <template slot="title"> | ||
11 | - <Icon type="document-text"></Icon> | ||
12 | - 日志查询 | ||
13 | - </template> | ||
14 | - | ||
15 | - <MenuItem name="2-1"> | ||
16 | - <router-link to="/logs/node"> | ||
17 | - Node 日志 | 2 | + <Menu class="sidebar-menu" theme="light" width="auto"> |
3 | + <template v-for="(menu, index) in menus"> | ||
4 | + <Submenu v-if="menu.subMenus" :name="index"> | ||
5 | + <template slot="title"> | ||
6 | + <Icon :type="menu.icon"></Icon> | ||
7 | + {{menu.title}} | ||
8 | + </template> | ||
9 | + <template v-for="(subMenu, subIndex) in menu.subMenus"> | ||
10 | + <MenuItem :name="`${index}-${subIndex}`"> | ||
11 | + <a v-if="subMenu.isClassic" :href="subMenu.link"> | ||
12 | + <Icon :type="subMenu.icon"></Icon> | ||
13 | + {{subMenu.title}} | ||
14 | + </a> | ||
15 | + <router-link v-else :to="subMenu.link"> | ||
16 | + {{subMenu.title}} | ||
17 | + </router-link> | ||
18 | + </MenuItem> | ||
19 | + </template> | ||
20 | + </Submenu> | ||
21 | + <MenuItem v-else :name="index"> | ||
22 | + <a v-if="menu.isClassic" :href="menu.link"> | ||
23 | + <Icon :type="menu.icon"></Icon> | ||
24 | + {{menu.title}} | ||
25 | + </a> | ||
26 | + <router-link v-else :to="menu.link"> | ||
27 | + <Icon :type="menu.icon"></Icon> | ||
28 | + {{menu.title}} | ||
18 | </router-link> | 29 | </router-link> |
19 | </MenuItem> | 30 | </MenuItem> |
20 | - </Submenu> | 31 | + </template> |
21 | </Menu> | 32 | </Menu> |
22 | </template> | 33 | </template> |
23 | 34 | ||
24 | <script> | 35 | <script> |
36 | +import { | ||
37 | + normalMenus, | ||
38 | + masterMenus, | ||
39 | + businessMenus | ||
40 | +} from '../../../../config/menus' // 考虑与原有业务复用 | ||
41 | + | ||
25 | export default { | 42 | export default { |
26 | - props: ['user'] | 43 | + props: ['user'], |
44 | + computed: { | ||
45 | + isMaster: function() { | ||
46 | + return this.user.role === '1000' | ||
47 | + }, | ||
48 | + isBusiness: function() { | ||
49 | + return this.user.role === '3000' | ||
50 | + }, | ||
51 | + menus: function() { | ||
52 | + if (this.isBusiness) { | ||
53 | + return businessMenus | ||
54 | + } | ||
55 | + if (this.isMaster) { | ||
56 | + return [...normalMenus, ...masterMenus] | ||
57 | + } | ||
58 | + return normalMenus | ||
59 | + } | ||
60 | + } | ||
27 | } | 61 | } |
28 | </script> | 62 | </script> |
29 | 63 |
-
Please register or login to post a comment