|
@@ -1,18 +1,17 @@
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
-import { CompNavComponent } from '../../../app/comp-nav/comp-nav.component'
|
|
|
+import { CompNavComponent } from '../../../app/comp-nav/comp-nav.component';
|
|
|
import { RouterOutlet, Router } from '@angular/router';
|
|
|
-import { CommonCompModule } from '../../../services/common.modules'
|
|
|
+import { CommonCompModule } from '../../../services/common.modules';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-page-home',
|
|
|
standalone: true,
|
|
|
- imports: [CompNavComponent,RouterOutlet,CommonCompModule],
|
|
|
+ imports: [CompNavComponent, RouterOutlet, CommonCompModule],
|
|
|
templateUrl: './page-home.component.html',
|
|
|
styleUrls: ['./page-home.component.scss'],
|
|
|
})
|
|
|
-export class PageHomeComponent implements OnInit {
|
|
|
-
|
|
|
- options:Array<any> = [
|
|
|
+export class PageHomeComponent implements OnInit {
|
|
|
+ options: Array<any> = [
|
|
|
// {
|
|
|
// name:'教材管理',
|
|
|
// id:'5',
|
|
@@ -25,46 +24,48 @@ export class PageHomeComponent implements OnInit {
|
|
|
// ]
|
|
|
// },
|
|
|
{
|
|
|
- name:'个人空间',
|
|
|
- id:'1',
|
|
|
- child:[
|
|
|
+ name: '个人空间',
|
|
|
+ id: '1',
|
|
|
+ child: [
|
|
|
{
|
|
|
- name:'创建教材',
|
|
|
- id:'1-1',
|
|
|
- path:"/nav-author/manage/apply"
|
|
|
+ name: '创建教材',
|
|
|
+ id: '1-1',
|
|
|
+ path: '/nav-author/manage/apply',
|
|
|
},
|
|
|
{
|
|
|
- name:'教材列表',
|
|
|
- id:'1-2',
|
|
|
- path:"/nav-author/manage/textbook",
|
|
|
+ name: '教材列表',
|
|
|
+ id: '1-2',
|
|
|
+ path: '/nav-author/manage/textbook',
|
|
|
},
|
|
|
- ]
|
|
|
+ ],
|
|
|
},
|
|
|
{
|
|
|
- name:'回收站',
|
|
|
- id:'2',
|
|
|
- path:'/nav-author/manage/textbook',
|
|
|
- params:{
|
|
|
- isDeleted:true
|
|
|
- }
|
|
|
+ name: '回收站',
|
|
|
+ id: '2',
|
|
|
+ path: '/nav-author/manage/textbook',
|
|
|
+ params: {
|
|
|
+ isDeleted: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- name:'个人信息',
|
|
|
- id:'3',
|
|
|
- path:"/nav-author/profile"
|
|
|
+ name: '个人信息',
|
|
|
+ id: '3',
|
|
|
+ path: '/nav-author/profile',
|
|
|
},
|
|
|
- ]
|
|
|
- active:string = localStorage.getItem('active') || this.options[0].id
|
|
|
- constructor(
|
|
|
- public router: Router,
|
|
|
- ) { }
|
|
|
+ ];
|
|
|
+ active: string = localStorage.getItem('active') || this.options[0].id;
|
|
|
+ constructor(public router: Router) {}
|
|
|
|
|
|
ngOnInit() {}
|
|
|
- toUrl(child:any){
|
|
|
- let cateid = child.id
|
|
|
- this.active = cateid
|
|
|
- localStorage.setItem('active', cateid)
|
|
|
- console.log(child)
|
|
|
- child?.path&&this.router.navigateByUrl(child?.path)
|
|
|
+ toUrl(child: any) {
|
|
|
+ let cateid = child.id;
|
|
|
+ this.active = cateid;
|
|
|
+ localStorage.setItem('active', cateid);
|
|
|
+ console.log(child);
|
|
|
+ if (child.params) {
|
|
|
+ this.router.navigate([child.path, child?.params]);
|
|
|
+ } else {
|
|
|
+ this.router.navigate([child.path]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|