page-home.component.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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:'5',
  17. // child:[
  18. // {
  19. // name:'教材列表',
  20. // id:'1-1',
  21. // path:"/nav-author/textbook/list"
  22. // }
  23. // ]
  24. // },
  25. {
  26. name:'个人空间',
  27. id:'1',
  28. child:[
  29. {
  30. name:'创建教材',
  31. id:'1-1',
  32. path:"/nav-author/textbook/list"
  33. },
  34. {
  35. name:'教材列表',
  36. id:'1-2',
  37. path:"/nav-author/manage/textbook/list"
  38. },
  39. ]
  40. },
  41. {
  42. name:'回收站',
  43. id:'2',
  44. path:'/nav-author/apply'
  45. },
  46. {
  47. name:'个人信息',
  48. id:'3',
  49. path:"/nav-author/profile"
  50. },
  51. ]
  52. active:string = localStorage.getItem('active') || this.options[0].id
  53. constructor(
  54. public router: Router,
  55. ) { }
  56. ngOnInit() {}
  57. toUrl(child:any){
  58. let cateid = child.id
  59. this.active = cateid
  60. localStorage.setItem('active', cateid)
  61. console.log(child)
  62. child?.path&&this.router.navigateByUrl(child?.path)
  63. }
  64. }