From 766ea645c6694d597321f75f3fc7404e6cf7d843 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 6 May 2025 18:02:46 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=BB=E5=8A=A1=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E5=8F=AA=E5=AF=B9=E6=9C=89=E6=9D=83=E9=99=90=E8=80=85=E5=8F=AF?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/Navbar.vue | 5 ++++- src/store/modules/user.js | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index f05e41d..fd7f758 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -9,7 +9,7 @@ width="600" trigger="hover"> -
+
{{ $t('app.taskProgress') }}
@@ -112,6 +112,9 @@ export default { routes.rightTopRoutes = rightTopRoutes return routes }, + hasTaskProgressRole() { + return localStorage.getItem('taskProgressRole') === '1' + } }, mounted() { this.isShow = this.$pc; diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 672a750..2380408 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -88,7 +88,16 @@ const actions = { async setMenuList({ commit, state }) { return new Promise( (resolve,reject) => { menuApi.menuTree({userId: state.userId}).then((res) => { + + const index = res.data.findIndex((item) => item.path === '/setting/taskProgress') + if (index > -1) { + localStorage.setItem('taskProgressRole', "1") + } else { + localStorage.removeItem('taskProgressRole') + } + state.menuList = getMenuTree(res.data); + console.log('state.menuList', state.menuList) commit('SET_MENU_LIST', state.menuList); resetRouter(state.menuList) router.options.routes = router.options.routes.concat(state.menuList);