fix: 在home授权

This commit is contained in:
zhangds 2024-03-13 18:21:31 +08:00
parent 2cd01d5f87
commit 5dfc5ed44d
2 changed files with 10 additions and 4 deletions

View File

@ -235,6 +235,10 @@
tabStaticComponent tabStaticComponent
}, },
created() { created() {
let openid = this.getQueryString("openid");
if (openid) {
localStorage.setItem('openid', openid);
}
this.getGoods(); this.getGoods();
let productConfig = JSON.parse(localStorage.getItem('product_list')); let productConfig = JSON.parse(localStorage.getItem('product_list'));
this.bgcolor = productConfig.button_color; this.bgcolor = productConfig.button_color;
@ -247,6 +251,12 @@
this.bannerUrl = productConfig.bannerUrl; this.bannerUrl = productConfig.bannerUrl;
}, },
methods: { methods: {
getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
},
closeTip() { closeTip() {
this.suspension = false; this.suspension = false;
}, },

View File

@ -402,13 +402,9 @@
this.openDialog('正在加载商品...'); this.openDialog('正在加载商品...');
localStorage.setItem('entryLink', window.location.href);//存储起始页链接 localStorage.setItem('entryLink', window.location.href);//存储起始页链接
sessionStorage.setItem("bm_auth", JSON.stringify(form_data_res.data.settlement_data)); sessionStorage.setItem("bm_auth", JSON.stringify(form_data_res.data.settlement_data));
debugger
console.log("1")
// 判断是否需要静默授权 // 判断是否需要静默授权
if (form_data_res.data.is_have_webview_voucher) { if (form_data_res.data.is_have_webview_voucher) {
location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/homepage.html` location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/homepage.html`
} }
// this.wxgzAuth(res.data.is_have_webview_voucher, res.data.token); // this.wxgzAuth(res.data.is_have_webview_voucher, res.data.token);