Commit 4f33da2a3f47a594ead52cc0467249977a92c772
1 parent
8988d0b4
登录后push添加catch防止出现检查错误
Showing
2 changed files
with
8 additions
and
21 deletions
ruoyi-ui/src/permission.js
| ... | ... | @@ -23,28 +23,18 @@ router.beforeEach((to, from, next) => { |
| 23 | 23 | // 拉取user_info |
| 24 | 24 | const roles = res.roles |
| 25 | 25 | store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => { |
| 26 | - // 测试 默认静态页面 | |
| 27 | - // store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => { | |
| 28 | 26 | // 根据roles权限生成可访问的路由表 |
| 29 | 27 | router.addRoutes(accessRoutes) // 动态添加可访问路由表 |
| 30 | 28 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 |
| 31 | 29 | }) |
| 32 | - }) | |
| 33 | - .catch(err => { | |
| 34 | - store.dispatch('FedLogOut').then(() => { | |
| 30 | + }).catch(err => { | |
| 31 | + store.dispatch('LogOut').then(() => { | |
| 35 | 32 | Message.error(err) |
| 36 | 33 | next({ path: '/' }) |
| 37 | 34 | }) |
| 38 | 35 | }) |
| 39 | 36 | } else { |
| 40 | 37 | next() |
| 41 | - // 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓ | |
| 42 | - // if (hasPermission(store.getters.roles, to.meta.roles)) { | |
| 43 | - // next() | |
| 44 | - // } else { | |
| 45 | - // next({ path: '/401', replace: true, query: { noGoBack: true }}) | |
| 46 | - // } | |
| 47 | - // 可删 ↑ | |
| 48 | 38 | } |
| 49 | 39 | } |
| 50 | 40 | } else { | ... | ... |
ruoyi-ui/src/views/login.vue
| ... | ... | @@ -126,15 +126,12 @@ export default { |
| 126 | 126 | Cookies.remove("password"); |
| 127 | 127 | Cookies.remove('rememberMe'); |
| 128 | 128 | } |
| 129 | - this.$store | |
| 130 | - .dispatch("Login", this.loginForm) | |
| 131 | - .then(() => { | |
| 132 | - this.$router.push({ path: this.redirect || "/" }); | |
| 133 | - }) | |
| 134 | - .catch(() => { | |
| 135 | - this.loading = false; | |
| 136 | - this.getCode(); | |
| 137 | - }); | |
| 129 | + this.$store.dispatch("Login", this.loginForm).then(() => { | |
| 130 | + this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); | |
| 131 | + }).catch(() => { | |
| 132 | + this.loading = false; | |
| 133 | + this.getCode(); | |
| 134 | + }); | |
| 138 | 135 | } |
| 139 | 136 | }); |
| 140 | 137 | } | ... | ... |