|
@@ -53,6 +53,7 @@ import Logo from "./Logo";
|
|
import SidebarItem from "./SidebarItem";
|
|
import SidebarItem from "./SidebarItem";
|
|
import variables from "@/styles/variables.scss";
|
|
import variables from "@/styles/variables.scss";
|
|
import Hamburger from "@/components/Hamburger";
|
|
import Hamburger from "@/components/Hamburger";
|
|
|
|
+import {getUserRights} from "@/api/user";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -60,13 +61,20 @@ export default {
|
|
Logo,
|
|
Logo,
|
|
Hamburger,
|
|
Hamburger,
|
|
},
|
|
},
|
|
|
|
+ data(){
|
|
|
|
+ return {
|
|
|
|
+ routes:[]
|
|
|
|
+ }
|
|
|
|
+ },
|
|
computed: {
|
|
computed: {
|
|
...mapGetters(["sidebar"]),
|
|
...mapGetters(["sidebar"]),
|
|
- routes() {
|
|
|
|
- return this.$router.options.routes;
|
|
|
|
- },
|
|
|
|
|
|
+ // routes() {
|
|
|
|
+ // console.log(this.$router.options.routes);
|
|
|
|
+ // return this.$router.options.routes;
|
|
|
|
+ // },
|
|
activeMenu() {
|
|
activeMenu() {
|
|
const route = this.$route;
|
|
const route = this.$route;
|
|
|
|
+
|
|
const { meta, path } = route;
|
|
const { meta, path } = route;
|
|
// if set path, the sidebar will highlight the path you set
|
|
// if set path, the sidebar will highlight the path you set
|
|
if (meta.activeMenu) {
|
|
if (meta.activeMenu) {
|
|
@@ -84,10 +92,77 @@ export default {
|
|
return !this.sidebar.opened;
|
|
return !this.sidebar.opened;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ beforeMount() {
|
|
|
|
+ this.getRightsInfo()
|
|
|
|
+ },
|
|
|
|
+
|
|
methods: {
|
|
methods: {
|
|
toggleSideBar() {
|
|
toggleSideBar() {
|
|
this.$store.dispatch("app/toggleSideBar");
|
|
this.$store.dispatch("app/toggleSideBar");
|
|
},
|
|
},
|
|
|
|
+ // 690f84fec2374880b922d62e614245ea 数据看板
|
|
|
|
+ // 2caf11b463de4eeeaaa1f42c7f443270 用户管理
|
|
|
|
+ // 5501cc476bc14e63ae6de0e8515d1f99 系统参数
|
|
|
|
+ // c05b49809dbe45f6a18695b7aef4558b 任务管理
|
|
|
|
+ // 0c78a0fff4bd47bd9fef257f03f6410a 项目管理
|
|
|
|
+ // 4bf360eec98e432992019426ed430800 地址管理
|
|
|
|
+
|
|
|
|
+ // a9b295e9bbcc4a8580b8932589612442 编辑任务
|
|
|
|
+ // c3b727c313e24e21b720ccbbc229395f 新增任务
|
|
|
|
+ getRightsInfo() {
|
|
|
|
+ let Arr = ['690f84fec2374880b922d62e614245ea','2caf11b463de4eeeaaa1f42c7f443270',
|
|
|
|
+ '5501cc476bc14e63ae6de0e8515d1f99','c05b49809dbe45f6a18695b7aef4558b','0c78a0fff4bd47bd9fef257f03f6410a',
|
|
|
|
+ '4bf360eec98e432992019426ed430800','a9b295e9bbcc4a8580b8932589612442','c3b727c313e24e21b720ccbbc229395f']
|
|
|
|
+ getUserRights().then(res=>{
|
|
|
|
+ console.log(res);
|
|
|
|
+ console.log(this.$router.options.routes);
|
|
|
|
+ let showRoutes = this.$router.options.routes
|
|
|
|
+ Arr.forEach((item,index)=>{
|
|
|
|
+ let result = res.includes(item)
|
|
|
|
+ if(!result){
|
|
|
|
+ if(index === 0) {
|
|
|
|
+ let inx = showRoutes.findIndex(el=>{
|
|
|
|
+ return el.path === '/'
|
|
|
|
+ })
|
|
|
|
+ showRoutes.splice(inx,1)
|
|
|
|
+ }else if (index === 1){
|
|
|
|
+ let inx = showRoutes.findIndex(el=>{
|
|
|
|
+ return el.path === '/user'
|
|
|
|
+ })
|
|
|
|
+ showRoutes.splice(inx,1)
|
|
|
|
+ }else if (index === 2){
|
|
|
|
+ let inx = showRoutes.findIndex(el=>{
|
|
|
|
+ return el.path === '/sys-param'
|
|
|
|
+ })
|
|
|
|
+ showRoutes.splice(inx,1)
|
|
|
|
+ }else if (index === 3){
|
|
|
|
+ let inx = showRoutes.findIndex(el=>{
|
|
|
|
+ return el.path === '/autoplay'
|
|
|
|
+ })
|
|
|
|
+ showRoutes.splice(inx,1)
|
|
|
|
+ }else if (index === 4){
|
|
|
|
+ let inx = showRoutes.findIndex(el=>{
|
|
|
|
+ return el.path === '/airdrop'
|
|
|
|
+ })
|
|
|
|
+ showRoutes.splice(inx,1)
|
|
|
|
+ }else if (index === 5){
|
|
|
|
+ let inx = showRoutes.findIndex(el=>{
|
|
|
|
+ return el.path === '/address'
|
|
|
|
+ })
|
|
|
|
+ showRoutes.splice(inx,1)
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if (index === 6){
|
|
|
|
+ this.$store.commit('changeEditTask')
|
|
|
|
+ }else if (index === 7){
|
|
|
|
+ this.$store.commit('changeAddTask')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.routes = showRoutes
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|