From 48db5c8e6f64381344dc5964d4eb5922ff61a7a9 Mon Sep 17 00:00:00 2001 From: lcj <17763797832@163.com> Date: Tue, 1 Sep 2026 14:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E7=BB=88=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/auth.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/common/auth.js b/common/auth.js index 716f1cb..e196aaa 100644 --- a/common/auth.js +++ b/common/auth.js @@ -41,7 +41,8 @@ const captureIdentity = () => { uni.setStorageSync('oauthCode', decodeURIComponent(mCode[1])) console.log('[auth] oauth code recovered len=' + mCode[1].length) } - console.log('[auth] captureIdentity orderInUrl=' + !!mOrder + ' codeInUrl=' + !!mCode + ' href=' + location.href) + console.log('[auth] captureIdentity orderInUrl=' + !!mOrder + ' codeInUrl=' + !!mCode + ' href=' + location + .href) // #endif } @@ -65,7 +66,8 @@ const loginByOrder = (order) => { 'Content-Type': 'application/json' }, data: { - code: order + code: order, + openId: uni.getStorageSync('openId') || '' }, success: (res) => { loggingIn = null @@ -90,7 +92,8 @@ const loginByOrder = (order) => { if (d.channel) uni.setStorageSync('channel', d.channel) if (d.userId) uni.setStorageSync('userId', d.userId) // d.isSubscribe=0 - if (d.isSubscribe !== undefined && d.isSubscribe !== null && d.isSubscribe !== '') { + if (d.isSubscribe !== undefined && d.isSubscribe !== null && d.isSubscribe !== + '') { uni.setStorageSync('isSubscribe', d.isSubscribe) } uni.setStorageSync('order', order) @@ -202,7 +205,10 @@ const requireLogin = (redirect) => { return Promise.resolve(false) }).catch((err) => { uni.removeStorageSync('oauthCode') - uni.showToast({ icon: 'none', title: err.message || '授权失败,请稍后重试' }) + uni.showToast({ + icon: 'none', + title: err.message || '授权失败,请稍后重试' + }) return Promise.resolve(false) }) } @@ -267,7 +273,10 @@ const resolveOrder = (order, freshOrder) => { return Promise.resolve(true) } if (!order) { - uni.showToast({ icon: 'none', title: '缺少登录凭证' }) + uni.showToast({ + icon: 'none', + title: '缺少登录凭证' + }) return Promise.resolve(false) } return loginByOrder(order).then(() => { @@ -277,7 +286,10 @@ const resolveOrder = (order, freshOrder) => { } return true }).catch((err) => { - uni.showToast({ icon: 'none', title: err.message || '登录失败' }) + uni.showToast({ + icon: 'none', + title: err.message || '登录失败' + }) return false }) }