Commit 585d2a523bf74310b7b1dc10a00089d44ac5ac6d
1 parent
ab40254b
修复登录的 redirect 地址,存在参数时,登录成功回跳的时候地址不正确的问题
Showing
3 changed files
with
4 additions
and
3 deletions
yudao-ui-admin/src/permission.js
| ... | ... | @@ -48,7 +48,8 @@ router.beforeEach((to, from, next) => { |
| 48 | 48 | // 在免登录白名单,直接进入 |
| 49 | 49 | next() |
| 50 | 50 | } else { |
| 51 | - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 | |
| 51 | + const redirect = encodeURIComponent(to.fullPath) // 编码 URI,保证参数跳转回去后,可以继续带上 | |
| 52 | + next(`/login?redirect=${redirect}`) // 否则全部重定向到登录页 | |
| 52 | 53 | NProgress.done() |
| 53 | 54 | } |
| 54 | 55 | } | ... | ... |
yudao-ui-admin/src/views/login.vue
| ... | ... | @@ -190,7 +190,7 @@ export default { |
| 190 | 190 | // 验证码开关 |
| 191 | 191 | this.captchaEnable = getCaptchaEnable(); |
| 192 | 192 | // 重定向地址 |
| 193 | - this.redirect = this.$route.query.redirect; | |
| 193 | + this.redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : undefined; | |
| 194 | 194 | this.getCookie(); |
| 195 | 195 | }, |
| 196 | 196 | methods: { | ... | ... |
yudao-ui-admin/src/views/socialLogin.vue
| ... | ... | @@ -117,7 +117,7 @@ export default { |
| 117 | 117 | // 验证码开关 |
| 118 | 118 | this.captchaEnable = getCaptchaEnable(); |
| 119 | 119 | // 重定向地址 |
| 120 | - this.redirect = this.$route.query.redirect; | |
| 120 | + this.redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : undefined; | |
| 121 | 121 | // 社交登录相关 |
| 122 | 122 | this.type = this.$route.query.type; |
| 123 | 123 | this.code = this.$route.query.code; | ... | ... |