feat(dashboard): getRoles改为promise

This commit is contained in:
woody 2025-05-13 10:47:07 +08:00
parent a028c90cf2
commit c50e06ad7d
2 changed files with 21 additions and 14 deletions

View File

@ -148,11 +148,13 @@ export default {
}
},
mounted() {
this.getRoles().then(() => {
this.getMemberSummary()
this.getDailyPerformance()
this.getMonthlyPerformance()
this.getApprovalStatus()
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
})
},
methods: {
getMemberSummary() {

View File

@ -52,16 +52,21 @@ export default {
})
},
getRoles() {
return new Promise((resolve, reject) => {
getRouters().then((res) => {
this.roleMenu = res.data || []
if (!this.roleMenu.find((item) => item.routeName === 'summaryDashboard')) {
this.topList.splice(0, 1)
if (this.$route.name === 'summaryDashboard') {
if (this.$route.name === 'SummaryDashboard') {
this.$router.replace({
name: 'Dashboard'
})
}
reject()
return
}
resolve()
})
})
}
}