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
| 1 | import Vue from 'vue' | 1 | import Vue from 'vue' |
| 2 | import Router from 'vue-router' | 2 | import Router from 'vue-router' |
| 3 | 3 | ||
| 4 | Vue.use(Router) | 4 | Vue.use(Router) |
| 5 | 5 | ||
| 6 | /* Layout */ | 6 | /* Layout */ |
| 7 | import Layout from '@/layout' | 7 | import Layout from '@/layout' |
| 8 | 8 | ||
| 9 | /* Router Modules */ | 9 | /* Router Modules */ |
| 10 | // import componentsRouter from './modules/components' | 10 | // import componentsRouter from './modules/components' |
| 11 | // import chartsRouter from './modules/charts' | 11 | // import chartsRouter from './modules/charts' |
| 12 | import tableRouter from './modules/table' | 12 | // import tableRouter from './modules/table' |
| 13 | // import nestedRouter from './modules/nested' | 13 | // import nestedRouter from './modules/nested' |
| 14 | import userRouter from './modules/user' | 14 | import userRouter from './modules/user' |
| 15 | import systemRouter from './modules/system' | 15 | import systemRouter from './modules/system' |
| 16 | import prodRouter from './modules/prod' | 16 | import prodRouter from './modules/prod' |
| 17 | import metaRouter from './modules/meta' | 17 | import metaRouter from './modules/meta' |
| 18 | import sitesRouter from './modules/sites' | ||
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| 20 | * Note: sub-menu only appear when route children.length >= 1 | 21 | * Note: sub-menu only appear when route children.length >= 1 |
| 21 | * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html | 22 | * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html |
| 22 | * | 23 | * |
| 23 | * hidden: true if set true, item will not show in the sidebar(default is false) | 24 | * hidden: true if set true, item will not show in the sidebar(default is false) |
| 24 | * alwaysShow: true if set true, will always show the root menu | 25 | * alwaysShow: true if set true, will always show the root menu |
| 25 | * if not set alwaysShow, when item has more than one children route, | 26 | * if not set alwaysShow, when item has more than one children route, |
| 26 | * it will becomes nested mode, otherwise not show the root menu | 27 | * it will becomes nested mode, otherwise not show the root menu |
| 27 | * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb | 28 | * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb |
| 28 | * name:'router-name' the name is used by <keep-alive> (must set!!!) | 29 | * name:'router-name' the name is used by <keep-alive> (must set!!!) |
| 29 | * meta : { | 30 | * meta : { |
| 30 | roles: ['admin','assistant','runner', 'shoper'] control the page roles (you can set multiple roles) | 31 | roles: ['admin','assistant','runner', 'shoper'] control the page roles (you can set multiple roles) |
| 31 | title: 'title' the name show in sidebar and breadcrumb (recommend set) | 32 | title: 'title' the name show in sidebar and breadcrumb (recommend set) |
| 32 | icon: 'svg-name' the icon show in the sidebar | 33 | icon: 'svg-name' the icon show in the sidebar |
| 33 | noCache: true if set true, the page will no be cached(default is false) | 34 | noCache: true if set true, the page will no be cached(default is false) |
| 34 | affix: true if set true, the tag will affix in the tags-view | 35 | affix: true if set true, the tag will affix in the tags-view |
| 35 | breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) | 36 | breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) |
| 36 | activeMenu: '/example/list' if set path, the sidebar will highlight the path you set | 37 | activeMenu: '/example/list' if set path, the sidebar will highlight the path you set |
| 37 | } | 38 | } |
| 38 | */ | 39 | */ |
| 39 | 40 | ||
| 40 | /** | 41 | /** |
| 41 | * constantRoutes | 42 | * constantRoutes |
| 42 | * a base page that does not have permission requirements | 43 | * a base page that does not have permission requirements |
| 43 | * all roles can be accessed | 44 | * all roles can be accessed |
| 44 | */ | 45 | */ |
| 45 | export const constantRoutes = [ | 46 | export const constantRoutes = [{ |
| 46 | { | 47 | path: '/redirect', |
| 47 | path: '/redirect', | 48 | component: Layout, |
| 48 | component: Layout, | 49 | hidden: true, |
| 49 | hidden: true, | 50 | children: [{ |
| 50 | children: [ | 51 | path: '/redirect/:path*', |
| 51 | { | 52 | component: () => import('@/views/redirect/index') |
| 52 | path: '/redirect/:path*', | 53 | }] |
| 53 | component: () => import('@/views/redirect/index') | 54 | }, |
| 54 | } | 55 | { |
| 55 | ] | 56 | path: '/login', |
| 56 | }, | 57 | component: () => import('@/views/login/index'), |
| 57 | { | 58 | hidden: true |
| 58 | path: '/login', | 59 | }, |
| 59 | component: () => import('@/views/login/index'), | 60 | { |
| 60 | hidden: true | 61 | path: '/auth-redirect', |
| 61 | }, | 62 | component: () => import('@/views/login/auth-redirect'), |
| 62 | { | 63 | hidden: true |
| 63 | path: '/auth-redirect', | 64 | }, |
| 64 | component: () => import('@/views/login/auth-redirect'), | 65 | { |
| 65 | hidden: true | 66 | path: '/404', |
| 66 | }, | 67 | component: () => import('@/views/error-page/404'), |
| 67 | { | 68 | hidden: true |
| 68 | path: '/404', | 69 | }, |
| 69 | component: () => import('@/views/error-page/404'), | 70 | { |
| 70 | hidden: true | 71 | path: '/500', |
| 71 | }, | 72 | component: () => import('@/views/error-page/500'), |
| 72 | { | 73 | hidden: true |
| 73 | path: '/500', | 74 | }, |
| 74 | component: () => import('@/views/error-page/500'), | 75 | { |
| 75 | hidden: true | 76 | path: '/401', |
| 76 | }, | 77 | component: () => import('@/views/error-page/401'), |
| 77 | { | 78 | hidden: true |
| 78 | path: '/401', | 79 | }, |
| 79 | component: () => import('@/views/error-page/401'), | 80 | { |
| 80 | hidden: true | 81 | path: '/', |
| 81 | }, | 82 | component: Layout, |
| 82 | { | 83 | redirect: '/dashboard', |
| 83 | path: '/', | 84 | children: [{ |
| 84 | component: Layout, | 85 | path: 'dashboard', |
| 85 | redirect: '/dashboard', | 86 | component: () => import('@/views/dashboard/index'), |
| 86 | children: [ | 87 | name: 'Dashboard', |
| 87 | { | 88 | meta: { |
| 88 | path: 'dashboard', | 89 | title: 'dashboard', |
| 89 | component: () => import('@/views/dashboard/index'), | 90 | icon: 'dashboard', |
| 90 | name: 'Dashboard', | 91 | affix: true |
| 91 | meta: { title: 'dashboard', icon: 'dashboard', affix: true } | 92 | } |
| 92 | } | 93 | }] |
| 93 | ] | 94 | }, |
| 94 | }, | 95 | // { |
| 95 | // { | 96 | // path: '/documentation', |
| 96 | // path: '/documentation', | 97 | // component: Layout, |
| 97 | // component: Layout, | 98 | // children: [ |
| 98 | // children: [ | 99 | // { |
| 99 | // { | 100 | // path: 'index', |
| 100 | // path: 'index', | 101 | // component: () => import('@/views/documentation/index'), |
| 101 | // component: () => import('@/views/documentation/index'), | 102 | // name: 'Documentation', |
| 102 | // name: 'Documentation', | 103 | // meta: { title: 'documentation', icon: 'documentation', affix: true } |
| 103 | // meta: { title: 'documentation', icon: 'documentation', affix: true } | 104 | // } |
| 104 | // } | 105 | // ] |
| 105 | // ] | 106 | // }, |
| 106 | // }, | 107 | { |
| 107 | { | 108 | path: '/guide', |
| 108 | path: '/guide', | 109 | component: Layout, |
| 109 | component: Layout, | 110 | redirect: '/guide/index', |
| 110 | redirect: '/guide/index', | 111 | children: [{ |
| 111 | children: [ | 112 | path: 'index', |
| 112 | { | 113 | component: () => import('@/views/guide/index'), |
| 113 | path: 'index', | 114 | name: 'Guide', |
| 114 | component: () => import('@/views/guide/index'), | 115 | meta: { |
| 115 | name: 'Guide', | 116 | title: 'guide', |
| 116 | meta: { title: 'guide', icon: 'guide', noCache: true } | 117 | icon: 'guide', |
| 117 | } | 118 | noCache: true |
| 118 | ] | 119 | } |
| 119 | } | 120 | }] |
| 121 | } | ||
| 120 | // { | 122 | // { |
| 121 | // path: '/profile', | 123 | // path: '/profile', |
| 122 | // component: Layout, | 124 | // component: Layout, |
| 123 | // redirect: '/profile/index', | 125 | // redirect: '/profile/index', |
| 124 | // hidden: true, | 126 | // hidden: true, |
| 125 | // children: [ | 127 | // children: [ |
| 126 | // { | 128 | // { |
| 127 | // path: 'index', | 129 | // path: 'index', |
| 128 | // component: () => import('@/views/profile/index'), | 130 | // component: () => import('@/views/profile/index'), |
| 129 | // name: 'Profile', | 131 | // name: 'Profile', |
| 130 | // meta: { title: 'profile', icon: 'user', noCache: true } | 132 | // meta: { title: 'profile', icon: 'user', noCache: true } |
| 131 | // } | 133 | // } |
| 132 | // ] | 134 | // ] |
| 133 | // } | 135 | // } |
| 134 | ] | 136 | ] |
| 135 | 137 | ||
| 136 | /** | 138 | /** |
| 137 | * asyncRoutes | 139 | * asyncRoutes |
| 138 | * the routes that need to be dynamically loaded based on user roles | 140 | * the routes that need to be dynamically loaded based on user roles |
| 139 | */ | 141 | */ |
| 140 | export const asyncRoutes = [ | 142 | export const asyncRoutes = [ |
| 141 | // { | 143 | // { |
| 142 | // path: '/permission', | 144 | // path: '/permission', |
| 143 | // component: Layout, | 145 | // component: Layout, |
| 144 | // redirect: '/permission/page', | 146 | // redirect: '/permission/page', |
| 145 | // alwaysShow: true, // will always show the root menu | 147 | // alwaysShow: true, // will always show the root menu |
| 146 | // name: 'Permission', | 148 | // name: 'Permission', |
| 147 | // meta: { | 149 | // meta: { |
| 148 | // title: 'permission', | 150 | // title: 'permission', |
| 149 | // icon: 'lock', | 151 | // icon: 'lock', |
| 150 | // roles: ['admin', 'assistant'] // you can set roles in root nav | 152 | // roles: ['admin', 'assistant'] // you can set roles in root nav |
| 151 | // }, | 153 | // }, |
| 152 | // children: [ | 154 | // children: [ |
| 153 | // { | 155 | // { |
| 154 | // path: 'page', | 156 | // path: 'page', |
| 155 | // component: () => import('@/views/permission/page'), | 157 | // component: () => import('@/views/permission/page'), |
| 156 | // name: 'PagePermission', | 158 | // name: 'PagePermission', |
| 157 | // meta: { | 159 | // meta: { |
| 158 | // title: 'pagePermission', | 160 | // title: 'pagePermission', |
| 159 | // roles: ['admin','assistant'] // or you can only set roles in sub nav | 161 | // roles: ['admin','assistant'] // or you can only set roles in sub nav |
| 160 | // } | 162 | // } |
| 161 | // }, | 163 | // }, |
| 162 | // { | 164 | // { |
| 163 | // path: 'directive', | 165 | // path: 'directive', |
| 164 | // component: () => import('@/views/permission/directive'), | 166 | // component: () => import('@/views/permission/directive'), |
| 165 | // name: 'DirectivePermission', | 167 | // name: 'DirectivePermission', |
| 166 | // meta: { | 168 | // meta: { |
| 167 | // title: 'directivePermission', | 169 | // title: 'directivePermission', |
| 168 | // roles: ['admin', 'shoper'] | 170 | // roles: ['admin', 'shoper'] |
| 169 | // // if do not set roles, means: this page does not require permission | 171 | // // if do not set roles, means: this page does not require permission |
| 170 | // } | 172 | // } |
| 171 | // }, | 173 | // }, |
| 172 | // { | 174 | // { |
| 173 | // path: 'role', | 175 | // path: 'role', |
| 174 | // component: () => import('@/views/permission/role'), | 176 | // component: () => import('@/views/permission/role'), |
| 175 | // name: 'RolePermission', | 177 | // name: 'RolePermission', |
| 176 | // meta: { | 178 | // meta: { |
| 177 | // title: 'rolePermission', | 179 | // title: 'rolePermission', |
| 178 | // roles: ['admin', 'runner'] | 180 | // roles: ['admin', 'runner'] |
| 179 | // } | 181 | // } |
| 180 | // } | 182 | // } |
| 181 | // ] | 183 | // ] |
| 182 | // }, | 184 | // }, |
| 183 | tableRouter, | 185 | // tableRouter, |
| 184 | metaRouter, | 186 | metaRouter, |
| 185 | userRouter, | 187 | userRouter, |
| 186 | prodRouter, | 188 | prodRouter, |
| 187 | { | 189 | { |
| 188 | path: '/orders', | 190 | path: '/orders', |
| 189 | component: Layout, | 191 | component: Layout, |
| 190 | redirect: '/order/page', | 192 | redirect: '/order/page', |
| 191 | alwaysShow: true, // will always show the root menu | 193 | alwaysShow: true, // will always show the root menu |
| 192 | name: 'Order', | 194 | name: 'Order', |
| 193 | meta: { | 195 | meta: { |
| 194 | title: 'orders', | 196 | title: 'orders', |
| 195 | icon: 'shopping', | 197 | icon: 'shopping', |
| 196 | roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav | 198 | roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav |
| 197 | }, | 199 | }, |
| 198 | children: [ | 200 | children: [{ |
| 199 | { | 201 | path: 'page', |
| 200 | path: 'page', | 202 | component: () => import('@/views/permission/page'), |
| 201 | component: () => import('@/views/permission/page'), | 203 | name: 'OrderList', |
| 202 | name: 'OrderList', | 204 | meta: { |
| 203 | meta: { | 205 | title: 'OrderList', |
| 204 | title: 'OrderList', | 206 | roles: ['admin', 'assistant', 'runner', 'shoper'] // or you can only set roles in sub nav |
| 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 | } | ||
| 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: [ | 209 | { |
| 232 | { | 210 | path: 'defined', |
| 233 | path: 'page', | 211 | component: () => import('@/views/permission/directive'), |
| 234 | component: () => import('@/views/permission/page'), | 212 | name: 'OrderDefiend', |
| 235 | name: 'SiteList', | 213 | meta: { |
| 236 | meta: { | 214 | title: 'OrderDefiend', |
| 237 | title: 'SiteList', | 215 | roles: ['admin', 'assistant', 'runner', 'shoper'] |
| 238 | roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav | 216 | // if do not set roles, means: this page does not require permission |
| 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 | } | ||
| 250 | } | 217 | } |
| 218 | } | ||
| 251 | ] | 219 | ] |
| 252 | }, | 220 | }, |
| 221 | sitesRouter, | ||
| 253 | 222 | ||
| 254 | // { | 223 | // { |
| 255 | // path: '/icon', | 224 | // path: '/icon', |
| 256 | // component: Layout, | 225 | // component: Layout, |
| 257 | // children: [ | 226 | // children: [ |
| 258 | // { | 227 | // { |
| 259 | // path: 'index', | 228 | // path: 'index', |
| 260 | // component: () => import('@/views/icons/index'), | 229 | // component: () => import('@/views/icons/index'), |
| 261 | // name: 'Icons', | 230 | // name: 'Icons', |
| 262 | // meta: { title: 'icons', icon: 'icon', noCache: true } | 231 | // meta: { title: 'icons', icon: 'icon', noCache: true } |
| 263 | // } | 232 | // } |
| 264 | // ] | 233 | // ] |
| 265 | // }, | 234 | // }, |
| 266 | systemRouter, | 235 | systemRouter, |
| 267 | /** when your routing map is too long, you can split it into small modules **/ | 236 | /** when your routing map is too long, you can split it into small modules **/ |
| 268 | // componentsRouter, | 237 | // componentsRouter, |
| 269 | // chartsRouter, | 238 | // chartsRouter, |
| 270 | // nestedRouter, | 239 | // nestedRouter, |
| 271 | // tableRouter, | 240 | // tableRouter, |
| 272 | 241 | ||
| 273 | // { | 242 | // { |
| 274 | // path: '/example', | 243 | // path: '/example', |
| 275 | // component: Layout, | 244 | // component: Layout, |
| 276 | // redirect: '/example/list', | 245 | // redirect: '/example/list', |
| 277 | // name: 'Example', | 246 | // name: 'Example', |
| 278 | // meta: { | 247 | // meta: { |
| 279 | // title: 'example', | 248 | // title: 'example', |
| 280 | // icon: 'example' | 249 | // icon: 'example' |
| 281 | // }, | 250 | // }, |
| 282 | // children: [ | 251 | // children: [ |
| 283 | // { | 252 | // { |
| 284 | // path: 'create', | 253 | // path: 'create', |
| 285 | // component: () => import('@/views/example/create'), | 254 | // component: () => import('@/views/example/create'), |
| 286 | // name: 'CreateArticle', | 255 | // name: 'CreateArticle', |
| 287 | // meta: { title: 'createArticle', icon: 'edit' } | 256 | // meta: { title: 'createArticle', icon: 'edit' } |
| 288 | // }, | 257 | // }, |
| 289 | // { | 258 | // { |
| 290 | // path: 'edit/:id(\\d+)', | 259 | // path: 'edit/:id(\\d+)', |
| 291 | // component: () => import('@/views/example/edit'), | 260 | // component: () => import('@/views/example/edit'), |
| 292 | // name: 'EditArticle', | 261 | // name: 'EditArticle', |
| 293 | // meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' }, | 262 | // meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' }, |
| 294 | // hidden: true | 263 | // hidden: true |
| 295 | // }, | 264 | // }, |
| 296 | // { | 265 | // { |
| 297 | // path: 'list', | 266 | // path: 'list', |
| 298 | // component: () => import('@/views/example/list'), | 267 | // component: () => import('@/views/example/list'), |
| 299 | // name: 'ArticleList', | 268 | // name: 'ArticleList', |
| 300 | // meta: { title: 'articleList', icon: 'list' } | 269 | // meta: { title: 'articleList', icon: 'list' } |
| 301 | // } | 270 | // } |
| 302 | // ] | 271 | // ] |
| 303 | // }, | 272 | // }, |
| 304 | 273 | ||
| 305 | // { | 274 | // { |
| 306 | // path: '/tab', | 275 | // path: '/tab', |
| 307 | // component: Layout, | 276 | // component: Layout, |
| 308 | // children: [ | 277 | // children: [ |
| 309 | // { | 278 | // { |
| 310 | // path: 'index', | 279 | // path: 'index', |
| 311 | // component: () => import('@/views/tab/index'), | 280 | // component: () => import('@/views/tab/index'), |
| 312 | // name: 'Tab', | 281 | // name: 'Tab', |
| 313 | // meta: { title: 'tab', icon: 'tab' } | 282 | // meta: { title: 'tab', icon: 'tab' } |
| 314 | // } | 283 | // } |
| 315 | // ] | 284 | // ] |
| 316 | // }, | 285 | // }, |
| 317 | 286 | ||
| 318 | // { | 287 | // { |
| 319 | // path: '/error', | 288 | // path: '/error', |
| 320 | // component: Layout, | 289 | // component: Layout, |
| 321 | // redirect: 'noRedirect', | 290 | // redirect: 'noRedirect', |
| 322 | // name: 'ErrorPages', | 291 | // name: 'ErrorPages', |
| 323 | // meta: { | 292 | // meta: { |
| 324 | // title: 'errorPages', | 293 | // title: 'errorPages', |
| 325 | // icon: '404' | 294 | // icon: '404' |
| 326 | // }, | 295 | // }, |
| 327 | // children: [ | 296 | // children: [ |
| 328 | // { | 297 | // { |
| 329 | // path: '401', | 298 | // path: '401', |
| 330 | // component: () => import('@/views/error-page/401'), | 299 | // component: () => import('@/views/error-page/401'), |
| 331 | // name: 'Page401', | 300 | // name: 'Page401', |
| 332 | // meta: { title: 'page401', noCache: true } | 301 | // meta: { title: 'page401', noCache: true } |
| 333 | // }, | 302 | // }, |
| 334 | // { | 303 | // { |
| 335 | // path: '404', | 304 | // path: '404', |
| 336 | // component: () => import('@/views/error-page/404'), | 305 | // component: () => import('@/views/error-page/404'), |
| 337 | // name: 'Page404', | 306 | // name: 'Page404', |
| 338 | // meta: { title: 'page404', noCache: true } | 307 | // meta: { title: 'page404', noCache: true } |
| 339 | // } | 308 | // } |
| 340 | // ] | 309 | // ] |
| 341 | // }, | 310 | // }, |
| 342 | 311 | ||
| 343 | // { | 312 | // { |
| 344 | // path: '/error-log', | 313 | // path: '/error-log', |
| 345 | // component: Layout, | 314 | // component: Layout, |
| 346 | // children: [ | 315 | // children: [ |
| 347 | // { | 316 | // { |
| 348 | // path: 'log', | 317 | // path: 'log', |
| 349 | // component: () => import('@/views/error-log/index'), | 318 | // component: () => import('@/views/error-log/index'), |
| 350 | // name: 'ErrorLog', | 319 | // name: 'ErrorLog', |
| 351 | // meta: { title: 'errorLog', icon: 'bug' } | 320 | // meta: { title: 'errorLog', icon: 'bug' } |
| 352 | // } | 321 | // } |
| 353 | // ] | 322 | // ] |
| 354 | // }, | 323 | // }, |
| 355 | 324 | ||
| 356 | // { | 325 | // { |
| 357 | // path: '/excel', | 326 | // path: '/excel', |
| 358 | // component: Layout, | 327 | // component: Layout, |
| 359 | // redirect: '/excel/export-excel', | 328 | // redirect: '/excel/export-excel', |
| 360 | // name: 'Excel', | 329 | // name: 'Excel', |
| 361 | // meta: { | 330 | // meta: { |
| 362 | // title: 'excel', | 331 | // title: 'excel', |
| 363 | // icon: 'excel' | 332 | // icon: 'excel' |
| 364 | // }, | 333 | // }, |
| 365 | // children: [ | 334 | // children: [ |
| 366 | // { | 335 | // { |
| 367 | // path: 'export-excel', | 336 | // path: 'export-excel', |
| 368 | // component: () => import('@/views/excel/export-excel'), | 337 | // component: () => import('@/views/excel/export-excel'), |
| 369 | // name: 'ExportExcel', | 338 | // name: 'ExportExcel', |
| 370 | // meta: { title: 'exportExcel' } | 339 | // meta: { title: 'exportExcel' } |
| 371 | // }, | 340 | // }, |
| 372 | // { | 341 | // { |
| 373 | // path: 'export-selected-excel', | 342 | // path: 'export-selected-excel', |
| 374 | // component: () => import('@/views/excel/select-excel'), | 343 | // component: () => import('@/views/excel/select-excel'), |
| 375 | // name: 'SelectExcel', | 344 | // name: 'SelectExcel', |
| 376 | // meta: { title: 'selectExcel' } | 345 | // meta: { title: 'selectExcel' } |
| 377 | // }, | 346 | // }, |
| 378 | // { | 347 | // { |
| 379 | // path: 'export-merge-header', | 348 | // path: 'export-merge-header', |
| 380 | // component: () => import('@/views/excel/merge-header'), | 349 | // component: () => import('@/views/excel/merge-header'), |
| 381 | // name: 'MergeHeader', | 350 | // name: 'MergeHeader', |
| 382 | // meta: { title: 'mergeHeader' } | 351 | // meta: { title: 'mergeHeader' } |
| 383 | // }, | 352 | // }, |
| 384 | // { | 353 | // { |
| 385 | // path: 'upload-excel', | 354 | // path: 'upload-excel', |
| 386 | // component: () => import('@/views/excel/upload-excel'), | 355 | // component: () => import('@/views/excel/upload-excel'), |
| 387 | // name: 'UploadExcel', | 356 | // name: 'UploadExcel', |
| 388 | // meta: { title: 'uploadExcel' } | 357 | // meta: { title: 'uploadExcel' } |
| 389 | // } | 358 | // } |
| 390 | // ] | 359 | // ] |
| 391 | // }, | 360 | // }, |
| 392 | 361 | ||
| 393 | // { | 362 | // { |
| 394 | // path: '/zip', | 363 | // path: '/zip', |
| 395 | // component: Layout, | 364 | // component: Layout, |
| 396 | // redirect: '/zip/download', | 365 | // redirect: '/zip/download', |
| 397 | // alwaysShow: true, | 366 | // alwaysShow: true, |
| 398 | // name: 'Zip', | 367 | // name: 'Zip', |
| 399 | // meta: { title: 'zip', icon: 'zip' }, | 368 | // meta: { title: 'zip', icon: 'zip' }, |
| 400 | // children: [ | 369 | // children: [ |
| 401 | // { | 370 | // { |
| 402 | // path: 'download', | 371 | // path: 'download', |
| 403 | // component: () => import('@/views/zip/index'), | 372 | // component: () => import('@/views/zip/index'), |
| 404 | // name: 'ExportZip', | 373 | // name: 'ExportZip', |
| 405 | // meta: { title: 'exportZip' } | 374 | // meta: { title: 'exportZip' } |
| 406 | // } | 375 | // } |
| 407 | // ] | 376 | // ] |
| 408 | // }, | 377 | // }, |
| 409 | 378 | ||
| 410 | // { | 379 | // { |
| 411 | // path: '/pdf', | 380 | // path: '/pdf', |
| 412 | // component: Layout, | 381 | // component: Layout, |
| 413 | // redirect: '/pdf/index', | 382 | // redirect: '/pdf/index', |
| 414 | // children: [ | 383 | // children: [ |
| 415 | // { | 384 | // { |
| 416 | // path: 'index', | 385 | // path: 'index', |
| 417 | // component: () => import('@/views/pdf/index'), | 386 | // component: () => import('@/views/pdf/index'), |
| 418 | // name: 'PDF', | 387 | // name: 'PDF', |
| 419 | // meta: { title: 'pdf', icon: 'pdf' } | 388 | // meta: { title: 'pdf', icon: 'pdf' } |
| 420 | // } | 389 | // } |
| 421 | // ] | 390 | // ] |
| 422 | // }, | 391 | // }, |
| 423 | // { | 392 | // { |
| 424 | // path: '/pdf/download', | 393 | // path: '/pdf/download', |
| 425 | // component: () => import('@/views/pdf/download'), | 394 | // component: () => import('@/views/pdf/download'), |
| 426 | // hidden: true | 395 | // hidden: true |
| 427 | // }, | 396 | // }, |
| 428 | 397 | ||
| 429 | // { | 398 | // { |
| 430 | // path: '/theme', | 399 | // path: '/theme', |
| 431 | // component: Layout, | 400 | // component: Layout, |
| 432 | // children: [ | 401 | // children: [ |
| 433 | // { | 402 | // { |
| 434 | // path: 'index', | 403 | // path: 'index', |
| 435 | // component: () => import('@/views/theme/index'), | 404 | // component: () => import('@/views/theme/index'), |
| 436 | // name: 'Theme', | 405 | // name: 'Theme', |
| 437 | // meta: { title: 'theme', icon: 'theme' } | 406 | // meta: { title: 'theme', icon: 'theme' } |
| 438 | // } | 407 | // } |
| 439 | // ] | 408 | // ] |
| 440 | // }, | 409 | // }, |
| 441 | 410 | ||
| 442 | // { | 411 | // { |
| 443 | // path: '/clipboard', | 412 | // path: '/clipboard', |
| 444 | // component: Layout, | 413 | // component: Layout, |
| 445 | // children: [ | 414 | // children: [ |
| 446 | // { | 415 | // { |
| 447 | // path: 'index', | 416 | // path: 'index', |
| 448 | // component: () => import('@/views/clipboard/index'), | 417 | // component: () => import('@/views/clipboard/index'), |
| 449 | // name: 'ClipboardDemo', | 418 | // name: 'ClipboardDemo', |
| 450 | // meta: { title: 'clipboardDemo', icon: 'clipboard' } | 419 | // meta: { title: 'clipboardDemo', icon: 'clipboard' } |
| 451 | // } | 420 | // } |
| 452 | // ] | 421 | // ] |
| 453 | // }, | 422 | // }, |
| 454 | 423 | ||
| 455 | // { | 424 | // { |
| 456 | // path: '/i18n', | 425 | // path: '/i18n', |
| 457 | // component: Layout, | 426 | // component: Layout, |
| 458 | // children: [ | 427 | // children: [ |
| 459 | // { | 428 | // { |
| 460 | // path: 'index', | 429 | // path: 'index', |
| 461 | // component: () => import('@/views/i18n-demo/index'), | 430 | // component: () => import('@/views/i18n-demo/index'), |
| 462 | // name: 'I18n', | 431 | // name: 'I18n', |
| 463 | // meta: { title: 'i18n', icon: 'international' } | 432 | // meta: { title: 'i18n', icon: 'international' } |
| 464 | // } | 433 | // } |
| 465 | // ] | 434 | // ] |
| 466 | // }, | 435 | // }, |
| 467 | 436 | ||
| 468 | // { | 437 | // { |
| 469 | // path: 'external-link', | 438 | // path: 'external-link', |
| 470 | // component: Layout, | 439 | // component: Layout, |
| 471 | // children: [ | 440 | // children: [ |
| 472 | // { | 441 | // { |
| 473 | // path: 'https://github.com/PanJiaChen/vue-element-admin', | 442 | // path: 'https://github.com/PanJiaChen/vue-element-admin', |
| 474 | // meta: { title: 'externalLink', icon: 'link' } | 443 | // meta: { title: 'externalLink', icon: 'link' } |
| 475 | // } | 444 | // } |
| 476 | // ] | 445 | // ] |
| 477 | // }, | 446 | // }, |
| 478 | 447 | ||
| 479 | // 404 page must be placed at the end !!! | 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 | const createRouter = () => new Router({ | 456 | const createRouter = () => new Router({ |
| 484 | // mode: 'history', // require service support | 457 | // mode: 'history', // require service support |
| 485 | scrollBehavior: () => ({ y: 0 }), | 458 | scrollBehavior: () => ({ |
| 459 | y: 0 | ||
| 460 | }), | ||
| 486 | routes: constantRoutes | 461 | routes: constantRoutes |
| 487 | }) | 462 | }) |
| 488 | 463 |
src/router/modules/system.js
| 1 | import Layout from '@/layout' | 1 | import Layout from '@/layout' |
| 2 | 2 | ||
| 3 | const systemRouter = { | 3 | const systemRouter = { |
| 4 | path: '/system', | 4 | path: '/system', |
| 5 | component: Layout, | 5 | component: Layout, |
| 6 | redirect: '/system/page', | 6 | redirect: '/system/page', |
| 7 | alwaysShow: true, // will always show the root menu | 7 | alwaysShow: true, // will always show the root menu |
| 8 | name: 'System', | 8 | name: 'System', |
| 9 | meta: { | 9 | meta: { |
| 10 | title: 'systems.systems', | 10 | title: 'systems.systems', |
| 11 | icon: 'component', | 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 | children: [{ | 14 | children: [{ |
| 15 | path: 'page', | 15 | path: 'page', |
| 16 | component: () => import('@/views/example/list'), | 16 | component: () => import('@/views/example/list'), |
| 17 | name: 'SystemList', | 17 | name: 'SystemList', |
| 18 | meta: { | 18 | meta: { |
| 19 | title: 'systems.sites', | 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 | { |
| 24 | path: 'page', | 24 | path: 'page', |
| 25 | component: () => import('@/views/example/list'), | 25 | component: () => import('@/views/example/list'), |
| 26 | name: 'SystemList', | 26 | name: 'SystemList', |
| 27 | meta: { | 27 | meta: { |
| 28 | title: 'systems.money', | 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 | { |
| 33 | path: 'page', | 33 | path: 'page', |
| 34 | component: () => import('@/views/example/list'), | 34 | component: () => import('@/views/example/list'), |
| 35 | name: 'SystemList', | 35 | name: 'SystemList', |
| 36 | meta: { | 36 | meta: { |
| 37 | title: 'systems.industry', | 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 | { |
| 42 | path: 'page', | 42 | path: 'page', |
| 43 | component: () => import('@/views/example/list'), | 43 | component: () => import('@/views/example/list'), |
| 44 | name: 'SystemList', | 44 | name: 'SystemList', |
| 45 | meta: { | 45 | meta: { |
| 46 | title: 'systems.template', | 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 | ||
| 51 | ] | 51 | ] |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | export default systemRouter | 54 | export default systemRouter |
| 55 | 55 |
src/router/modules/user.js
| 1 | /** When your routing table is too long, you can split it into small modules**/ | 1 | /** When your routing table is too long, you can split it into small modules**/ |
| 2 | 2 | ||
| 3 | import Layout from '@/layout' | 3 | import Layout from '@/layout' |
| 4 | 4 | ||
| 5 | const chartsRouter = { | 5 | const chartsRouter = { |
| 6 | path: '/users', | 6 | path: '/users', |
| 7 | component: Layout, | 7 | component: Layout, |
| 8 | redirect: '/users/page', | 8 | redirect: '/users/page', |
| 9 | alwaysShow: true, // will always show the root menu | 9 | alwaysShow: true, // will always show the root menu |
| 10 | name: 'Users', | 10 | name: 'Users', |
| 11 | meta: { | 11 | meta: { |
| 12 | title: 'users.people', | 12 | title: 'users.people', |
| 13 | icon: 'peoples', | 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 | children: [{ | 16 | children: [{ |
| 17 | path: 'assistant', | 17 | path: 'assistant', |
| 18 | component: () => import('@/views/users/list'), | 18 | component: () => import('@/views/users/list'), |
| 19 | name: 'assistant', | 19 | name: 'assistant', |
| 20 | query: { | 20 | query: { |
| 21 | test: 'ssssss' | 21 | test: 'ssssss' |
| 22 | }, | 22 | }, |
| 23 | meta: { | 23 | meta: { |
| 24 | title: 'users.assistant', | 24 | title: 'users.assistant', |
| 25 | roles: ['admin'] // or you can only set roles in sub nav | 25 | roles: ['admin'] // or you can only set roles in sub nav |
| 26 | } | 26 | } |
| 27 | }, | 27 | }, |
| 28 | { | 28 | { |
| 29 | path: 'runner', | 29 | path: 'runner', |
| 30 | component: () => import('@/views/users/list'), | 30 | component: () => import('@/views/users/list'), |
| 31 | name: 'runner', | 31 | name: 'runner', |
| 32 | query: { | 32 | query: { |
| 33 | test: 'ssssss' | 33 | test: 'ssssss' |
| 34 | }, | 34 | }, |
| 35 | meta: { | 35 | meta: { |
| 36 | title: 'users.runner', | 36 | title: 'users.runner', |
| 37 | roles: ['admin', 'assistant'] // or you can only set roles in sub nav | 37 | roles: ['admin', 'assistant'] // or you can only set roles in sub nav |
| 38 | } | 38 | } |
| 39 | }, | 39 | }, |
| 40 | { | 40 | { |
| 41 | path: 'shoper', | 41 | path: 'shoper', |
| 42 | component: () => import('@/views/users/list'), | 42 | component: () => import('@/views/users/list'), |
| 43 | name: 'shoper', | 43 | name: 'shoper', |
| 44 | query: { | 44 | query: { |
| 45 | test: 'ssssss' | 45 | test: 'ssssss' |
| 46 | }, | 46 | }, |
| 47 | meta: { | 47 | meta: { |
| 48 | title: 'users.shoper', | 48 | title: 'users.shoper', |
| 49 | roles: ['admin', 'assistant'] // or you can only set roles in sub nav | 49 | roles: ['admin', 'assistant'] // or you can only set roles in sub nav |
| 50 | } | 50 | } |
| 51 | }, | 51 | }, |
| 52 | { | 52 | { |
| 53 | path: 'users', | 53 | path: 'users', |
| 54 | component: () => import('@/views/users/list'), | 54 | component: () => import('@/views/users/list'), |
| 55 | name: 'users', | 55 | name: 'users', |
| 56 | query: { | 56 | query: { |
| 57 | test: 'ssssss' | 57 | test: 'ssssss' |
| 58 | }, | 58 | }, |
| 59 | meta: { | 59 | meta: { |
| 60 | title: 'users.user', | 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 | // ,{ |
| 65 | // path: '/icons', | 65 | // path: '/icons', |
| 66 | // component: () => import('@/views/icons/index'), | 66 | // component: () => import('@/views/icons/index'), |
| 67 | // name: 'icons', | 67 | // name: 'icons', |
| 68 | // meta: { | 68 | // meta: { |
| 69 | // title: 'icons', | 69 | // title: 'icons', |
| 70 | // roles: ['admin', 'assistant', 'shoper', 'runner'] // or you can only set roles in sub nav | 70 | // roles: ['admin', 'assistant', 'shoper', 'runner'] // or you can only set roles in sub nav |
| 71 | // } | 71 | // } |
| 72 | // } | 72 | // } |
| 73 | ] | 73 | ] |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | export default chartsRouter | 76 | export default chartsRouter |
| 77 | 77 |
src/views/dashboard/editor/index.vue
| 1 | <template> | File was deleted | |
| 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> | ||
| 73 | 1 | <template> |
src/views/dashboard/index.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="dashboard-container"> | 2 | <div class="dashboard-container"> |
| 3 | <component :is="currentRole" /> | 3 | <component :is="currentRole" /> |
| 4 | </div> | 4 | </div> |
| 5 | </template> | 5 | </template> |
| 6 | 6 | ||
| 7 | <script> | 7 | <script> |
| 8 | import { mapGetters } from 'vuex' | 8 | import { mapGetters } from 'vuex' |
| 9 | import adminDashboard from './admin' | 9 | import adminDashboard from './admin' |
| 10 | import editorDashboard from './editor' | 10 | import runnerDashboard from './runner' |
| 11 | 11 | ||
| 12 | export default { | 12 | export default { |
| 13 | name: 'Dashboard', | 13 | name: 'Dashboard', |
| 14 | components: { adminDashboard, editorDashboard }, | 14 | components: { adminDashboard, runnerDashboard }, |
| 15 | data() { | 15 | data() { |
| 16 | return { | 16 | return { |
| 17 | currentRole: 'adminDashboard' | 17 | currentRole: 'adminDashboard' |
| 18 | } | 18 | } |
| 19 | }, | 19 | }, |
| 20 | computed: { | 20 | computed: { |
| 21 | ...mapGetters([ | 21 | ...mapGetters(['roles']) |
| 22 | 'roles' | ||
| 23 | ]) | ||
| 24 | }, | 22 | }, |
| 25 | created() { | 23 | created() { |
| 26 | if (!this.roles.includes('admin')) { | 24 | if (this.roles.includes('admin')) { |
| 27 | this.currentRole = 'editorDashboard' | 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 | } |