From 68621d6120d1569939e5e282c49600c9ace8b897 Mon Sep 17 00:00:00 2001 From: zhangds Date: Wed, 13 Mar 2024 13:45:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BE=AE=E4=BF=A1=E9=9D=99=E9=BB=98?= =?UTF-8?q?=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 17 ++++++++++++++++- packkey/reduce.html | 26 +++++++++----------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/index.html b/index.html index 5fff238..210380a 100644 --- a/index.html +++ b/index.html @@ -100,7 +100,8 @@ popShow: false, popTitle: '', popText: '', - popStatus: 1 /*1 成功 2提示 3失败 */ + popStatus: 1, /*1 成功 2提示 3失败 */ + openid: localStorage.setItem('openid', openid) }; }, @@ -246,6 +247,18 @@ }, 300) }, + // 静默授权 + wxgzAuth(is_have_webview_voucher) { + /* 公众号打开 */ + if (is_have_webview_voucher && !this.openid) { + const key = localStorage.getItem('key'); + const linkId = localStorage.getItem('linkId'); + location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${key}`; + return + } + + }, + //获取白名单验证码 getcode() { let self = this; @@ -299,6 +312,8 @@ }, 2000); if (res.code == 200) { + this.wxgzAuth(res.data.is_have_webview_voucher); + localStorage.setItem('key', self.key); localStorage.setItem('token', res.data.token); this.openDialog('正在加载商品...'); diff --git a/packkey/reduce.html b/packkey/reduce.html index cb2426a..d1dc8ca 100644 --- a/packkey/reduce.html +++ b/packkey/reduce.html @@ -190,15 +190,7 @@ history.go(-2); } }, - receiveFn () { - /* 公众号打开 */ - if (this.goodInfo.entity.channel == 2 && this.goodInfo.entity.is_webview == 1 && !this.openId) { - const key = localStorage.getItem('key'); - const linkId = localStorage.getItem('linkId'); - location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${key}`; - return; - } - + receiveFn() { if (this.loading) return; this.loading = true; let self = this; @@ -237,12 +229,12 @@ // //在钉钉内置环境打开,不能唤起微信小程序 // self.openErrorDialog("请在其他浏览器打开!"); // } else { - if (this.goodInfo.entity.is_webview == 1) { - this.publicCollection(res.data.order_number); - } else { - //唤起微信福利官小程序 - window.location.replace(res.data.redirect_url); - } + if (this.goodInfo.entity.is_webview == 1) { + this.publicCollection(res.data.order_number); + } else { + //唤起微信福利官小程序 + window.location.replace(res.data.redirect_url); + } // } } }, 300) @@ -265,7 +257,7 @@ }, /* 公众号领取 */ - publicCollection (order_number) { + publicCollection(order_number) { let params = { order_number, channel: 2, @@ -287,7 +279,7 @@ }, - toLinkAlipay () { + toLinkAlipay() { //支付宝H5跳转 let self = this; let banklink = encodeURIComponent(