Skip to content

Commit c2d3969

Browse files
修复启动项目后白屏的问题
1 parent 8c2548f commit c2d3969

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/components/main/components/side-menu/side-menu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default {
8181
return this.$route.matched.map(item => item.name).filter(item => item !== name)
8282
},
8383
updateOpenName (name) {
84-
if (name === 'home') this.openedNames = []
84+
if (name === this.$config.homeName) this.openedNames = []
8585
else this.openedNames = this.getOpenedNamesByActiveName(name)
8686
}
8787
},

src/components/main/main.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@ export default {
124124
},
125125
handleCloseTag (res, type, route) {
126126
if (type === 'all') {
127-
this.turnToPage('home')
127+
this.turnToPage(this.$config.homeName)
128128
} else if (routeEqual(this.$route, route)) {
129-
if (type === 'others') {
130-
} else {
129+
if (type !== 'others') {
131130
const nextRoute = getNextRoute(this.tagNavList, route)
132131
this.$router.push(nextRoute)
133132
}

src/router/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Router from 'vue-router'
33
import routes from './routers'
44
import store from '@/store'
55
import iView from 'iview'
6-
import { getToken, canTurnTo } from '@/libs/util'
6+
import { setToken, getToken, canTurnTo } from '@/libs/util'
77
import config from '@/config'
88
const { homeName } = config
99

@@ -36,13 +36,15 @@ router.beforeEach((to, from, next) => {
3636
name: homeName // 跳转到homeName页
3737
})
3838
} else {
39+
console.log(store.state.user.hasGetInfo)
3940
if (store.state.user.hasGetInfo) {
4041
turnTo(to, store.state.user.access, next)
4142
} else {
4243
store.dispatch('getUserInfo').then(user => {
4344
// 拉取用户信息,通过用户权限和跳转的页面的name来判断是否有权限访问;access必须是一个数组,如:['super_admin'] ['super_admin', 'admin']
4445
turnTo(to, user.access, next)
4546
}).catch(() => {
47+
setToken('')
4648
next({
4749
name: 'login'
4850
})

0 commit comments

Comments
 (0)