终端上网行为管理开源框架(上网行为管理部署)

网友投稿 482 2022-10-02


终端上网行为管理开源框架(上网行为管理部署)

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

​​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({undefined

routes: [

{undefined

path: '/',

component: AdminLTE,

meta: { needLogin: true },

children: [

{undefined

path: '',

component: Dashboard,

props: true

},

{undefined

path: 'tradideskconf/:page?',

component: TradideskConfigList,

props: true

},

{undefined

path: 'cloudesks/:page?',

component: CloudeskList,

props: true

},

{undefined

path: '/deskcontrols/:page?',

component: DeskControl,

props: true

},

{undefined

path: 'users/:page?',

component: User,

props: true

},

{undefined

path: 'windowrecordlist/:user/:virname/:day?',

component: Windowrecordlist,

props: true

},

{undefined

path: 'about',

component: About

}, {undefined

path: 'logout',

async beforeEnter(to, from, next) {undefined

await store.dispatch("logout");

window.location.href = `/login.html`;

}

}, {undefined

path: '*',

redirect: '/'

}

]

}

],

linkActiveClass: 'active'

})

router.beforeEach(async (to, from, next) => {undefined

var userInfo = await store.dispatch("getUserInfo");

if (!userInfo) {undefined

if (to.matched.some((record => {undefined

return record.meta.needLogin || record.meta.role;

}))) {undefined

window.location.href = '/login.html';

return;

}

} else {undefined

var roles = userInfo.roles||[];

var menus = store.state.menus.reduce((pval, cval) => {undefined

pval[cval.path] = cval;

return pval;

},{})

var _roles = [];

var menu = menus[to.path];

if(menu) {undefined

_roles.push(...(menu.roles||[]));

}

if(_roles.length > 0 && !_roles.some(val => {undefined

return roles.indexOf(val) >= 0;

})) {undefined

return;

}

}

next();

})


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:10大网络安全攻击手段及防御方法(二)!(防范网络攻击最常用的方法)
下一篇:SpringBoot配置加载,各配置文件优先级对比方式
相关文章

 发表评论

暂时没有评论,来抢沙发吧~