From 7f93b01660cae23d38e9fa8083fe24a952b7ef4c Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Fri, 13 Jul 2018 14:37:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/app/app.component.ts | 58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index c1ba478..105c1b4 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,7 +1,11 @@
-import { Component, HostBinding, OnInit } from '@angular/core';
-import { Router, NavigationEnd } from '@angular/router';
+import { element } from 'protractor';
+import { LoginService } from '@business/services/http/login.service';
+import { Component, HostBinding, OnInit, Inject } from '@angular/core';
+import { Router, NavigationEnd, NavigationStart } from '@angular/router';
import { ThemesService, SettingsService, TitleService } from '@delon/theme';
-import { filter, map } from 'rxjs/operators';
+import { filter } from 'rxjs/operators';
+import * as $ from 'jquery';
+import { TokenService, DA_SERVICE_TOKEN } from '@delon/auth';
@Component({
selector: 'app-root',
@@ -17,16 +21,50 @@
private theme: ThemesService,
private settings: SettingsService,
private router: Router,
- private titleSrv: TitleService) {
+ private titleSrv: TitleService,
+ private loginService: LoginService,
+ @Inject(DA_SERVICE_TOKEN) private tokenService: TokenService) {
}
ngOnInit() {
+ // ������Token������
+ this.tokenService.set({
+ token: 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsIm9pZCI6NSwibW9kZSI6IldlYiIsInNjb3BlcyI6WyJ0ZW1wIl0sImlzcyI6Imh0dHA6Ly9tb25pdG9yLjdkcmxiLmNvbSIsImlhdCI6MTUzMTQ0ODcwMCwiZXhwIjoxNTMyNzQ0NzAwfQ.a2o1-bruQKjgvYDkA4fdhDmqpwJSbqdlKmK5spz5bk_15VvP0TN1rl1j8nQD7bJxgFQerVT3iouYVBXf3zN67A',
+ name: 'admin',
+ email: `admin@qq.com`,
+ id: 10000,
+ time: +new Date(),
+ });
+
+ this.router.events
+ .pipe(filter(evt => evt instanceof NavigationEnd))
+ .subscribe(() => this.titleSrv.setTitle());
this.router.events.pipe(
- filter(evt => evt instanceof NavigationEnd),
- map(() => this.router.url)
- )
- .subscribe(url => {
- this.titleSrv.setTitleByUrl(url);
- });
+ filter(evt => evt instanceof NavigationStart)
+ )
+ .subscribe(() => {
+ // ������������������������
+ if ($('.ant-modal-close').length > 0) {
+ $('.ant-modal-close').click();
+ }
+ // ������������������������
+ if ($('.ant-select-open').length > 0) {
+ $('.ant-select-open').click();
+ }
+ // ���������������������������������
+ const cdkOverlayContainer = $('.cdk-overlay-container');
+ if (cdkOverlayContainer != null && cdkOverlayContainer.children().length > 2) {
+ cdkOverlayContainer.children('div:first-child').next().nextAll().each(
+ function (index, el) {
+ if ($(el).hasClass('cdk-overlay-backdrop-showing')) {
+ $(el).remove();
+ } else {
+ $(el).empty();
+ }
+ }
+ );
+ }
+
+ });
}
}
--
Gitblit v1.8.0