heyujie
2022-07-29 90427ad7b5e73aaee2eb376080547787d25dc2bb
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
import AuthData from './Pool/AuthData';
 
/* eslint-disable */
const onlyAuthData = new AuthData
 
 
// 定义全局状态信息
const state = {
    projectName: 'school_district_center',
    menuName: 'ACTION', // 菜单模块 module(默认为空查全部) SYSTEM 系统管理, VISITOR 进出入管理, CHECK 学区安全上报
    loading: false,
    isLoginout: false,
    userInfo: null
}
 
const mixin = {
    data() {
        return {
            AuthData: onlyAuthData,
            guid: 1,
            state: state,
            buttonAuthority: sessionStorage.getItem("userInfo") || ""
        };
    },
    computed: {
        isAdmin() {
            if (
                sessionStorage.getItem("userInfo") &&
                sessionStorage.getItem("userInfo") !== ""
            ) {
                let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
                return loginName === "superadmin" || loginName === "basic";
            }
 
            return false;
        },
 
        isMember() {
            let permissions = JSON.parse(this.buttonAuthority).permissions;
            return !permissions.length
        }
    },
    methods: {
        isShow(authority) {
            if (this.isAdmin) {
                return true
            } else if (
                this.buttonAuthority.indexOf(authority) > -1
            ) {
                return true
            }
            return false
        }
    }
};
export default mixin;