中化加油站项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

import { Component, OnInit } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { Title } from '@angular/platform-browser'
import { filter } from 'rxjs/operators';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
constructor(private router: Router) { }
isGasStationNav: boolean
isGasStation: boolean
isWarning: boolean = false//是否是今日预警页面
ngOnInit(): void {
if(sessionStorage.getItem('isGasStation') == 'true'){
this.isGasStationNav = true
}else{
this.isGasStationNav = false
}
this.router.events.pipe(
filter(event => event instanceof NavigationEnd)
).subscribe((event: any) => {
if (event.url.indexOf('warning') != -1) {//控制今日预警左上角数字显示
this.isWarning = true
} else {
this.isWarning = false
}
if (event.url.indexOf('petrolStation') != -1 && sessionStorage.getItem('isGasStation') == 'false') {//控制返回按钮显示
this.isGasStation = true
}else{
this.isGasStation = false
}
});
}
goback(){
history.go(-1)
}
}