From 7a59b10298464a186f9984b445836af1d9c4dfad Mon Sep 17 00:00:00 2001 From: woody Date: Mon, 12 May 2025 16:38:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(top-bar-mixin):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/mixins/top-bar-mixin.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/views/dashboard/mixins/top-bar-mixin.js b/src/views/dashboard/mixins/top-bar-mixin.js index c924cca..3c0705a 100644 --- a/src/views/dashboard/mixins/top-bar-mixin.js +++ b/src/views/dashboard/mixins/top-bar-mixin.js @@ -1,5 +1,6 @@ import * as api from '@/api/manage.js' import { mapGetters } from 'vuex' +import { getRouters } from '@/api/settle' export default { data() { return { @@ -31,12 +32,16 @@ export default { // name: '产品审核', // path: 'productCheck', // }, - ] + ], + roleMenu: [] } }, computed: { ...mapGetters(['name', 'user']) }, + created() { + this.getRoles() + }, methods: { getApprovalStatus() { api.waitApprovalNum().then((res) => { @@ -45,6 +50,19 @@ export default { api.receiveApprovalNum().then((res) => { this.receiveApprovalNum = res.data }) + }, + 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' + }) + } + } + }) } } }