refactor(router): 简化未授权地址的生成逻辑
移除冗余的路径拼接,直接使用location.href生成未授权地址,使代码更简洁易读
Showing
1 changed file
with
2 additions
and
2 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2025-03-20 20:36:36 | 2 | * @Date: 2025-03-20 20:36:36 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-03-26 13:50:07 | 4 | + * @LastEditTime: 2025-03-26 16:52:03 |
| 5 | * @FilePath: /mlaj/src/router/guards.js | 5 | * @FilePath: /mlaj/src/router/guards.js |
| 6 | * @Description: 路由守卫逻辑 | 6 | * @Description: 路由守卫逻辑 |
| 7 | */ | 7 | */ |
| ... | @@ -31,7 +31,7 @@ export const checkWxAuth = async () => { | ... | @@ -31,7 +31,7 @@ export const checkWxAuth = async () => { |
| 31 | const { code, data } = await getAuthInfoAPI(); | 31 | const { code, data } = await getAuthInfoAPI(); |
| 32 | if (code && !data.openid_has) { | 32 | if (code && !data.openid_has) { |
| 33 | // 直接在这里处理授权跳转 | 33 | // 直接在这里处理授权跳转 |
| 34 | - let raw_url = encodeURIComponent(location.origin + location.pathname + location.href); // 未授权的地址 | 34 | + let raw_url = encodeURIComponent(location.href); // 未授权的地址 |
| 35 | const short_url = `/srv/?f=behalo&a=openid&res=${raw_url}`; | 35 | const short_url = `/srv/?f=behalo&a=openid&res=${raw_url}`; |
| 36 | location.href = short_url; | 36 | location.href = short_url; |
| 37 | 37 | ... | ... |
-
Please register or login to post a comment