From 4b35f9a98f9431e17fc96d998c7cc9021776787b Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Thu, 12 Jul 2018 11:50:24 +0800 Subject: [PATCH] 删除多余文件 --- src/app/app.component.ts | 43 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 7b0f672..acc7507 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,10 +1,43 @@ -import { Component } from '@angular/core'; +import { Component, HostBinding, OnInit, Inject } from '@angular/core'; +import { Router, NavigationEnd } from '@angular/router'; +import { ThemesService, SettingsService, TitleService } from '@delon/theme'; +import { filter, map } from 'rxjs/operators'; +import { TokenService, DA_SERVICE_TOKEN } from '@delon/auth'; @Component({ selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] + template: `<router-outlet></router-outlet>` }) -export class AppComponent { - title = 'app'; +export class AppComponent implements OnInit { + + @HostBinding('class.layout-fixed') get isFixed() { return this.settings.layout.fixed; } + @HostBinding('class.layout-boxed') get isBoxed() { return this.settings.layout.boxed; } + @HostBinding('class.aside-collapsed') get isCollapsed() { return this.settings.layout.collapsed; } + + constructor( + private theme: ThemesService, + private settings: SettingsService, + private router: Router, + private titleSrv: TitleService, + @Inject(DA_SERVICE_TOKEN) private tokenService: TokenService, + ) { + } + + ngOnInit() { + // ������Token������ + this.tokenService.set({ + token: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsIm9pZCI6NSwibW9kZSI6IldlYiIsInNjb3BlcyI6WyJ0ZW1wIl0sImlzcyI6Imh0dHA6Ly9tb25pdG9yLjdkcmxiLmNvbSIsImlhdCI6MTUzMTMxNjU4MCwiZXhwIjoxNTM5MDkyNTgwfQ.tWE7AqGfLwwK-nO1FUveJ8xKqpxitqG1GdhKHp9JDyRPjNDYX7ocgkEw0W2G8hKL_tJIjjrQ1pc0zvCmLTJ-pg', + name: 'admin', + email: `admin@qq.com`, + id: 10000, + time: +new Date(), + }); + this.router.events.pipe( + filter(evt => evt instanceof NavigationEnd), + map(() => this.router.url) + ) + .subscribe(url => { + this.titleSrv.setTitleByUrl(url); + }); + } } -- Gitblit v1.8.0