将必要参数拼接在redirect_uri中
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 44s

This commit is contained in:
kk
2026-07-11 11:01:22 +08:00
parent 7b2e4dc72e
commit 45147426e0
3 changed files with 34 additions and 28 deletions
+6 -6
View File
@@ -325,14 +325,14 @@ export default {
}
try {
// 回调地址:loading 页处理后跳回首页(带 action device_id
const baseUri = config.authRedirectUri || window.location.origin + '/pages/auth/loading';
const redirectUriObj = new URL(baseUri);
redirectUriObj.searchParams.set('action', 'userinfo');
// 回调地址:基础地址 + action + device_id 参数(回调时保留
let redirectUri = config.authRedirectUri || (
window.location.origin.replace(/^http:/, 'https:') + window.location.pathname
);
redirectUri += (redirectUri.includes('?') ? '&' : '?') + 'action=userinfo';
if (this.deviceId) {
redirectUriObj.searchParams.set('device_id', this.deviceId);
redirectUri += '&device_id=' + encodeURIComponent(this.deviceId);
}
const redirectUri = redirectUriObj.toString();
// 获取非静默授权链接(会弹窗确认)
const res = await gatewayGet('/api/v1/user/auth/url', {