From c2d3969ac76de8a6efd5218d8527d90b735e829f Mon Sep 17 00:00:00 2001 From: "zhigang.li@tendcloud.com" Date: Thu, 18 Oct 2018 14:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=AF=E5=8A=A8=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=90=8E=E7=99=BD=E5=B1=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/main/components/side-menu/side-menu.vue | 2 +- src/components/main/main.vue | 5 ++--- src/router/index.js | 4 +++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/main/components/side-menu/side-menu.vue b/src/components/main/components/side-menu/side-menu.vue index e3144458a..6cb611e26 100644 --- a/src/components/main/components/side-menu/side-menu.vue +++ b/src/components/main/components/side-menu/side-menu.vue @@ -81,7 +81,7 @@ export default { return this.$route.matched.map(item => item.name).filter(item => item !== name) }, updateOpenName (name) { - if (name === 'home') this.openedNames = [] + if (name === this.$config.homeName) this.openedNames = [] else this.openedNames = this.getOpenedNamesByActiveName(name) } }, diff --git a/src/components/main/main.vue b/src/components/main/main.vue index e44b1441f..18b56e361 100644 --- a/src/components/main/main.vue +++ b/src/components/main/main.vue @@ -124,10 +124,9 @@ export default { }, handleCloseTag (res, type, route) { if (type === 'all') { - this.turnToPage('home') + this.turnToPage(this.$config.homeName) } else if (routeEqual(this.$route, route)) { - if (type === 'others') { - } else { + if (type !== 'others') { const nextRoute = getNextRoute(this.tagNavList, route) this.$router.push(nextRoute) } diff --git a/src/router/index.js b/src/router/index.js index 8c1c11433..ba7f4c440 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,7 +3,7 @@ import Router from 'vue-router' import routes from './routers' import store from '@/store' import iView from 'iview' -import { getToken, canTurnTo } from '@/libs/util' +import { setToken, getToken, canTurnTo } from '@/libs/util' import config from '@/config' const { homeName } = config @@ -36,6 +36,7 @@ router.beforeEach((to, from, next) => { name: homeName // 跳转到homeName页 }) } else { + console.log(store.state.user.hasGetInfo) if (store.state.user.hasGetInfo) { turnTo(to, store.state.user.access, next) } else { @@ -43,6 +44,7 @@ router.beforeEach((to, from, next) => { // 拉取用户信息,通过用户权限和跳转的页面的name来判断是否有权限访问;access必须是一个数组,如:['super_admin'] ['super_admin', 'admin'] turnTo(to, user.access, next) }).catch(() => { + setToken('') next({ name: 'login' })