export default class AuthDataPool {
|
public buttonAuthority: string;
|
public serverTitle: string;
|
public static isLoginout: boolean = false;
|
public loading: boolean;
|
public loadObj: any;
|
|
constructor() {
|
this.buttonAuthority = sessionStorage.getItem('buttonAuthoritys') || '';
|
this.serverTitle = sessionStorage.getItem('title') || '';
|
this.loading = false;
|
this.loadObj = undefined;
|
}
|
|
isAdmin () {
|
if (
|
sessionStorage.getItem('userInfo') &&
|
sessionStorage.getItem('userInfo') !== ''
|
) {
|
let loginName = JSON.parse(sessionStorage.getItem('userInfo')).username
|
return (
|
loginName === 'basic'
|
)
|
}
|
return false
|
}
|
|
isShow (authority: any) {
|
this.buttonAuthority = sessionStorage.getItem('buttonAuthoritys')
|
if (this.isAdmin()) {
|
return true
|
} else if (
|
this.buttonAuthority.indexOf(',' + authority + ',') > -1
|
) {
|
return true
|
} else {
|
return false
|
}
|
}
|
|
setLoading(domId="routerView",vue:any){
|
// console.log(domId,this.loadObj,'setLoading')
|
if(!this.loadObj){
|
this.loadObj = vue.$loading({
|
target:document.getElementById(domId)
|
})
|
}
|
// console.log(domId,this.loadObj,'setLoading')
|
}
|
|
closeLoad(){
|
if(this.loadObj){
|
this.loadObj.close();
|
this.loadObj = undefined;
|
}
|
}
|
}
|