fix: 微信静默授权
This commit is contained in:
parent
9ce586c4dc
commit
68621d6120
17
index.html
17
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('正在加载商品...');
|
||||
|
|
|
@ -191,14 +191,6 @@
|
|||
}
|
||||
},
|
||||
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;
|
||||
}
|
||||
|
||||
if (this.loading) return;
|
||||
this.loading = true;
|
||||
let self = this;
|
||||
|
|
Loading…
Reference in New Issue