Commit 30f160446e7bc507ffc841dd9478d45d459698fc
1 parent
4f770b24
v3.5.0 删除多余的代码
Showing
2 changed files
with
3 additions
and
5 deletions
yudao-ui-admin/src/permission.js
| @@ -21,10 +21,8 @@ router.beforeEach((to, from, next) => { | @@ -21,10 +21,8 @@ router.beforeEach((to, from, next) => { | ||
| 21 | // 获取字典数据 | 21 | // 获取字典数据 |
| 22 | store.dispatch('dict/loadDictDatas') | 22 | store.dispatch('dict/loadDictDatas') |
| 23 | // 判断当前用户是否已拉取完user_info信息 | 23 | // 判断当前用户是否已拉取完user_info信息 |
| 24 | - store.dispatch('GetInfo').then(res => { | ||
| 25 | - // 拉取user_info | ||
| 26 | - const roles = res.roles | ||
| 27 | - store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => { | 24 | + store.dispatch('GetInfo').then(() => { |
| 25 | + store.dispatch('GenerateRoutes').then(accessRoutes => { | ||
| 28 | // 根据roles权限生成可访问的路由表 | 26 | // 根据roles权限生成可访问的路由表 |
| 29 | router.addRoutes(accessRoutes) // 动态添加可访问路由表 | 27 | router.addRoutes(accessRoutes) // 动态添加可访问路由表 |
| 30 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 | 28 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 |
yudao-ui-admin/src/store/modules/user.js
| @@ -90,7 +90,7 @@ const user = { | @@ -90,7 +90,7 @@ const user = { | ||
| 90 | // 获取用户信息 | 90 | // 获取用户信息 |
| 91 | GetInfo({ commit, state }) { | 91 | GetInfo({ commit, state }) { |
| 92 | return new Promise((resolve, reject) => { | 92 | return new Promise((resolve, reject) => { |
| 93 | - getInfo(state.token).then(res => { | 93 | + getInfo().then(res => { |
| 94 | // 没有 data 数据,赋予个默认值 | 94 | // 没有 data 数据,赋予个默认值 |
| 95 | if (!res) { | 95 | if (!res) { |
| 96 | res = { | 96 | res = { |