Преглед на файлове

路由和后台侧边栏动态渲染

reghao преди 3 месеца
родител
ревизия
5efd290137

+ 2 - 5
src/permission.js

@@ -17,17 +17,14 @@ router.beforeEach((to, from, next) => {
         const roles = store.dispatch('getUserRoles')
         const accessRoutes = store.dispatch('generateRoutes', roles)
         accessRoutes.then(allRoutes => {
-          console.log(allRoutes)
           router.addRoutes(allRoutes)
-        })
-        /* getRoutes(router).then(r => {
           next({ ...to, replace: true })
-        })*/
+        })
       }
     }
   } else {
     removeAll()
-    if (needAuth) {
+    if (needAuth === undefined || needAuth) {
       next('/login')
     } else {
       next()

+ 4 - 4
src/router/background_account.js

@@ -13,25 +13,25 @@ export default {
   redirect: '/bg/account/profile',
   name: 'Account',
   component: Background,
-  meta: { needAuth: true },
+  meta: { needAuth: true, roles: ['admin'] },
   children: [
     {
       path: '/bg/account/profile',
       name: 'MyProfile',
       component: MyProfile,
-      meta: { title: '个人资料', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/account/record',
       name: 'MyRecord',
       component: MyRecord,
-      meta: { title: '登入历史', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/account/oauth',
       name: 'OAuth',
       component: MyOAuth,
-      meta: { title: 'OAuth认证', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 5 - 5
src/router/background_admin.js

@@ -13,31 +13,31 @@ export default {
   redirect: '/bg/account',
   name: 'Admin',
   component: Background,
-  meta: { needAuth: true },
+  meta: { needAuth: true, roles: ['admin'] },
   children: [
     {
       path: '/bg/admin/charge',
       name: 'AdminCharge',
       component: AdminCharge,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] },
     },
     {
       path: '/bg/admin/user',
       name: 'AdminUserList',
       component: AdminUserList,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] },
     },
     {
       path: '/bg/admin/video',
       name: 'AdminVideoList',
       component: AdminVideoList,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] },
     },
     {
       path: '/bg/admin/avatar',
       name: 'AdminAvatarList',
       component: AdminAvatarList,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] },
     }
   ]
 }

+ 7 - 7
src/router/background_backend.js

@@ -15,43 +15,43 @@ export default {
   redirect: '/bg/account',
   name: 'Backend',
   component: Background,
-  meta: { needAuth: true },
+  meta: { needAuth: true, roles: ['admin'] },
   children: [
     {
       path: '/bg/backend/gateway',
       name: 'Gateway',
       component: AdminGateway,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/backend/dubbo_service',
       name: 'DubboService',
       component: AdminDubboService,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/backend/springcloud_service',
       name: 'SpringCloudService',
       component: AdminSpringCloudService,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/backend/access_log',
       name: 'AccessLog',
       component: AdminAccessLog,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/backend/runtime_log',
       name: 'RuntimeLog',
       component: AdminRuntimeLog,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/backend/realtime_log',
       name: 'Realtime',
       component: AdminBackendLog,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 3 - 3
src/router/background_blog.js

@@ -14,19 +14,19 @@ export default {
       path: '/bg/blog/category',
       name: 'AdminStoreConfig',
       component: BlogCategory,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/blog/post',
       name: 'BlogPost',
       component: BlogPost,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/blog/question',
       name: 'BlogQuestion',
       component: BlogQuestion,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 79 - 53
src/router/background_devops.js

@@ -1,6 +1,5 @@
 // ********************************************************************************************************************
 const Background = () => import('views/admin/Background')
-const Dashboard = () => import('views/devops/Dashboard')
 
 // user
 const UserProfile = () => import('views/devops/user/UserProfile')
@@ -25,188 +24,215 @@ const BuildDeploy = () => import('views/devops/app/BuildDeploy')
 const AppStat = () => import('views/devops/app/AppStat')
 // sys
 const SiteConfig = () => import('views/devops/sys/SiteConfig')
-const AccessLog = () => import('views/devops/sys/AccessLog')
-const RuntimeLog = () => import('views/devops/sys/RuntimeLog')
-const RealtimeLog = () => import('views/devops/sys/RealtimeLog')
 const Webhook = () => import('views/devops/sys/Webhook')
 
 export default {
   path: '/bg',
   name: 'Background',
   component: Background,
-  meta: { needAuth: true, roles: ['admin'] },
+  meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] },
   children: [
     {
       path: '/bg/user',
-      name: 'UserProfile',
+      name: 'UserProfileIndex',
+      title: '我的',
+      icon: 'el-icon-user',
       component: { render: (e) => e('router-view') },
-      meta: { needAuth: true, roles: ['user'] },
+      meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] },
       children: [
         {
           path: '/bg/user/profile',
           name: 'UserProfile',
+          title: '我的资料',
+          icon: 'el-icon-user',
           component: UserProfile,
-          meta: { needAuth: true, roles: ['user'] }
+          meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] }
         },
         {
           path: '/bg/user/record',
           name: 'UserLogin',
+          title: '登入记录',
+          icon: 'el-icon-user',
           component: UserLogin,
-          meta: { needAuth: true, roles: ['user'] }
+          meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] }
         },
         {
           path: '/bg/user/message',
           name: 'UserMessage',
+          title: '我的消息',
+          icon: 'el-icon-user',
           component: UserMessage,
-          meta: { needAuth: true, roles: ['user'] }
+          meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] }
         }
       ]
     },
     {
       path: '/bg/machine',
-      name: 'MachineHost',
+      name: 'MachineHostIndex',
+      title: '机器',
+      icon: 'el-icon-s-data',
       component: { render: (e) => e('router-view') },
-      meta: { needAuth: true, roles: ['admin'] },
+      meta: { needAuth: true, roles: ['devops_admin'] },
       children: [
         {
           path: '/bg/machine/host',
           name: 'MachineHost',
+          title: '机器节点',
+          icon: 'el-icon-s-data',
           component: MachineHost,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/machine/aliyun_key',
           name: 'AliyunKey',
+          title: '阿里云帐号',
+          icon: 'el-icon-s-data',
           component: AliyunKey,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         }
       ]
     },
     {
       path: '/bg/build',
-      name: 'BuildDir',
+      name: 'BuildDirIndex',
+      title: '构建配置',
+      icon: 'el-icon-film',
       component: { render: (e) => e('router-view') },
-      meta: { needAuth: true, roles: ['admin'] },
+      meta: { needAuth: true, roles: ['devops_admin'] },
       children: [
         {
           path: '/bg/build/dir',
           name: 'BuildDir',
+          title: '构建目录',
+          icon: 'el-icon-film',
           component: BuildDir,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/build/repo_auth',
           name: 'RepoAuth',
+          title: '仓库认证',
+          icon: 'el-icon-film',
           component: RepoAuth,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/build/compiler',
           name: 'Compiler',
+          title: '编译器',
+          icon: 'el-icon-film',
           component: Compiler,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/build/docker_registry',
           name: 'DockerRegistry',
+          title: 'docker 仓库',
+          icon: 'el-icon-files',
           component: DockerRegistry,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/build/packer',
           name: 'Packer',
+          title: '应用打包',
+          icon: 'el-icon-files',
           component: Packer,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         }
       ]
     },
     {
       path: '/bg/app',
-      name: 'AppConfig',
+      name: 'AppConfigIndex',
+      title: '应用',
+      icon: 'el-icon-files',
       component: { render: (e) => e('router-view') },
-      meta: { needAuth: true, roles: ['admin'] },
+      meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] },
       children: [
         {
           path: '/bg/app/config',
           name: 'AppConfig',
+          title: '应用配置',
+          icon: 'el-icon-files',
           component: AppConfig,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] }
         },
         {
           path: '/bg/app/bd',
           name: 'BuildDeploy',
+          title: '构建部署',
+          icon: 'el-icon-files',
           component: BuildDeploy,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] }
         },
         {
           path: '/bg/app/stat',
           name: 'AppStat',
+          title: '运行状态',
+          icon: 'el-icon-files',
           component: AppStat,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin', 'devops_java', 'devops_dotnet', 'devops_npm'] }
         }
       ]
     },
     {
       path: '/bg/sys',
-      name: 'SiteConfig',
+      name: 'SiteConfigIndex',
+      title: '系统',
+      icon: 'el-icon-user-solid',
       component: { render: (e) => e('router-view') },
-      meta: { needAuth: true, roles: ['admin'] },
+      meta: { needAuth: true, roles: ['devops_admin'] },
       children: [
         {
           path: '/bg/sys/site',
           name: 'SiteConfig',
+          title: '站点配置',
+          icon: 'el-icon-user-solid',
           component: SiteConfig,
-          meta: { needAuth: true, roles: ['admin'] }
-        },
-        {
-          path: '/bg/sys/access_log',
-          name: 'AccessLog',
-          component: AccessLog,
-          meta: { needAuth: true, roles: ['admin'] }
-        },
-        {
-          path: '/bg/sys/runtime_log',
-          name: 'RuntimeLog',
-          component: RuntimeLog,
-          meta: { needAuth: true, roles: ['admin'] }
-        },
-        {
-          path: '/bg/sys/realtime_log',
-          name: 'RealtimeLog',
-          component: RealtimeLog,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/sys/webhook',
           name: 'Webhook',
+          title: 'webhook通知',
+          icon: 'el-icon-user-solid',
           component: Webhook,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         }
       ]
     },
     {
       path: '/bg/rbac',
-      name: 'RBAC',
+      name: 'RBACIndex',
+      title: 'RBAC',
+      icon: 'el-icon-loading',
       component: { render: (e) => e('router-view') },
-      meta: { needAuth: true, roles: ['admin'] },
+      meta: { needAuth: true, roles: ['devops_admin'] },
       children: [
         {
           path: '/bg/rbac/menu',
           name: 'Menu',
+          title: '资源管理',
+          icon: 'el-icon-loading',
           component: Menu,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/rbac/role',
           name: 'Role',
+          title: '角色管理',
+          icon: 'el-icon-loading',
           component: Role,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         },
         {
           path: '/bg/rbac/user',
           name: 'User',
+          title: '用户管理',
+          icon: 'el-icon-loading',
           component: User,
-          meta: { needAuth: true, roles: ['admin'] }
+          meta: { needAuth: true, roles: ['devops_admin'] }
         }
       ]
     }

+ 2 - 2
src/router/background_file.js

@@ -13,13 +13,13 @@ export default {
       path: '/bg/file/list',
       name: 'AdminStoreConfig',
       component: AdminStoreNode,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/file/image',
       name: 'AdminUserNode',
       component: AdminUserNode,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 9 - 9
src/router/background_my.js

@@ -21,55 +21,55 @@ export default {
   redirect: '/bg/account',
   name: 'My',
   component: Background,
-  meta: { needAuth: true },
+  meta: { needAuth: true, roles: ['admin'] },
   children: [
     {
       path: '/bg/my/album',
       name: 'AlbumPost',
       component: AlbumPost,
-      meta: { title: '播放列表', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/my/history',
       name: 'History',
       component: History,
-      meta: { title: '历史记录', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/my/vip',
       name: 'MyVip',
       component: MyVip,
-      meta: { title: '我的会员', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/my/wallet',
       name: 'MyWallet',
       component: MyWallet,
-      meta: { title: '我的钱包', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/my/message',
       name: 'MyMessage',
       component: MyMessage,
-      meta: { title: '我的消息', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/my/rcmd',
       name: 'Rcmd',
       component: MyRcmd,
-      meta: { title: '推荐设置', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/my/contact',
       name: 'MyContact',
       component: MyContact,
-      meta: { title: '联系人', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/my/device',
       name: 'MyDevice',
       component: MyDevice,
-      meta: { title: '我的设备', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 4 - 4
src/router/background_oss.js

@@ -15,25 +15,25 @@ export default {
       path: '/bg/oss/store_node',
       name: 'AdminStoreConfig',
       component: AdminStoreNode,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/oss/user_node',
       name: 'AdminUserNode',
       component: AdminUserNode,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/oss/upload_channel',
       name: 'AdminUploadChannel',
       component: AdminUploadChannel,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/oss/object',
       name: 'AdminStoreObject',
       component: AdminStoreObject,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 6 - 6
src/router/background_post.js

@@ -13,31 +13,31 @@ export default {
   redirect: '/bg/account',
   name: 'Post',
   component: Background,
-  meta: { needAuth: true },
+  meta: { needAuth: true, roles: ['admin'] },
   children: [
     {
       path: '/bg/post/video',
       name: 'VideoPost',
       component: VideoPost,
-      meta: { title: '视频稿件', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/post/video/edit/:videoId',
       name: 'VideoPostEdit',
       component: VideoPostEdit,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/post/image',
       name: 'ImagePost',
       component: ImagePost,
-      meta: { title: '相册稿件', needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/post/image/edit/:albumId',
       name: 'ImagePostEdit',
       component: ImagePostEdit,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/post/article',
@@ -49,7 +49,7 @@ export default {
       path: '/bg/post/article/edit/:articleId',
       name: 'ArticlePostEdit',
       component: ArticlePostEdit,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 4 - 4
src/router/background_site.js

@@ -16,25 +16,25 @@ export default {
       path: '/bg/site/store',
       name: 'AdminStoreConfig',
       component: AdminStoreConfig,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/site/notify',
       name: 'AdminNotifyConfig',
       component: AdminNotifyConfig,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/site/registry',
       name: 'AdminRegistry',
       component: AdminRegistry,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     },
     {
       path: '/bg/site/category',
       name: 'AdminCategory',
       component: AdminCategory,
-      meta: { needAuth: true }
+      meta: { needAuth: true, roles: ['admin'] }
     }
   ]
 }

+ 16 - 15
src/router/index.js

@@ -35,24 +35,16 @@ export const constantRoutes = [
   SearchRouter,
   BlogRouter,
   VodRouter,
-  BackgroundAccountRouter,
-  BackgroundMyRouter,
-  BackgroundPostRouter,
-  BackgroundSiteRouter,
-  BackgroundAdminRouter,
-  BackgroundBackendRouter,
-  BackgroundOssRouter,
-  BackgroundBlogRouter,
-  BackgroundFileRouter,
   {
     path: '/',
+    redirect: '/bg',
     name: 'Index',
     component: Index,
     meta: { needAuth: false }
   },
   {
     path: '/bg',
-    name: 'Background',
+    name: 'BackgroundIndex',
     component: Background,
     meta: { needAuth: false },
     children: [
@@ -81,7 +73,20 @@ export const constantRoutes = [
     name: 'Forgot',
     component: Forgot,
     meta: { needAuth: false }
-  },
+  }
+]
+
+export const asyncRoutes = [
+  BackgroundDevopsRouter,
+  BackgroundAccountRouter,
+  BackgroundMyRouter,
+  BackgroundPostRouter,
+  BackgroundSiteRouter,
+  BackgroundAdminRouter,
+  BackgroundBackendRouter,
+  BackgroundOssRouter,
+  BackgroundBlogRouter,
+  BackgroundFileRouter,
   {
     path: '*',
     name: '404',
@@ -90,10 +95,6 @@ export const constantRoutes = [
   }
 ]
 
-export const asyncRoutes = [
-  BackgroundDevopsRouter
-]
-
 // 创建路由对象并导出
 export default new VueRouter({
   mode: 'history',

+ 2 - 0
src/store/index.js

@@ -12,6 +12,8 @@ const store = new Vuex.Store({
   getters: {
     // 用户登入状态
     roles: state => state.roles,
+    routes: state => state.routes,
+    addRoutes: state => state.addRoutes,
     // websocket 连接状态
     socketStatus: state => state.socketStatus
   },

+ 12 - 429
src/views/admin/LeftAside.vue

@@ -15,13 +15,13 @@
         <img class="logoimg" src="@/assets/img/logo.png" alt="">
       </a>
     </div>
-    <el-submenu v-for="(item, index) in menuList" :key="index" :index="item.url">
+    <el-submenu v-for="item in menuList" :key="item.path" :index="item.path">
       <template slot="title">
         <i :class="item.icon" />
         <span>{{ item.title }}</span>
       </template>
       <el-menu-item-group>
-        <el-menu-item v-for="(child, index0) in item.children" :key="index0" :index="child.url">
+        <el-menu-item v-for="child in item.children" :key="child.path" :index="child.path">
           <i :class="child.icon" />
           <span slot="title">{{ child.title }}</span>
         </el-menu-item>
@@ -31,7 +31,7 @@
 </template>
 
 <script>
-import { mapState } from 'vuex'
+import store from '@/store'
 
 export default {
   name: 'LeftAside',
@@ -39,429 +39,24 @@ export default {
     return {
       collapsed: false,
       collapseTransition: false,
-      menuList: [],
-      devops: true
+      menuList: []
     }
   },
-  computed: {
-    ...mapState({
-      routers: 'routes'
-    })
-  },
-  mounted() {
-    this.initSideMenu()
-  },
   created() {
+    for (const route of store.getters.addRoutes) {
+      if (route.path === '/bg') {
+        for (const route1 of route.children) {
+          this.menuList.push(route1)
+        }
+      }
+    }
+
     // 钩子函数
     this.$root.Bus.$on('HandleSideMenu', value => {
       this.collapsed = value
     })
   },
   methods: {
-    initSideMenu() {
-      if (this.devops) {
-        this.menuList = [
-          {
-            url: '/bg/user',
-            title: '我的',
-            icon: 'el-icon-user',
-            children: [
-              {
-                url: '/bg/user/profile',
-                title: '我的资料',
-                icon: 'el-icon-user'
-              },
-              {
-                url: '/bg/user/record',
-                title: '登入记录',
-                icon: 'el-icon-user'
-              },
-              {
-                url: '/bg/user/message',
-                title: '我的消息',
-                icon: 'el-icon-user'
-              }
-            ]
-          },
-          {
-            url: '/bg/machine',
-            title: '机器',
-            icon: 'el-icon-s-data',
-            children: [
-              {
-                url: '/bg/machine/host',
-                title: '机器节点',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/machine/aliyun_key',
-                title: '阿里云帐号',
-                icon: 'el-icon-s-data'
-              }
-            ]
-          },
-          {
-            url: '/bg/build',
-            title: '构建配置',
-            icon: 'el-icon-film',
-            children: [
-              {
-                url: '/bg/build/dir',
-                title: '构建目录',
-                icon: 'el-icon-film'
-              },
-              {
-                url: '/bg/build/repo_auth',
-                title: '仓库认证',
-                icon: 'el-icon-film'
-              },
-              {
-                url: '/bg/build/compiler',
-                title: '编译器',
-                icon: 'el-icon-film'
-              },
-              {
-                url: '/bg/build/docker_registry',
-                title: 'docker 仓库',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/build/packer',
-                title: '应用打包',
-                icon: 'el-icon-files'
-              }
-            ]
-          },
-          {
-            url: '/bg/app',
-            title: '应用',
-            icon: 'el-icon-files',
-            children: [
-              {
-                url: '/bg/app/config',
-                title: '应用配置',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/app/bd',
-                title: '构建部署',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/app/stat',
-                title: '运行状态',
-                icon: 'el-icon-files'
-              }
-            ]
-          },
-          {
-            url: '/bg/sys',
-            title: '系统',
-            icon: 'el-icon-user-solid',
-            children: [
-              {
-                url: '/bg/sys/site',
-                title: '站点配置',
-                icon: 'el-icon-user-solid'
-              },
-              {
-                url: '/bg/sys/webhook',
-                title: 'webhook通知',
-                icon: 'el-icon-user-solid'
-              }/*,
-            {
-              url: '/bg/sys/access_log',
-              title: '访问日志',
-              icon: 'el-icon-user-solid'
-            },
-            {
-              url: '/bg/sys/runtime_log',
-              title: '运行日志',
-              icon: 'el-icon-user-solid'
-            },
-            {
-              url: '/bg/sys/realtime_log',
-              title: '实时日志',
-              icon: 'el-icon-user-solid'
-            }*/
-            ]
-          },
-          {
-            url: '/bg/rbac',
-            title: 'RBAC',
-            icon: 'el-icon-loading',
-            children: [
-              {
-                url: '/bg/rbac/menu',
-                title: '资源管理',
-                icon: 'el-icon-loading'
-              },
-              {
-                url: '/bg/rbac/role',
-                title: '角色管理',
-                icon: 'el-icon-loading'
-              },
-              {
-                url: '/bg/rbac/user',
-                title: '用户管理',
-                icon: 'el-icon-loading'
-              }
-            ]
-          }
-        ]
-      } else {
-        this.menuList = [
-          {
-            url: '/bg/account',
-            title: '我的帐号',
-            icon: 'el-icon-user',
-            children: [
-              {
-                url: '/bg/account/profile',
-                title: '个人资料',
-                icon: 'el-icon-user'
-              },
-              {
-                url: '/bg/account/record',
-                title: '登入记录',
-                icon: 'el-icon-user'
-              },
-              {
-                url: '/bg/account/oauth',
-                title: 'OAuth应用',
-                icon: 'el-icon-user'
-              }
-            ]
-          },
-          {
-            url: '/bg/my',
-            title: '我的',
-            icon: 'el-icon-s-data',
-            children: [
-              {
-                url: '/bg/my/message',
-                title: '我的消息',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/my/wallet',
-                title: '我的钱包',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/my/vip',
-                title: '我的会员',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/my/contact',
-                title: '联系人',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/my/album',
-                title: '收藏夹',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/my/history',
-                title: '历史记录',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/my/rcmd',
-                title: '推荐设置',
-                icon: 'el-icon-s-data'
-              },
-              {
-                url: '/bg/my/device',
-                title: '我的设备',
-                icon: 'el-icon-s-data'
-              }
-            ]
-          },
-          {
-            url: '/bg/post',
-            title: '我的稿件',
-            icon: 'el-icon-film',
-            children: [
-              {
-                url: '/bg/post/video',
-                title: '视频稿件',
-                icon: 'el-icon-film'
-              },
-              {
-                url: '/bg/post/image',
-                title: '相册稿件',
-                icon: 'el-icon-film'
-              },
-              {
-                url: '/bg/post/article',
-                title: '文章稿件',
-                icon: 'el-icon-film'
-              }
-            ]
-          },
-          {
-            url: '/bg/oss',
-            title: '存储系统',
-            icon: 'el-icon-files',
-            children: [
-              {
-                url: '/bg/oss/store_node',
-                title: '存储节点',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/oss/user_node',
-                title: '我的节点',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/oss/upload_channel',
-                title: '上传通道',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/oss/object',
-                title: '对象列表',
-                icon: 'el-icon-files'
-              }
-            ]
-          },
-          {
-            url: '/bg/blog',
-            title: '我的博客',
-            icon: 'el-icon-files',
-            children: [
-              {
-                url: '/bg/blog/category',
-                title: '分类管理',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/blog/post',
-                title: '文章管理',
-                icon: 'el-icon-files'
-              },
-              {
-                url: '/bg/blog/question',
-                title: '面试题',
-                icon: 'el-icon-files'
-              }
-            ]
-          },
-          {
-            url: '/bg/file',
-            title: '我的文件',
-            icon: 'el-icon-setting',
-            children: [
-              {
-                url: '/bg/file/list',
-                title: '文件列表',
-                icon: 'el-icon-setting'
-              },
-              {
-                url: '/bg/file/image',
-                title: '图片列表',
-                icon: 'el-icon-setting'
-              }
-            ]
-          },
-          {
-            url: '/bg/site',
-            title: '站点配置',
-            icon: 'el-icon-setting',
-            children: [
-              /* {
-                url: '/bg/site/store',
-                title: '存储配置',
-                icon: 'el-icon-setting'
-              },*/
-              {
-                url: '/bg/site/notify',
-                title: '通知配置',
-                icon: 'el-icon-setting'
-              },
-              /* {
-                url: '/bg/site/registry',
-                title: '注册配置',
-                icon: 'el-icon-setting'
-              },*/
-              {
-                url: '/bg/site/category',
-                title: '站点分区',
-                icon: 'el-icon-setting'
-              }
-            ]
-          },
-          {
-            url: '/bg/admin',
-            title: '后台管理',
-            icon: 'el-icon-user-solid',
-            children: [
-              {
-                url: '/bg/admin/charge',
-                title: '充值请求',
-                icon: 'el-icon-user-solid'
-              },
-              {
-                url: '/bg/admin/user',
-                title: '用户管理',
-                icon: 'el-icon-user-solid'
-              },
-              {
-                url: '/bg/admin/video',
-                title: '视频管理',
-                icon: 'el-icon-user-solid'
-              },
-              {
-                url: '/bg/admin/avatar',
-                title: '用户头像',
-                icon: 'el-icon-user-solid'
-              }
-            ]
-          },
-          {
-            url: '/bg/backend',
-            title: '后端系统',
-            icon: 'el-icon-loading',
-            children: [
-              {
-                url: '/bg/backend/gateway',
-                title: '网关',
-                icon: 'el-icon-loading'
-              },
-              {
-                url: '/bg/backend/dubbo_service',
-                title: 'Dubbo服务',
-                icon: 'el-icon-loading'
-              },
-              {
-                url: '/bg/backend/springcloud_service',
-                title: 'SpringCloud服务',
-                icon: 'el-icon-loading'
-              },
-              {
-                url: '/bg/backend/access_log',
-                title: '访问日志',
-                icon: 'el-icon-loading'
-              },
-              {
-                url: '/bg/backend/runtime_log',
-                title: '运行日志',
-                icon: 'el-icon-loading'
-              },
-              {
-                url: '/bg/backend/realtime_log',
-                title: '实时日志',
-                icon: 'el-icon-loading'
-              }
-            ]
-          }
-        ]
-      }
-    }
   }
 }
 </script>
@@ -477,18 +72,6 @@ export default {
   text-align: left;
 }
 
-.el-menu-item-group__title {
-  padding: 0px;
-}
-
-.el-menu-bg {
-  background-color: #1f2d3d !important;
-}
-
-.el-menu {
-  border: none;
-}
-
 .logobox {
   height: 40px;
   line-height: 40px;

+ 0 - 15
src/views/devops/Dashboard.vue

@@ -104,7 +104,6 @@
 </template>
 
 <script>
-import store from '@/store'
 import { getDashboard } from '@/api/devops'
 
 export default {
@@ -119,22 +118,8 @@ export default {
   created() {
     document.title = 'Dashboard'
     this.getData()
-    // this.getUserInfo()
   },
   methods: {
-    async getUserInfo() {
-      const hasRoles = store.getters.roles.length > 0
-      if (hasRoles) {
-        console.log('get roles')
-      } else {
-        console.log('no roles')
-      }
-
-      const { roles } = await store.dispatch('getUserInfo')
-      const accessRoutes = await store.dispatch('generateRoutes', roles)
-      console.log(roles)
-      console.log(accessRoutes)
-    },
     getData() {
       if (this.devops) {
         this.getDevopsDashboard()