From 46d4905467aeaf1979613a156753b6625608820b Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Fri, 03 Aug 2018 17:24:02 +0800
Subject: [PATCH] 页面 优化

---
 src/app/app.component.ts |   70 ++++++++++++++++++++++++++++++++--
 1 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 7b0f672..9a6c04d 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,10 +1,70 @@
-import { Component } from '@angular/core';
+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 } from 'rxjs/operators';
+import * as $ from 'jquery';
+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,
+    private loginService: LoginService,
+    @Inject(DA_SERVICE_TOKEN) private tokenService: TokenService) {
+  }
+
+  ngOnInit() {
+    // ������Token������
+    this.tokenService.set({
+      token: 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsIm9pZCI6NSwibW9kZSI6IldlYiIsInNjb3BlcyI6WyJ0ZW1wIl0sImlzcyI6Imh0dHA6Ly9tb25pdG9yLjdkcmxiLmNvbSIsImlhdCI6MTUzMjkxMjY2OSwiZXhwIjoxNTQwNjg4NjY5fQ.nhD_CI4Dd6mU0xWoXlp4qU6yW_P9mjBEWXcidKOujtNelbQF4imVWbleo0tKgYOUWjrYNFjq7neufGYPQW1zrQ',
+      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 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