This commit is contained in:
+6
-4
@@ -30,7 +30,7 @@
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
deviceId = urlParams.get('device_id') || '';
|
||||
|
||||
// 兜底:从路径解析(如 /pages/index/index/N1154)
|
||||
// 兜底:从路径解析(如 /N1154)
|
||||
if (!deviceId) {
|
||||
const path = window.location.pathname;
|
||||
const segments = path.split('/').filter(Boolean);
|
||||
@@ -46,14 +46,16 @@
|
||||
const code = urlParams.get('code');
|
||||
|
||||
if (code) {
|
||||
// 有 code → 进入授权 Loading 页处理,保留 code/action/device_id 参数
|
||||
// 有 code → 进入授权 Loading 页处理
|
||||
// redirect_uri 已携带 device_id 和 action,回调时直接从 URL 取
|
||||
const action = urlParams.get('action') || '';
|
||||
const callbackDeviceId = urlParams.get('device_id') || deviceId || '';
|
||||
let loadingUrl = '/pages/auth/loading?code=' + encodeURIComponent(code);
|
||||
if (action) {
|
||||
loadingUrl += '&action=' + action;
|
||||
}
|
||||
if (deviceId) {
|
||||
loadingUrl += '&device_id=' + deviceId;
|
||||
if (callbackDeviceId) {
|
||||
loadingUrl += '&device_id=' + callbackDeviceId;
|
||||
}
|
||||
uni.redirectTo({ url: loadingUrl });
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user