From 96898eae45b2a2e764b9a99f3c12ad028daf2fff Mon Sep 17 00:00:00 2001 From: "Adam.Gong" <admin@xiuyetang.com> Date: Sun, 10 May 2020 02:58:37 +0800 Subject: [PATCH] auto commit the code by alias command --- src/router/index.js | 233 ++++++++++++++++------------------- src/router/modules/system.js | 10 +- src/router/modules/user.js | 4 +- src/views/dashboard/editor/index.vue | 72 ----------- src/views/dashboard/index.vue | 45 +++++-- 5 files changed, 149 insertions(+), 215 deletions(-) delete mode 100755 src/views/dashboard/editor/index.vue diff --git a/src/router/index.js b/src/router/index.js index 86dd9f9..0b074fb 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -9,12 +9,13 @@ import Layout from '@/layout' /* Router Modules */ // import componentsRouter from './modules/components' // import chartsRouter from './modules/charts' -import tableRouter from './modules/table' +// import tableRouter from './modules/table' // import nestedRouter from './modules/nested' import userRouter from './modules/user' import systemRouter from './modules/system' import prodRouter from './modules/prod' import metaRouter from './modules/meta' +import sitesRouter from './modules/sites' /** * Note: sub-menu only appear when route children.length >= 1 @@ -42,81 +43,82 @@ import metaRouter from './modules/meta' * a base page that does not have permission requirements * all roles can be accessed */ -export const constantRoutes = [ - { - path: '/redirect', - component: Layout, - hidden: true, - children: [ - { - path: '/redirect/:path*', - component: () => import('@/views/redirect/index') - } - ] - }, - { - path: '/login', - component: () => import('@/views/login/index'), - hidden: true - }, - { - path: '/auth-redirect', - component: () => import('@/views/login/auth-redirect'), - hidden: true - }, - { - path: '/404', - component: () => import('@/views/error-page/404'), - hidden: true - }, - { - path: '/500', - component: () => import('@/views/error-page/500'), - hidden: true - }, - { - path: '/401', - component: () => import('@/views/error-page/401'), - hidden: true - }, - { - path: '/', - component: Layout, - redirect: '/dashboard', - children: [ - { - path: 'dashboard', - component: () => import('@/views/dashboard/index'), - name: 'Dashboard', - meta: { title: 'dashboard', icon: 'dashboard', affix: true } - } - ] - }, - // { - // path: '/documentation', - // component: Layout, - // children: [ - // { - // path: 'index', - // component: () => import('@/views/documentation/index'), - // name: 'Documentation', - // meta: { title: 'documentation', icon: 'documentation', affix: true } - // } - // ] - // }, - { - path: '/guide', - component: Layout, - redirect: '/guide/index', - children: [ - { - path: 'index', - component: () => import('@/views/guide/index'), - name: 'Guide', - meta: { title: 'guide', icon: 'guide', noCache: true } - } - ] - } +export const constantRoutes = [{ + path: '/redirect', + component: Layout, + hidden: true, + children: [{ + path: '/redirect/:path*', + component: () => import('@/views/redirect/index') + }] +}, +{ + path: '/login', + component: () => import('@/views/login/index'), + hidden: true +}, +{ + path: '/auth-redirect', + component: () => import('@/views/login/auth-redirect'), + hidden: true +}, +{ + path: '/404', + component: () => import('@/views/error-page/404'), + hidden: true +}, +{ + path: '/500', + component: () => import('@/views/error-page/500'), + hidden: true +}, +{ + path: '/401', + component: () => import('@/views/error-page/401'), + hidden: true +}, +{ + path: '/', + component: Layout, + redirect: '/dashboard', + children: [{ + path: 'dashboard', + component: () => import('@/views/dashboard/index'), + name: 'Dashboard', + meta: { + title: 'dashboard', + icon: 'dashboard', + affix: true + } + }] +}, +// { +// path: '/documentation', +// component: Layout, +// children: [ +// { +// path: 'index', +// component: () => import('@/views/documentation/index'), +// name: 'Documentation', +// meta: { title: 'documentation', icon: 'documentation', affix: true } +// } +// ] +// }, +{ + path: '/guide', + component: Layout, + redirect: '/guide/index', + children: [{ + path: 'index', + component: () => import('@/views/guide/index'), + name: 'Guide', + meta: { + title: 'guide', + icon: 'guide', + noCache: true + } + }] +} // { // path: '/profile', // component: Layout, @@ -180,7 +182,7 @@ export const asyncRoutes = [ // } // ] // }, - tableRouter, + // tableRouter, metaRouter, userRouter, prodRouter, @@ -195,61 +197,28 @@ export const asyncRoutes = [ icon: 'shopping', roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav }, - children: [ - { - path: 'page', - component: () => import('@/views/permission/page'), - name: 'OrderList', - meta: { - title: 'OrderList', - roles: ['admin', 'assistant', 'runner', 'shoper'] // or you can only set roles in sub nav - } - }, - { - path: 'defined', - component: () => import('@/views/permission/directive'), - name: 'OrderDefiend', - meta: { - title: 'OrderDefiend', - roles: ['admin', 'assistant', 'runner', 'shoper'] - // if do not set roles, means: this page does not require permission - } + children: [{ + path: 'page', + component: () => import('@/views/permission/page'), + name: 'OrderList', + meta: { + title: 'OrderList', + roles: ['admin', 'assistant', 'runner', 'shoper'] // or you can only set roles in sub nav } - ] - }, - { - path: '/sites', - component: Layout, - redirect: '/site/page', - alwaysShow: true, // will always show the root menu - name: 'Site', - meta: { - title: 'sites', - icon: 'people', - roles: ['admin', 'assistant', 'runner'] // you can set roles in root nav }, - children: [ - { - path: 'page', - component: () => import('@/views/permission/page'), - name: 'SiteList', - meta: { - title: 'SiteList', - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav - } - }, - { - path: 'defined', - component: () => import('@/views/permission/directive'), - name: 'SiteDefiend', - meta: { - title: 'SiteDefiend', - roles: ['admin', 'assistant', 'runner'] - // if do not set roles, means: this page does not require permission - } + { + path: 'defined', + component: () => import('@/views/permission/directive'), + name: 'OrderDefiend', + meta: { + title: 'OrderDefiend', + roles: ['admin', 'assistant', 'runner', 'shoper'] + // if do not set roles, means: this page does not require permission } + } ] }, + sitesRouter, // { // path: '/icon', @@ -477,12 +446,18 @@ export const asyncRoutes = [ // }, // 404 page must be placed at the end !!! - { path: '*', redirect: '/404', hidden: true } + { + path: '*', + redirect: '/404', + hidden: true + } ] const createRouter = () => new Router({ // mode: 'history', // require service support - scrollBehavior: () => ({ y: 0 }), + scrollBehavior: () => ({ + y: 0 + }), routes: constantRoutes }) diff --git a/src/router/modules/system.js b/src/router/modules/system.js index f4bb5e5..31e917d 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -9,7 +9,7 @@ const systemRouter = { meta: { title: 'systems.systems', icon: 'component', - roles: ['admin', 'assistant', 'runner'] // you can set roles in root nav + roles: ['admin', 'assistant'] // you can set roles in root nav }, children: [{ path: 'page', @@ -17,7 +17,7 @@ const systemRouter = { name: 'SystemList', meta: { title: 'systems.sites', - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav + roles: ['admin', 'assistant'] // or you can only set roles in sub nav } }, { @@ -26,7 +26,7 @@ const systemRouter = { name: 'SystemList', meta: { title: 'systems.money', - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav + roles: ['admin', 'assistant'] // or you can only set roles in sub nav } }, { @@ -35,7 +35,7 @@ const systemRouter = { name: 'SystemList', meta: { title: 'systems.industry', - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav + roles: ['admin', 'assistant'] // or you can only set roles in sub nav } }, { @@ -44,7 +44,7 @@ const systemRouter = { name: 'SystemList', meta: { title: 'systems.template', - roles: ['admin', 'assistant', 'runner'] // or you can only set roles in sub nav + roles: ['admin', 'assistant'] // or you can only set roles in sub nav } } diff --git a/src/router/modules/user.js b/src/router/modules/user.js index 3d1d69e..e5fcedd 100644 --- a/src/router/modules/user.js +++ b/src/router/modules/user.js @@ -11,7 +11,7 @@ const chartsRouter = { meta: { title: 'users.people', icon: 'peoples', - roles: ['admin', 'assistant', 'runner', 'shoper'] // you can set roles in root nav + roles: ['admin', 'assistant'] // you can set roles in root nav }, children: [{ path: 'assistant', @@ -58,7 +58,7 @@ const chartsRouter = { }, meta: { title: 'users.user', - roles: ['admin', 'assistant', 'shoper', 'runner'] // or you can only set roles in sub nav + roles: ['admin', 'assistant'] // or you can only set roles in sub nav } } // ,{ diff --git a/src/views/dashboard/editor/index.vue b/src/views/dashboard/editor/index.vue deleted file mode 100755 index e2085a6..0000000 --- a/src/views/dashboard/editor/index.vue +++ /dev/null @@ -1,72 +0,0 @@ -<template> - <div class="dashboard-editor-container"> - <div class="clearfix"> - <pan-thumb :image="avatar" style="float: left"> - Your roles: - <span v-for="item in roles" :key="item" class="pan-info-roles">{{ item }}</span> - </pan-thumb> - <github-corner style="position: absolute; top: 0px; border: 0; right: 0;" /> - <div class="info-container"> - <span class="display_name">{{ name }}</span> - <span style="font-size:20px;padding-top:20px;display:inline-block;">{{ roles }}'s Dashboard</span> - </div> - </div> - <div> - <img :src="emptyGif" class="emptyGif"> - </div> - </div> -</template> - -<script> -import { mapGetters } from 'vuex' -import PanThumb from '@/components/PanThumb' -// import GithubCorner from '@/components/GithubCorner' - -export default { - name: 'DashboardEditor', - // components: { PanThumb, GithubCorner }, - components: { PanThumb }, - data() { - return { - emptyGif: - 'https://wpimg.wallstcn.com/0e03b7da-db9e-4819-ba10-9016ddfdaed3' - } - }, - computed: { - ...mapGetters(['name', 'avatar', 'roles']) - } -} -</script> - -<style lang="scss" scoped> -.emptyGif { - display: block; - width: 45%; - margin: 0 auto; -} - -.dashboard-editor-container { - background-color: #e3e3e3; - min-height: 100vh; - padding: 50px 60px 0px; - .pan-info-roles { - font-size: 12px; - font-weight: 700; - color: #333; - display: block; - } - .info-container { - position: relative; - margin-left: 190px; - height: 150px; - line-height: 200px; - .display_name { - font-size: 48px; - line-height: 48px; - color: #212121; - position: absolute; - top: 25px; - } - } -} -</style> diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 1720ea8..c4b15d1 100755 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -7,24 +7,55 @@ <script> import { mapGetters } from 'vuex' import adminDashboard from './admin' -import editorDashboard from './editor' +import runnerDashboard from './runner' export default { name: 'Dashboard', - components: { adminDashboard, editorDashboard }, + components: { adminDashboard, runnerDashboard }, data() { return { currentRole: 'adminDashboard' } }, computed: { - ...mapGetters([ - 'roles' - ]) + ...mapGetters(['roles']) }, created() { - if (!this.roles.includes('admin')) { - this.currentRole = 'editorDashboard' + if (this.roles.includes('admin')) { + this.$notify({ + title: '----admin---', + message: 'adminadminadminadmin', + type: 'success', + duration: 2000 + }) + this.currentRole = 'adminDashboard' + } + if (this.roles.includes('assistant')) { + this.$notify({ + title: '----assistant---', + message: 'assistantassistantassistantassistant', + type: 'success', + duration: 2000 + }) + this.currentRole = 'adminDashboard' + } + if (this.roles.includes('runner')) { + this.$notify({ + title: '----runner---', + message: 'runnerrunnerrunnerrunner', + type: 'success', + duration: 2000 + }) + this.currentRole = 'runnerDashboard' + } + if (this.roles.includes('shoper')) { + this.$notify({ + title: '----shoper---', + message: 'shopershopershopershoper', + type: 'success', + duration: 2000 + }) + this.currentRole = 'runnerDashboard' } } } -- 2.0.0