From 6dc4904c681ba6599f02ce81f8167dc8a3a95ce4 Mon Sep 17 00:00:00 2001 From: pengjch Date: Thu, 10 Aug 2017 14:14:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0PC=E7=AB=AF=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=20=E5=A2=9E=E5=8A=A0=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=BC=80=E6=94=BE=E5=B9=B3=E5=8F=B0=E4=BD=9C?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E5=8F=B7=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- get-weixin-code.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/get-weixin-code.html b/get-weixin-code.html index f38335a..82f9f9a 100644 --- a/get-weixin-code.html +++ b/get-weixin-code.html @@ -55,11 +55,17 @@ var appId = GWC.urlParams['appid']; var scope = GWC.urlParams['scope'] || 'snsapi_base'; var state = GWC.urlParams['state']; + var isMp = GWC.urlParams['isMp']; //isMp为true时使用开放平台作授权登录,false为网页扫码登录 + var baseUrl; var redirectUri; if (!code) { + baseUrl = "https://open.weixin.qq.com/connect/oauth2/authorize#wechat_redirect"; + if(scope == 'snsapi_login' && !isMp){ + baseUrl = "https://open.weixin.qq.com/connect/qrconnect"; + } //第一步,没有拿到code,跳转至微信授权页面获取code - redirectUri = GWC.appendParams('https://open.weixin.qq.com/connect/oauth2/authorize#wechat_redirect', { + redirectUri = GWC.appendParams(baseUrl, { 'appid': appId, 'redirect_uri': encodeURIComponent(location.href), 'response_type': 'code',