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 }