This commit is contained in:
tcubic 2022-08-08 13:54:39 +08:00
parent 20c23c8f47
commit 5ecf23bfc2

View File

@ -211,20 +211,23 @@ onBeforeMount(() => {
if (h5plugin.isWX()) { if (h5plugin.isWX()) {
console.log("code:", h5plugin.getQueryString("code")); console.log("code:", h5plugin.getQueryString("code"));
if (h5plugin.getQueryString("code")) { // if (h5plugin.getQueryString("code")) {
// codeopenid // // codeopenid
authCode.value = h5plugin.getQueryString("code"); // authCode.value = h5plugin.getQueryString("code");
getOpenId(authCode.value); // getOpenId(authCode.value);
} else { // } else {
getCode(); // getCode();
} // }
getCode2();
} }
}); });
// //
onMounted(() => { onMounted(() => {
fontAdpat(); fontAdpat();
stopBack() // stopBack()
}); });
// //
@ -233,6 +236,27 @@ const indexPage = (actions) => {
}; };
// code // 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(process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize1", {
params:{
redirect_uri: redirect_uri,
}
})
.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 getCode = () => { const getCode = () => {
let redirect_uri = window.location.href; let redirect_uri = window.location.href;
// service.post(process.env.VUE_APP_API + '/cms-activity/cms88/zsApi/xfhdAuthorize?redirect_uri='+redirect_uri, // service.post(process.env.VUE_APP_API + '/cms-activity/cms88/zsApi/xfhdAuthorize?redirect_uri='+redirect_uri,
@ -244,8 +268,8 @@ const getCode = () => {
let code = res.data.data; let code = res.data.data;
console.log("get code结果3", res); console.log("get code结果3", res);
authCode.value = res.data.data; authCode.value = res.data.data;
// window.location.href = res.data.data; window.location.href = res.data.data;
location.href = res.data.data; // location.href = res.data.data;
// window.open(res.data.data) // window.open(res.data.data)
}); });
}; };