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.
153 lines
5.3 KiB
153 lines
5.3 KiB
5 years ago
|
import { Component, OnInit,Output,EventEmitter } from '@angular/core';
|
||
|
import { HttpClient } from '@angular/common/http'
|
||
|
import { Router,ActivatedRoute,NavigationEnd } from '@angular/router'
|
||
|
import {CacheTokenService} from '../http-interceptors/cache-token.service'//引入服务
|
||
|
import { MatDialog } from '@angular/material/dialog';
|
||
|
import {ChangepasswordComponent} from '../ui/changepassword/changepassword.component'
|
||
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
||
|
import { filter } from 'rxjs/operators';
|
||
|
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-tabbar',
|
||
|
templateUrl: './tabbar.component.html',
|
||
|
styleUrls: ['./tabbar.component.scss']
|
||
|
})
|
||
|
export class TabbarComponent implements OnInit {
|
||
|
theme: boolean = true;
|
||
|
@Output()
|
||
|
toggle = new EventEmitter<void>();
|
||
|
@Output()
|
||
|
toggleDarkTheme = new EventEmitter<boolean>();
|
||
|
@Output()
|
||
|
defaulttheme = new EventEmitter<boolean>();
|
||
|
@Output()
|
||
|
redtheme = new EventEmitter<boolean>();
|
||
|
|
||
|
onChange(eventValue: boolean){
|
||
|
this.toggleDarkTheme.emit(eventValue);
|
||
|
}
|
||
|
|
||
|
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,public dialog: MatDialog,
|
||
|
public snackBar: MatSnackBar) { }
|
||
|
|
||
|
grade = null //单位完整度得分
|
||
|
title:any = "数字化预案编制管理平台"
|
||
|
planName:any = null
|
||
|
routerEventsListener //监测路由变化
|
||
|
ngOnInit() {
|
||
|
this.grade = this.route.snapshot.queryParams.grade
|
||
|
this.routerEventsListener = this.router.events.pipe(
|
||
|
filter(event => event instanceof NavigationEnd)
|
||
|
).subscribe((e) => {
|
||
|
this.title = "数字化预案编制管理平台"
|
||
|
this.planName = null
|
||
|
this.grade = null
|
||
|
});
|
||
|
this.getUserInfo()
|
||
|
if(this.router.url.indexOf("editunitinfo") != -1 || this.router.url.indexOf("viewunitinfoplan") != -1){//如果url地址是从录入预案跳转
|
||
|
this.title = sessionStorage.getItem("companyName")
|
||
|
this.planName = sessionStorage.getItem("planName")
|
||
|
}
|
||
|
if(this.router.url.indexOf("editplaninfo") != -1 || this.router.url.indexOf("viewunitinfo") != -1){//如果url地址是从重点单位跳转
|
||
|
this.title = sessionStorage.getItem("companyName")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ngOnDestroy(){
|
||
|
this.routerEventsListener.unsubscribe()
|
||
|
}
|
||
|
|
||
|
|
||
|
integrityDetails(width,zong){
|
||
|
let style:any = {}
|
||
|
style.width = (width/zong)*100 +'%';
|
||
|
return style
|
||
|
}
|
||
|
|
||
|
boxed(css){
|
||
|
const Element = document.body;
|
||
|
Element.style.width = '1200px'
|
||
|
}
|
||
|
|
||
|
standard(){
|
||
|
const Element = document.body;
|
||
|
Element.style.width = '100%'
|
||
|
}
|
||
|
|
||
|
isfullscreen:boolean = false;
|
||
|
fullscreenToggle(){
|
||
|
const docElmWithBrowsersFullScreenFunctions = document.documentElement as HTMLElement & {
|
||
|
mozRequestFullScreen(): Promise<void>;
|
||
|
webkitRequestFullscreen(): Promise<void>;
|
||
|
msRequestFullscreen(): Promise<void>;
|
||
|
};
|
||
|
|
||
|
if (docElmWithBrowsersFullScreenFunctions.requestFullscreen) {
|
||
|
docElmWithBrowsersFullScreenFunctions.requestFullscreen();
|
||
|
} else if (docElmWithBrowsersFullScreenFunctions.mozRequestFullScreen) { /* Firefox */
|
||
|
docElmWithBrowsersFullScreenFunctions.mozRequestFullScreen();
|
||
|
} else if (docElmWithBrowsersFullScreenFunctions.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
|
||
|
docElmWithBrowsersFullScreenFunctions.webkitRequestFullscreen();
|
||
|
} else if (docElmWithBrowsersFullScreenFunctions.msRequestFullscreen) { /* IE/Edge */
|
||
|
docElmWithBrowsersFullScreenFunctions.msRequestFullscreen();
|
||
|
}
|
||
|
|
||
|
this.isfullscreen = true;
|
||
|
|
||
|
}
|
||
|
closefullscreen(){
|
||
|
const docWithBrowsersExitFunctions = document as Document & {
|
||
|
mozCancelFullScreen(): Promise<void>;
|
||
|
webkitExitFullscreen(): Promise<void>;
|
||
|
msExitFullscreen(): Promise<void>;
|
||
|
};
|
||
|
if (docWithBrowsersExitFunctions.exitFullscreen) {
|
||
|
docWithBrowsersExitFunctions.exitFullscreen();
|
||
|
} else if (docWithBrowsersExitFunctions.mozCancelFullScreen) { /* Firefox */
|
||
|
docWithBrowsersExitFunctions.mozCancelFullScreen();
|
||
|
} else if (docWithBrowsersExitFunctions.webkitExitFullscreen) { /* Chrome, Safari and Opera */
|
||
|
docWithBrowsersExitFunctions.webkitExitFullscreen();
|
||
|
} else if (docWithBrowsersExitFunctions.msExitFullscreen) { /* IE/Edge */
|
||
|
docWithBrowsersExitFunctions.msExitFullscreen();
|
||
|
}
|
||
|
this.isfullscreen = false;
|
||
|
}
|
||
|
|
||
|
realName:any; //登录用户信息
|
||
|
//获取用户信息
|
||
|
getUserInfo () {
|
||
|
this.http.get("/api/Account/Profiles").subscribe((data:any)=>{
|
||
|
this.realName = data.realName
|
||
|
})
|
||
|
}
|
||
|
|
||
|
//退出系统
|
||
|
signOut = () => {
|
||
|
let out = confirm("您确定要退出吗")
|
||
|
if(out) {
|
||
|
this.http.post('/api/Account/SignOut',{}).subscribe(
|
||
|
data=> {
|
||
|
this.token.delete()
|
||
|
sessionStorage.clear()
|
||
|
window.localStorage.clear()
|
||
|
this.router.navigate(['/login'])
|
||
|
const config = new MatSnackBarConfig();
|
||
|
config.verticalPosition = 'bottom';
|
||
|
config.duration = 3000
|
||
|
this.snackBar.open('成功退出','确定',config);
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//修改密码
|
||
|
changpsw() {
|
||
|
let dialogRef = this.dialog.open(ChangepasswordComponent,
|
||
|
{width:'348px'});
|
||
|
|
||
|
dialogRef.afterClosed().subscribe();
|
||
|
}
|
||
|
|
||
|
}
|