From fc4299fed7fc85a6ce1d98800d6857a3b90692c8 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Mon, 05 Feb 2018 08:53:19 +0800 Subject: [PATCH] 优化登录失败处理 --- src/app/app.component.ts | 34 +++++++++++++++++++++++++++++----- 1 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 7b0f672..e8afd42 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,10 +1,34 @@ -import { Component } from '@angular/core'; +import { LoginService } from '@business/services/http/login.service'; +import { Component, HostBinding, OnInit } from '@angular/core'; +import { Router, NavigationEnd } from '@angular/router'; +import { ThemesService, SettingsService, TitleService } from '@delon/theme'; +import { filter, map } from 'rxjs/operators'; @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, + private loginService:LoginService) { + } + + ngOnInit() { + this.router.events.pipe( + filter(evt => evt instanceof NavigationEnd), + map(() => this.router.url) + ) + .subscribe(url => { + this.titleSrv.setTitleByUrl(url); + }); + } } -- Gitblit v1.8.0