ZZJ
2022-07-18 65752fcffafa02c5f646d0a6207c85bf81284b73
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
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;
    }
  }
}