export default {
    checkedAuthority (authorityMark) {
        let adminUserName = window.sessionStorage.getItem('Admin-Username')
        if (adminUserName === 'root') {
            return true
        } else {
            let authorityMarkList = []
            let authorityList = JSON.parse(window.sessionStorage.getItem('Admin-Authority'))
            if (authorityList && authorityList.length > 0) {
                authorityList.forEach(item => {
                    authorityMarkList.push(item.url)
                    if (item.children !== undefined && item.children !== null) {
                        if (item.children.length > 0) {
                            item.children.forEach(secondItem => {
                                authorityMarkList.push(secondItem.url)
                            })
                        }
                    }
                })
                return authorityMarkList.indexOf(authorityMark) !== -1
            } else {
                return false
            }
        }
    }
}
