From 6508b1cc3d2b2c915ebc90376991cca866b08bd8 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 17 May 2017 17:59:13 +0800 Subject: [PATCH] refine --- src/main.js | 4 ++-- src/store/modules/permission.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index c9b3f995..8502cbda 100644 --- a/src/main.js +++ b/src/main.js @@ -47,8 +47,8 @@ router.beforeEach((to, from, next) => { if (to.path === '/login') { next({ path: '/' }); } else { - if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完info信息 - store.dispatch('GetInfo').then(res => { // 拉取info + if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(res => { // 拉取user_info const roles = res.data.role; store.dispatch('GenerateRoutes', { roles }).then(() => { // 生成可访问的路由表 router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index be98a463..926c89b0 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -22,7 +22,6 @@ const permission = { }, actions: { - // s GenerateRoutes({ commit }, data) { return new Promise(resolve => { const { roles } = data;