博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vue-router 根据路由动态添加目录 控制目录权限
阅读量:5009 次
发布时间:2019-06-12

本文共 5265 字,大约阅读时间需要 17 分钟。

  

import Vue from 'vue'import Router from 'vue-router'import LineSwitch from '@/views/Switch/LineSwitch'import Log from '@/views/Log/Log'import ManualSwitching from '@/views/ManualSwitching/ManualSwitching'import OperatorManagement from '@/views/OperatorManagement/OperatorManagement'import CoreSwitchManagement from '@/views/CoreSwitchManagement/CoreSwitchManagement'import UserManagementofNetworkEquipment from '@/views/UserManagementofNetworkEquipment/UserManagementofNetworkEquipment'import AboutUS from '@/views/AboutUS/AboutUS'Vue.use(Router)export default new Router({  routes: [    {      path: '/',      name: 'LS',      component: LineSwitch,      meta: {        menuShow: true,          // 是否在导航栏中显示        menuName: '线路切换',     // 导航栏中显示的名称        ClassName:'el-icon-extendedicon-' //导航栏中显示的图标      },    },    {      path:'/ManualSwitching',      name:'ManualSwitching',      component:ManualSwitching,      meta: {        menuShow: true,          // 是否在导航栏中显示        menuName: '手动切换',     // 导航栏中显示的名称        ClassName:'el-icon-extendedbackup-hm' //导航栏中显示的图标      },    },{      path:'/OperatorManagement',      name:'OperatorManagement',      component:OperatorManagement,      meta: {        menuShow: true,          // 是否在导航栏中显示        menuName: '运营商管理',     // 导航栏中显示的名称        ClassName:'el-icon-extendedjizhanxinhao' //导航栏中显示的图标      },    },{      path:'/UserManagementofNetworkEquipment',      name:'UserManagementofNetworkEquipment',      component:UserManagementofNetworkEquipment,      meta: {        menuShow: true,          // 是否在导航栏中显示        menuName: '网络设备用户管理',     // 导航栏中显示的名称        ClassName:'el-icon-extendedquanxianguanli' //导航栏中显示的图标        },    },{      path:'/CoreSwitchManagement',      name:'CoreSwitchManagement',      component:CoreSwitchManagement,      meta: {        menuShow: true,          // 是否在导航栏中显示        menuName: '核心交换机管理',     // 导航栏中显示的名称        ClassName:'el-icon-extendedhexinjiaohuanji' //导航栏中显示的图标        },    },{      path:'/SwitchLogfile',      name:'Log',      component:Log,      meta: {        menuShow: true,          // 是否在导航栏中显示        menuName: '切换日志',     // 导航栏中显示的名称        ClassName:'el-icon-extendedrizhi' //导航栏中显示的图标      },    },{      path:'/AboutUS',      name:'AboutUS',      component:AboutUS,      meta: {        menuShow: true,          // 是否在导航栏中显示        menuName: '关于我们',     // 导航栏中显示的名称        ClassName:'el-icon-extendedicon-test' //导航栏中显示的图标      },    }  ]})

  

import Vue from 'vue';import Vuex from 'vuex';Vue.use(Vuex);  const state={//要设置的全局访问的state对象    UserInfo:{      user_name:'',      user_account:'000',      disabled:''    },    //要设置的初始属性值  };  const getters = {    ShowUserName(state){      return state.UserInfo.user_name    },    ShowUserAccount(state){      return state.UserInfo.user_account    },    ShowUserDisabled(state){      return state.UserInfo.disabled    },  };  const mutations = {      SetUserAccount(state,user_account){        state.UserInfo.user_account=user_account;      },      SetUserName(state,user_name) {        state.UserInfo.user_name = user_name;      },      SetUserDisabledFalse(state) {          state.UserInfo.disabled = false;      },      SetUserDisabledTrue(state) {          state.UserInfo.disabled = true;      }};  const store = new Vuex.Store({    state,    getters,    mutations  });export default store;

  

// The Vue build version to load with the `import` command// (runtime-only or standalone) has been set in webpack.base.conf with an alias.import Vue from 'vue'import App from './App'import router from './router'import ElementUI from 'element-ui'import 'element-ui/lib/theme-chalk/index.css'import '../static/icons/iconfont.css'//*********************************************************************************// // axios 设置import axiosAPI from '@/api/axios.js'Vue.use(axiosAPI)//*********************************************************************************Vue.use(ElementUI);Vue.config.productionTip = false;/* eslint-disable no-new */import store from './store/index.js'new Vue({  el: '#app',  store,  router,  components: {App},  template: '
', created() { this.GetUserInfo() }, methods: { //获取用户信息 判断是否有手动切换的权限 //****************************************************************************************************** GetUserInfo() { this.getuserinfo({}) .then(response => { let bk_username=response.data.bk_username; if ( bk_username && ( bk_username == '01379233' || bk_username=='01377338' ||bk_username== '338440')){ this.$store.commit('SetUserDisabledFalse'); }else{ this.$store.commit('SetUserDisabledTrue'); } this.$store.commit('SetUserName', response.data.chname); this.$store.commit('SetUserAccount', response.data.bk_username); // console.log(this.$store.getters.ShowUserAccount) }) .catch(error => { }); } //****************************************************************************************************** }});

  

参考文章 

转载于:https://www.cnblogs.com/randomlee/p/10520573.html

你可能感兴趣的文章
Reorder List
查看>>
c 宏的定义
查看>>
log
查看>>
663 如何做“低端”产品?(如何把低端做得高端 - 认同感)
查看>>
JDBC 第九课 —— 初次接触 JUnit
查看>>
Windows核心编程:第10章 同步设备IO与异步设备IO
查看>>
浏览器加载、解析、渲染的过程
查看>>
Redis-cli 命令总结
查看>>
【NOIP 模拟赛】改造二叉树 最长上升子序列
查看>>
【BZOJ 4556】[Tjoi2016&Heoi2016]字符串 SAM+二分+主席树
查看>>
带参数的方法
查看>>
高精度阶乘
查看>>
冲刺6
查看>>
第二次实训作业
查看>>
【转】让学习体系化,造福一大波上进青年
查看>>
Git使用二:git与svn的区别与工作流程
查看>>
python接口自动化(五)--接口测试用例和接口测试报告模板(详解)
查看>>
SpringMvc之java文件下载
查看>>
jsp关闭或刷新浏览器(解决浏览器不兼容),请求后台onbeforeunload、onunload
查看>>
关于Java基础
查看>>