在github上发现了一个可以管理终端的开源框架,这里给大家分享下,具体网址为:

新建标签页 (github.com)

使用的是golang+vue架构,我们搭环境测试了下,性能不错,废话不多说了,贴图与代码给大家分享下,具体的细节,待分析后再给大家分享

下面这个是终端配置图

再配一点源码,大家看看

import Vue from 'vue'
import Router from 'vue-router'
import store from './store'

import AdminLTE from 'components/AdminLTE.vue'

const Dashboard = () => import(/* webpackChunkName: 'dashboard' */ 'components/Dashboard.vue')
const DeskControl = () => import(/* webpackChunkName: 'deskcontrol' */ 'components/DeskControl.vue')
const CloudeskList = () => import(/* webpackChunkName: 'cloudesks' */ 'components/CloudeskList.vue')
const Windowrecordlist = () => import(/* webpackChunkName: 'windowrecordlist' */ 'components/Windowrecordlist.vue')
const TradideskConfigList = () => import(/* webpackChunkName: 'tradideskconfiglist' */ 'components/TradideskConfigList.vue')
const User = () => import(/* webpackChunkName: 'user' */ 'components/User.vue')
const About = () => import(/* webpackChunkName: 'about' */ 'components/About.vue')

Vue.use(Router);

const router = new Router({
    routes: [
        {
            path: '/',
            component: AdminLTE,
            meta: { needLogin: true },
            children: [
                {
                    path: '',
                    component: Dashboard,
                    props: true
                },
                {
                    path: 'tradideskconf/:page?',
                    component: TradideskConfigList,
                    props: true
                },

                {
                    path: 'cloudesks/:page?',
                    component: CloudeskList,
                    props: true
                },
                {
                    path: '/deskcontrols/:page?',
                    component: DeskControl,
                    props: true
                },

                 {
                    path: 'users/:page?',
                    component: User,
                    props: true
                },
                {
                    path: 'windowrecordlist/:user/:virname/:day?',
                    component: Windowrecordlist,
                    props: true
                },
                {
                    path: 'about',
                    component: About
                }, {
                    path: 'logout',
                    async beforeEnter(to, from, next) {
                      await store.dispatch("logout");
                      window.location.href = `/login.html`;
                    }
                }, {
                    path: '*',
                    redirect: '/'
                }
            ]
        }
    ],
    linkActiveClass: 'active'
})

router.beforeEach(async (to, from, next) => {
    var userInfo = await store.dispatch("getUserInfo");
    if (!userInfo) {
        if (to.matched.some((record => {
            return record.meta.needLogin || record.meta.role;
        }))) {
            window.location.href = '/login.html';
            return;
        }
    } else {
        var roles = userInfo.roles||[];
        var menus = store.state.menus.reduce((pval, cval) => {
            pval[cval.path] = cval;
            return pval;
        },{})
        var _roles = [];
        var menu = menus[to.path];
        if(menu) {
            _roles.push(...(menu.roles||[]));
        }
        if(_roles.length > 0 && !_roles.some(val => {
            return roles.indexOf(val) >= 0;
        })) {
            return;
        }
    }
    next();
})

export default router;
 

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐