feat(dashboard): getRoles改为promise
This commit is contained in:
parent
a028c90cf2
commit
c50e06ad7d
|
@ -148,11 +148,13 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getMemberSummary()
|
||||
this.getDailyPerformance()
|
||||
this.getMonthlyPerformance()
|
||||
this.getApprovalStatus()
|
||||
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
this.getRoles().then(() => {
|
||||
this.getMemberSummary()
|
||||
this.getDailyPerformance()
|
||||
this.getMonthlyPerformance()
|
||||
this.getApprovalStatus()
|
||||
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getMemberSummary() {
|
||||
|
|
|
@ -52,16 +52,21 @@ export default {
|
|||
})
|
||||
},
|
||||
getRoles() {
|
||||
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') {
|
||||
this.$router.replace({
|
||||
name: 'Dashboard'
|
||||
})
|
||||
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') {
|
||||
this.$router.replace({
|
||||
name: 'Dashboard'
|
||||
})
|
||||
}
|
||||
reject()
|
||||
return
|
||||
}
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue