fix: 增加白名单静默授权

This commit is contained in:
zhangds 2024-03-13 15:24:28 +08:00
parent fd496d7547
commit 70660672e3
1 changed files with 19 additions and 6 deletions

View File

@ -110,8 +110,14 @@
},
async created() {
sessionStorage.clear();
localStorage.clear();
// 白名单不清除
let bmd_token = this.getQueryString('token');
if (!bmd_token) {
sessionStorage.clear();
localStorage.clear();
}
await req.axiosGet('/conf/apiStatus').then(res => {
if (res.data.update) {
sessionStorage.setItem('notice', res.data.msg);
@ -249,13 +255,19 @@
},
// 静默授权
wxgzAuth(is_have_webview_voucher) {
wxgzAuth(is_have_webview_voucher, token) {
/* 公众号打开 */
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
if (token) {
location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${token}`;
return
} else {
location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${key}`;
return
}
}
},
@ -342,6 +354,7 @@
}
}).catch(err => { });
} else if ([1, 8].includes(this.pageType)) {//白名单
let par = {
"code": this.code,
"mobile": this.key,
@ -369,7 +382,7 @@
};
let wait = await req.axiosPost('/key/loginFromMobileKey', data).then(res => {
if (res.code == 200) {
this.wxgzAuth(res.data.is_have_webview_voucher);
this.wxgzAuth(res.data.is_have_webview_voucher, item);
form_data_res = res;
getTokenList.push(res.data.token);
istoGoods = true;