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(