Browse Source

菜单管理

beijing
陈鹏飞 3 years ago
parent
commit
134871d592
  1. 33
      src/app/system-management/navigation/navigation.component.ts

33
src/app/system-management/navigation/navigation.component.ts

@ -9,14 +9,41 @@ import { Router } from '@angular/router';
export class NavigationComponent implements OnInit { export class NavigationComponent implements OnInit {
constructor(private router: Router) { } constructor(private router: Router) { }
userMenu=[]
menu=[]
tap=[]
menuList1=[]
menu1 = [
{ name: '首页', url: '/homepage' },
{ name: '数字油站', url: '/plan' },
{ name: '今日预警', url: '/todaywarning' },
{ name: '预警记录', url: '/records_nav' },
{ name: '证照管理', url: '/audit' },
]
ngOnInit(): void { ngOnInit(): void {
let a= sessionStorage.getItem('userdata')
this.userMenu=JSON.parse(a).menus
for (let index = 0; index < this.userMenu.length; index++) {
let a=this.userMenu[index].name
this.tap.push(a)
}
for (let index = 0; index < this.menu1.length; index++) {
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k]==this.menu1[index].name) {
this.menuList1.push(this.menu1[index])
}
}
console.log(this.menuList1);
}
} }
signOut() { signOut() {
this.router.navigate(['/login']) this.router.navigate(['/login'])
} }
pages() { pages() {
sessionStorage.setItem('selectedMenu', '数字油站') sessionStorage.setItem('selectedMenu', this.menuList1[0].name)
this.router.navigate(['/plan']) this.router.navigate([this.menuList1[0].url])
} }
} }

Loading…
Cancel
Save