From f261411d5b1e9f0af4d367dfb1bcb85c0d5e7b0d Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 22 Mar 2022 18:02:44 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-1667=20fix=EF=BC=9A=20=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E8=BF=94=E5=9B=9E=E9=94=AE=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=95=8C=E9=9D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/permission.js | 9 ++++++++- nezha-fronted/src/store/index.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nezha-fronted/src/permission.js b/nezha-fronted/src/permission.js index cc3ee03c3..8edea6941 100644 --- a/nezha-fronted/src/permission.js +++ b/nezha-fronted/src/permission.js @@ -11,6 +11,10 @@ Vue.use(VueResource) const loginWhiteList = ['/setup', '/sys/license/upload', '/sys/license/state', '/sys/appearance'] // 免登陆白名单 const permissionWhiteList = ['/profile', '/menu', ...loginWhiteList] // 权限白名单 router.beforeEach((to, from, next) => { + if (store.getters.getNowPath == to.path) { + return + } + store.commit('setNowPath', to.path) requestsArr.forEach(xhr => xhr.cancel()) const configUrl = 'static/config.json?Timestamp=' + new Date().getTime() if (to.path === '/login') { // 拦截登录页面,现货区外观设置 再系统初始化检查 @@ -81,7 +85,7 @@ router.beforeEach((to, from, next) => { }) } else { localStorage.setItem('nz-token', '') - next({}) + next() } }) } else { @@ -165,6 +169,9 @@ router.beforeEach((to, from, next) => { } } }) +router.afterEach((to, from) => { + // store.commit('setNowPath', '') +}) // menuList中是否包含route权限 export function hasMenu (menuList, route) { diff --git a/nezha-fronted/src/store/index.js b/nezha-fronted/src/store/index.js index 5889bf33d..628a226c3 100644 --- a/nezha-fronted/src/store/index.js +++ b/nezha-fronted/src/store/index.js @@ -43,7 +43,8 @@ const store = new Vuex.Store({ timeFormatMain: localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss', globalShow: false, globalSearchId: '', - isRouteLive: true + isRouteLive: true, + nowPath: '' }, getters: { getGlobalSearchId (state) { @@ -94,6 +95,9 @@ const store = new Vuex.Store({ getIsRouteLive (state) { return state.isRouteLive }, + getNowPath (state) { + return state.nowPath + }, i18nIsReady (state) { return state.i18nReady } @@ -197,6 +201,9 @@ const store = new Vuex.Store({ state.isRouteLive = true }) }, + setNowPath (state, path) { + state.nowPath = path + }, i18nReady (state, ready) { state.i18nReady = ready }