From 64f1e85bd997563156fb83fc9709bbb9ea256aa5 Mon Sep 17 00:00:00 2001 From: aixianling Date: Wed, 22 Jun 2022 10:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E5=BE=AE=E6=A0=87=E5=87=86=E7=89=88?= =?UTF-8?q?=E8=B0=83=E6=95=B4oauth2=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/modules.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/modules.js b/src/common/modules.js index 42db5edd..158672e2 100644 --- a/src/common/modules.js +++ b/src/common/modules.js @@ -55,7 +55,7 @@ export const config = { } }, getCode({state, dispatch}, tryAgentSign = false) { - let {corpid: corpId, suiteId} = state, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_privateinfo" + let {corpid: corpId, suiteId, agentid: agentId} = state, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_privateinfo" if (/\/AppForm\//.test(location.search)) { scope = "snsapi_userinfo" } else if (suiteId) { @@ -64,10 +64,11 @@ export const config = { } return new Promise((resolve, reject) => { if (corpId && scope) { - let oauthURL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE#wechat_redirect' + let oauthURL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&agentid=AGENTID#wechat_redirect' .replace(/APPID/g, corpId) .replace(/REDIRECT_URI/g, REDIRECT_URI) .replace(/SCOPE/g, scope) + .replace(/AGENTID/g, agentId) location.replace(oauthURL) } else if (!tryAgentSign) { dispatch("agentSign", {corpId, suiteId}).then(() => dispatch("getCode", true)).then(() => resolve())