This commit is contained in:
@@ -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 → 调用后端登录
|
||||
|
||||
Reference in New Issue
Block a user