Commit 96898eae45b2a2e764b9a99f3c12ad028daf2fff
1 parent
a6e4339288
Exists in
master
auto commit the code by alias command
Showing
5 changed files
with
149 additions
and
215 deletions
Show diff stats
src/router/index.js
... | ... | @@ -9,12 +9,13 @@ import Layout from '@/layout' |
9 | 9 | /* Router Modules */ |
10 | 10 | // import componentsRouter from './modules/components' |
11 | 11 | // import chartsRouter from './modules/charts' |
12 | -import tableRouter from './modules/table' | |
12 | +// import tableRouter from './modules/table' | |
13 | 13 | // import nestedRouter from './modules/nested' |
14 | 14 | import userRouter from './modules/user' |
15 | 15 | import systemRouter from './modules/system' |
16 | 16 | import prodRouter from './modules/prod' |
17 | 17 | import metaRouter from './modules/meta' |
18 | +import sitesRouter from './modules/sites' | |
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Note: sub-menu only appear when route children.length >= 1 |
... | ... | @@ -42,81 +43,82 @@ import metaRouter from './modules/meta' |
42 | 43 | * a base page that does not have permission requirements |
43 | 44 | * all roles can be accessed |
44 | 45 | */ |
45 | -export const constantRoutes = [ | |
46 | - { | |
47 | - path: '/redirect', | |
48 | - component: Layout, | |
49 | - hidden: true, | |
50 | - children: [ | |
51 | - { | |
52 | - path: '/redirect/:path*', | |
53 | - component: () => import('@/views/redirect/index') | |
54 | - } | |
55 | - ] | |
56 | - }, | |
57 | - { | |
58 | - path: '/login', | |
59 | - component: () => import('@/views/login/index'), | |
60 | - hidden: true | |
61 | - }, | |
62 | - { | |
63 | - path: '/auth-redirect', | |
64 | - component: () => import('@/views/login/auth-redirect'), | |
65 | - hidden: true | |
66 | - }, | |
67 | - { | |
68 | - path: '/404', | |
69 | - component: () => import('@/views/error-page/404'), | |
70 | - hidden: true | |
71 | - }, | |
72 | - { | |
73 | - path: '/500', | |
74 | - component: () => import('@/views/error-page/500'), | |
75 | - hidden: true | |
76 | - }, | |
77 | - { | |
78 | - path: '/401', | |
79 | - component: () => import('@/views/error-page/401'), | |
80 | - hidden: true | |
81 | - }, | |
82 | - { | |
83 | - path: '/', | |
84 | - component: Layout, | |
85 | - redirect: '/dashboard', | |
86 | - children: [ | |
87 | - { | |
88 | - path: 'dashboard', | |
89 | - component: () => import('@/views/dashboard/index'), | |
90 | - name: 'Dashboard', | |
91 | - meta: { title: 'dashboard', icon: 'dashboard', affix: true } | |
92 | - } | |
93 | - ] | |
94 | - }, | |
95 | - // { | |
96 | - // path: '/documentation', | |
97 | - // component: Layout, | |
98 | - // children: [ | |
99 | - // { | |
100 | - // path: 'index', | |
101 | - // component: () => import('@/views/documentation/index'), | |
102 | - // name: 'Documentation', | |
103 | - // meta: { title: 'documentation', icon: 'documentation', affix: true } | |
104 | - // } | |
105 | - // ] | |
106 | - // }, | |
107 | - { | |
108 | - path: '/guide', | |
109 | - component: Layout, | |
110 | - redirect: '/guide/index', | |
111 | - children: [ | |
112 | - { | |
113 | - path: 'index', | |
114 | - component: () => import('@/views/guide/index'), | |
115 | - name: 'Guide', | |
116 | - meta: { title: 'guide', icon: 'guide', noCache: true } | |
117 | - } | |
118 | - ] | |
119 | - } | |
46 | +export const constantRoutes = [{ | |
47 | + path: '/redirect', | |
48 | + component: Layout, | |
49 | + hidden: true, | |
50 | + children: [{ | |
51 | + path: '/redirect/:path*', | |
52 | + component: () => import('@/views/redirect/index') | |
53 | + }] | |
54 | +}, | |
55 | +{ | |
56 | + path: '/login', | |
57 | + component: () => import('@/views/login/index'), | |
58 | + hidden: true | |
59 | +}, | |
60 | +{ | |
61 | + path: '/auth-redirect', | |
62 | + component: () => import('@/views/login/auth-redirect'), | |
63 | + hidden: true | |
64 | +}, | |
65 | +{ | |
66 | + path: '/404', | |
67 | + component: () => import('@/views/error-page/404'), | |
68 | + hidden: true | |
69 | +}, | |
70 | +{ | |
71 | + path: '/500', | |
72 | + component: () => import('@/views/error-page/500'), | |
73 | + hidden: true | |
74 | +}, | |
75 | +{ | |
76 | + path: '/401', | |
77 | + component: () => import('@/views/error-page/401'), | |
78 | + hidden: true | |
79 | +}, | |
80 | +{ | |
81 | + path: '/', | |
82 | + component: Layout, | |
83 | + redirect: '/dashboard', | |
84 | + children: [{ | |
85 | + path: 'dashboard', | |
86 | + component: () => import('@/views/dashboard/index'), | |
87 | + name: 'Dashboard', | |
88 | + meta: { | |
89 | + title: 'dashboard', | |
90 | + icon: 'dashboard', | |
91 | + affix: true | |
92 | + } | |
93 | + }] | |
94 | +}, | |
95 | +// { | |
96 | +// path: '/documentation', | |
97 | +// component: Layout, | |
98 | +// children: [ | |
99 | +// { | |
100 | +// path: 'index', | |
101 | +// component: () => import('@/views/documentation/index'), | |
102 | +// name: 'Documentation', | |
103 | +// meta: { title: 'documentation', icon: 'documentation', affix: true } | |
104 | +// } | |
105 | +// ] | |
106 | +// }, | |
107 | +{ | |
108 | + path: '/guide', | |
109 | + component: Layout, | |
110 | + redirect: '/guide/index', | |
111 | + children: [{ | |
112 | + path: 'index', | |
113 | + component: () => import('@/views/guide/index'), | |
114 | + name: 'Guide', | |
115 | + meta: { | |
116 | + title: 'guide', | |
117 | + icon: 'guide', | |
118 | + noCache: true | |
119 | + } | |
120 | + }] | |
121 | +} | |
120 | 122 | // { |
121 | 123 | // path: '/profile', |
122 | 124 | // component: Layout, |
... | ... | @@ -180,7 +182,7 @@ export const asyncRoutes = [ |
180 | 182 | // } |
181 | 183 | // ] |
182 | 184 | // }, |
183 | - tableRouter, | |
185 | + // tableRouter, | |
184 | 186 | metaRouter, |
185 | 187 | userRouter, |
186 | 188 | prodRouter, |
... | ... | @@ -195,61 +197,28 @@ export const asyncRoutes = [ |
195 | 197 | icon: 'shopping', |
196 | 198 | roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav |
197 | 199 | }, |
198 | - children: [ | |
199 | - { | |
200 | - path: 'page', | |
201 | - component: () => import('@/views/permission/page'), | |
202 | - name: 'OrderList', | |
203 | - meta: { | |
204 | - title: 'OrderList', | |
205 | - roles: ['admin', 'assistant', 'runner', 'shoper'] // or you can only set roles in sub nav | |
206 | - } | |
207 | - }, | |
208 | - { | |
209 | - path: 'defined', | |
210 | - component: () => import('@/views/permission/directive'), | |
211 | - name: 'OrderDefiend', | |
212 | - meta: { | |
213 | - title: 'OrderDefiend', | |
214 | - roles: ['admin', 'assistant', 'runner', 'shoper'] | |
215 | - // if do not set roles, means: this page does not require permission | |
216 | - } | |
200 | + children: [{ | |
201 | + path: 'page', | |
202 | + component: () => import('@/views/permission/page'), | |
203 | + name: 'OrderList', | |
204 | + meta: { | |
205 | + title: 'OrderList', | |
206 | + roles: ['admin', 'assistant', 'runner', 'shoper'] // or you can only set roles in sub nav | |
217 | 207 | } |
218 | - ] | |
219 | - }, | |
220 | - { | |
221 | - path: '/sites', | |
222 | - component: Layout, | |
223 | - redirect: '/site/page', | |
224 | - alwaysShow: true, // will always show the root menu | |
225 | - name: 'Site', | |
226 | - meta: { | |
227 | - title: 'sites', | |
228 | - icon: 'people', | |
229 | - roles: ['admin', 'assistant', 'runner'] // you can set roles in root nav | |
230 | 208 | }, |
231 | - children: [ | |
232 | - { | |
233 | - path: 'page', | |
234 | - component: () => import('@/views/permission/page'), | |
235 | - name: 'SiteList', | |
236 | - meta: { | |
237 | - title: 'SiteList', | |
238 | - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav | |
239 | - } | |
240 | - }, | |
241 | - { | |
242 | - path: 'defined', | |
243 | - component: () => import('@/views/permission/directive'), | |
244 | - name: 'SiteDefiend', | |
245 | - meta: { | |
246 | - title: 'SiteDefiend', | |
247 | - roles: ['admin', 'assistant', 'runner'] | |
248 | - // if do not set roles, means: this page does not require permission | |
249 | - } | |
209 | + { | |
210 | + path: 'defined', | |
211 | + component: () => import('@/views/permission/directive'), | |
212 | + name: 'OrderDefiend', | |
213 | + meta: { | |
214 | + title: 'OrderDefiend', | |
215 | + roles: ['admin', 'assistant', 'runner', 'shoper'] | |
216 | + // if do not set roles, means: this page does not require permission | |
250 | 217 | } |
218 | + } | |
251 | 219 | ] |
252 | 220 | }, |
221 | + sitesRouter, | |
253 | 222 | |
254 | 223 | // { |
255 | 224 | // path: '/icon', |
... | ... | @@ -477,12 +446,18 @@ export const asyncRoutes = [ |
477 | 446 | // }, |
478 | 447 | |
479 | 448 | // 404 page must be placed at the end !!! |
480 | - { path: '*', redirect: '/404', hidden: true } | |
449 | + { | |
450 | + path: '*', | |
451 | + redirect: '/404', | |
452 | + hidden: true | |
453 | + } | |
481 | 454 | ] |
482 | 455 | |
483 | 456 | const createRouter = () => new Router({ |
484 | 457 | // mode: 'history', // require service support |
485 | - scrollBehavior: () => ({ y: 0 }), | |
458 | + scrollBehavior: () => ({ | |
459 | + y: 0 | |
460 | + }), | |
486 | 461 | routes: constantRoutes |
487 | 462 | }) |
488 | 463 | ... | ... |
src/router/modules/system.js
... | ... | @@ -9,7 +9,7 @@ const systemRouter = { |
9 | 9 | meta: { |
10 | 10 | title: 'systems.systems', |
11 | 11 | icon: 'component', |
12 | - roles: ['admin', 'assistant', 'runner'] // you can set roles in root nav | |
12 | + roles: ['admin', 'assistant'] // you can set roles in root nav | |
13 | 13 | }, |
14 | 14 | children: [{ |
15 | 15 | path: 'page', |
... | ... | @@ -17,7 +17,7 @@ const systemRouter = { |
17 | 17 | name: 'SystemList', |
18 | 18 | meta: { |
19 | 19 | title: 'systems.sites', |
20 | - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav | |
20 | + roles: ['admin', 'assistant'] // or you can only set roles in sub nav | |
21 | 21 | } |
22 | 22 | }, |
23 | 23 | { |
... | ... | @@ -26,7 +26,7 @@ const systemRouter = { |
26 | 26 | name: 'SystemList', |
27 | 27 | meta: { |
28 | 28 | title: 'systems.money', |
29 | - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav | |
29 | + roles: ['admin', 'assistant'] // or you can only set roles in sub nav | |
30 | 30 | } |
31 | 31 | }, |
32 | 32 | { |
... | ... | @@ -35,7 +35,7 @@ const systemRouter = { |
35 | 35 | name: 'SystemList', |
36 | 36 | meta: { |
37 | 37 | title: 'systems.industry', |
38 | - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav | |
38 | + roles: ['admin', 'assistant'] // or you can only set roles in sub nav | |
39 | 39 | } |
40 | 40 | }, |
41 | 41 | { |
... | ... | @@ -44,7 +44,7 @@ const systemRouter = { |
44 | 44 | name: 'SystemList', |
45 | 45 | meta: { |
46 | 46 | title: 'systems.template', |
47 | - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav | |
47 | + roles: ['admin', 'assistant'] // or you can only set roles in sub nav | |
48 | 48 | } |
49 | 49 | } |
50 | 50 | ... | ... |
src/router/modules/user.js
... | ... | @@ -11,7 +11,7 @@ const chartsRouter = { |
11 | 11 | meta: { |
12 | 12 | title: 'users.people', |
13 | 13 | icon: 'peoples', |
14 | - roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav | |
14 | + roles: ['admin', 'assistant'] // you can set roles in root nav | |
15 | 15 | }, |
16 | 16 | children: [{ |
17 | 17 | path: 'assistant', |
... | ... | @@ -58,7 +58,7 @@ const chartsRouter = { |
58 | 58 | }, |
59 | 59 | meta: { |
60 | 60 | title: 'users.user', |
61 | - roles: ['admin', 'assistant', 'shoper', 'runner'] // or you can only set roles in sub nav | |
61 | + roles: ['admin', 'assistant'] // or you can only set roles in sub nav | |
62 | 62 | } |
63 | 63 | } |
64 | 64 | // ,{ | ... | ... |
src/views/dashboard/editor/index.vue
... | ... | @@ -1,72 +0,0 @@ |
1 | -<template> | |
2 | - <div class="dashboard-editor-container"> | |
3 | - <div class="clearfix"> | |
4 | - <pan-thumb :image="avatar" style="float: left"> | |
5 | - Your roles: | |
6 | - <span v-for="item in roles" :key="item" class="pan-info-roles">{{ item }}</span> | |
7 | - </pan-thumb> | |
8 | - <github-corner style="position: absolute; top: 0px; border: 0; right: 0;" /> | |
9 | - <div class="info-container"> | |
10 | - <span class="display_name">{{ name }}</span> | |
11 | - <span style="font-size:20px;padding-top:20px;display:inline-block;">{{ roles }}'s Dashboard</span> | |
12 | - </div> | |
13 | - </div> | |
14 | - <div> | |
15 | - <img :src="emptyGif" class="emptyGif"> | |
16 | - </div> | |
17 | - </div> | |
18 | -</template> | |
19 | - | |
20 | -<script> | |
21 | -import { mapGetters } from 'vuex' | |
22 | -import PanThumb from '@/components/PanThumb' | |
23 | -// import GithubCorner from '@/components/GithubCorner' | |
24 | - | |
25 | -export default { | |
26 | - name: 'DashboardEditor', | |
27 | - // components: { PanThumb, GithubCorner }, | |
28 | - components: { PanThumb }, | |
29 | - data() { | |
30 | - return { | |
31 | - emptyGif: | |
32 | - 'https://wpimg.wallstcn.com/0e03b7da-db9e-4819-ba10-9016ddfdaed3' | |
33 | - } | |
34 | - }, | |
35 | - computed: { | |
36 | - ...mapGetters(['name', 'avatar', 'roles']) | |
37 | - } | |
38 | -} | |
39 | -</script> | |
40 | - | |
41 | -<style lang="scss" scoped> | |
42 | -.emptyGif { | |
43 | - display: block; | |
44 | - width: 45%; | |
45 | - margin: 0 auto; | |
46 | -} | |
47 | - | |
48 | -.dashboard-editor-container { | |
49 | - background-color: #e3e3e3; | |
50 | - min-height: 100vh; | |
51 | - padding: 50px 60px 0px; | |
52 | - .pan-info-roles { | |
53 | - font-size: 12px; | |
54 | - font-weight: 700; | |
55 | - color: #333; | |
56 | - display: block; | |
57 | - } | |
58 | - .info-container { | |
59 | - position: relative; | |
60 | - margin-left: 190px; | |
61 | - height: 150px; | |
62 | - line-height: 200px; | |
63 | - .display_name { | |
64 | - font-size: 48px; | |
65 | - line-height: 48px; | |
66 | - color: #212121; | |
67 | - position: absolute; | |
68 | - top: 25px; | |
69 | - } | |
70 | - } | |
71 | -} | |
72 | -</style> |
src/views/dashboard/index.vue
... | ... | @@ -7,24 +7,55 @@ |
7 | 7 | <script> |
8 | 8 | import { mapGetters } from 'vuex' |
9 | 9 | import adminDashboard from './admin' |
10 | -import editorDashboard from './editor' | |
10 | +import runnerDashboard from './runner' | |
11 | 11 | |
12 | 12 | export default { |
13 | 13 | name: 'Dashboard', |
14 | - components: { adminDashboard, editorDashboard }, | |
14 | + components: { adminDashboard, runnerDashboard }, | |
15 | 15 | data() { |
16 | 16 | return { |
17 | 17 | currentRole: 'adminDashboard' |
18 | 18 | } |
19 | 19 | }, |
20 | 20 | computed: { |
21 | - ...mapGetters([ | |
22 | - 'roles' | |
23 | - ]) | |
21 | + ...mapGetters(['roles']) | |
24 | 22 | }, |
25 | 23 | created() { |
26 | - if (!this.roles.includes('admin')) { | |
27 | - this.currentRole = 'editorDashboard' | |
24 | + if (this.roles.includes('admin')) { | |
25 | + this.$notify({ | |
26 | + title: '----admin---', | |
27 | + message: 'adminadminadminadmin', | |
28 | + type: 'success', | |
29 | + duration: 2000 | |
30 | + }) | |
31 | + this.currentRole = 'adminDashboard' | |
32 | + } | |
33 | + if (this.roles.includes('assistant')) { | |
34 | + this.$notify({ | |
35 | + title: '----assistant---', | |
36 | + message: 'assistantassistantassistantassistant', | |
37 | + type: 'success', | |
38 | + duration: 2000 | |
39 | + }) | |
40 | + this.currentRole = 'adminDashboard' | |
41 | + } | |
42 | + if (this.roles.includes('runner')) { | |
43 | + this.$notify({ | |
44 | + title: '----runner---', | |
45 | + message: 'runnerrunnerrunnerrunner', | |
46 | + type: 'success', | |
47 | + duration: 2000 | |
48 | + }) | |
49 | + this.currentRole = 'runnerDashboard' | |
50 | + } | |
51 | + if (this.roles.includes('shoper')) { | |
52 | + this.$notify({ | |
53 | + title: '----shoper---', | |
54 | + message: 'shopershopershopershoper', | |
55 | + type: 'success', | |
56 | + duration: 2000 | |
57 | + }) | |
58 | + this.currentRole = 'runnerDashboard' | |
28 | 59 | } |
29 | 60 | } |
30 | 61 | } | ... | ... |