page-home.component.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { Component, OnInit } from '@angular/core';
  2. import { CompNavComponent } from '../../../app/comp-nav/comp-nav.component'
  3. import { RouterOutlet, Router } from '@angular/router';
  4. import { CommonCompModule } from '../../../services/common.modules'
  5. @Component({
  6. selector: 'app-page-home',
  7. standalone: true,
  8. imports: [CompNavComponent,RouterOutlet,CommonCompModule],
  9. templateUrl: './page-home.component.html',
  10. styleUrls: ['./page-home.component.scss'],
  11. })
  12. export class PageHomeComponent implements OnInit {
  13. options:Array<any> = [
  14. {
  15. name:'教材管理',
  16. id:'1',
  17. child:[
  18. {
  19. name:'报送合集',
  20. id:'1-1',
  21. },
  22. {
  23. name:'全部材料',
  24. id:'1-2',
  25. },
  26. ]
  27. },
  28. {
  29. name:'用户管理',
  30. id:'2',
  31. child:[
  32. {
  33. name:'用户审核',
  34. id:'2-1',
  35. },
  36. {
  37. name:'注册账户',
  38. path:"/nav-admin/manage/user",
  39. id:'2-2',
  40. },
  41. {
  42. name:'用户组管理',
  43. path:"/nav-admin/manage/role",
  44. id:'2-3',
  45. },
  46. ]
  47. },
  48. {
  49. name:'品牌化',
  50. id:'3',
  51. child:[
  52. {
  53. name:'登录框',
  54. id:'3-1',
  55. },
  56. {
  57. name:'消息设置',
  58. id:'3-2',
  59. },
  60. ]
  61. },
  62. {
  63. name:'字段管理',
  64. id:'4',
  65. },
  66. ]
  67. active:string = localStorage.getItem('active') || this.options[0].id
  68. constructor(
  69. public router: Router,
  70. ) { }
  71. ngOnInit() {}
  72. toUrl(child: any) {
  73. let cateid = child.id;
  74. this.active = cateid;
  75. localStorage.setItem('active', cateid);
  76. console.log(child);
  77. if (child.params) {
  78. this.router.navigate([child.path, child?.params]);
  79. } else {
  80. this.router.navigate([child.path]);
  81. }
  82. }
  83. }