Compare commits

...

1 Commits

Author SHA1 Message Date
kk 5bb31516a0 保留code参数
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 45s
2026-07-02 19:32:07 +08:00
2 changed files with 12 additions and 7 deletions
+5 -4
View File
@@ -25,10 +25,11 @@
const code = urlParams.get('code');
if (code) {
// 有 code → 进入授权 Loading 页处理
const loadingUrl = deviceId
? `/pages/auth/loading?device_id=${deviceId}`
: '/pages/auth/loading';
// 有 code → 进入授权 Loading 页处理,保留 code 参数
let loadingUrl = '/pages/auth/loading?code=' + encodeURIComponent(code);
if (deviceId) {
loadingUrl += '&device_id=' + deviceId;
}
uni.redirectTo({ url: loadingUrl });
return;
}
+7 -3
View File
@@ -21,9 +21,13 @@ export default {
this.deviceId = options.device_id || '';
// #ifdef H5
// 检查 URL 中是否有授权回调的 code
const urlParams = new URLSearchParams(window.location.search);
const code = urlParams.get('code');
// 优先从页面参数获取 code(App.vue 跳转时带过来)
// 兜底从 URL search 参数获取(微信直接回调时)
let code = options.code || '';
if (!code) {
const urlParams = new URLSearchParams(window.location.search);
code = urlParams.get('code') || '';
}
if (code) {
// 有 code → 调用后端登录