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.

31 lines
748 B

3 years ago
<script>
2 years ago
import { getUserRolesPermissionMenu } from '@/apis/modules/user.js'
3 years ago
export default {
onLaunch: function() {
2 years ago
// 查询当前角色权限
uni.getStorageSync('token') && getUserRolesPermissionMenu({
platformId: 4
}).then(({ permissionMenu }) => {
const auth = []
const generateAuth = (list, parent) => {
list.map(e => {
const name = `${parent ? parent + ':' : ''}${e.name}`
auth.push(name)
generateAuth(e.children, name)
})
}
generateAuth(permissionMenu[0].children, '')
console.log(333, auth)
uni.setStorageSync('auth', auth)
}).catch(e => {})
3 years ago
},
onShow: function() {
3 years ago
}
}
</script>
<style lang="scss">
@import '@/uni_modules/uni-scss/index.scss';
</style>