放弃一步授权

This commit is contained in:
tcubic 2022-08-08 18:38:20 +08:00
parent 13157bec19
commit a67a865e35

View File

@ -169,32 +169,21 @@ onBeforeMount(() => {
console.log("code:", h5plugin.getQueryString("code")); console.log("code:", h5plugin.getQueryString("code"));
// //
if (h5plugin.isWX()) { if (h5plugin.isWX()) {
// console.log("code:", h5plugin.getQueryString("code"));
// if (h5plugin.getQueryString("code")) {
// // codeopenid
// authCode.value = h5plugin.getQueryString("code");
// getOpenId(authCode.value);
// } else {
// getCode();
// }
if (h5plugin.getQueryString("code")) { if (h5plugin.getQueryString("code")) {
getOpenId(h5plugin.getQueryString("code")); // codeopenid
authCode.value = h5plugin.getQueryString("code");
getOpenId(authCode.value);
} else { } else {
wxAuthGetCode(); getCode();
} }
//
// if(h5plugin.getQueryString("openid")){
// console.log("openid");
// apiAll();
// }else{
// console.log("openid");
// getCode2();
// }
} }
}); });
@ -209,40 +198,7 @@ const indexPage = (actions) => {
console.log("来自index组件", actions); console.log("来自index组件", actions);
}; };
// code
const getCode2 = () => {
let redirect_uri = window.location.href;
// service.post(process.env.VUE_APP_API + '/cms-activity/cms88/zsApi/xfhdAuthorize?redirect_uri='+redirect_uri,
service
.get(
"https://test.szxgl.cn/zszq-celebration/zsApi/xfhdAuthorize1"
// {
// params:{
// // redirect_uri: redirect_uri,
// redirect_uri: 'https://test.szxgl.cn/zszq-celebration/activity/index.html',
// }
// }
)
.then((res) => {
let code = res.data.data;
console.log("get code结果4", res);
// authCode.value = res.data.data;
// window.location.href = res.data.data;
// location.href = res.data.data;
// window.open(res.data.data)
});
};
const wxAuthGetCode = () => {
var appId = "wx35766a64d73d08a9";
// var appId = "wx41d80a1bb01f658d";
var url = encodeURI(window.location.href);
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
};
const getCode = () => { const getCode = () => {
let redirect_uri = window.location.href; let redirect_uri = window.location.href;