fengxiang
2018-07-06 309d1f9d649daa08bb9b068af014749f6d4a5bce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { element } from 'protractor';
import { LoginService } from '@business/services/http/login.service';
import { Component, HostBinding, OnInit } 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';
@Component({
  selector: 'app-root',
  template: `<router-outlet></router-outlet>`
})
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))
      .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();
              }
            }
          );
        }
 
      });
  }
}