测试
This commit is contained in:
parent
1f3d09053e
commit
8e07827b3e
@ -161,12 +161,14 @@ const apiAll = () => {
|
||||
// 页面未挂载
|
||||
onBeforeMount(() => {
|
||||
if (!h5plugin.isWX()) {
|
||||
apiAll();
|
||||
// apiAll();
|
||||
}
|
||||
|
||||
console.log("link:", window.location.href);
|
||||
console.log("用户活动信息:", store.state.userAccount);
|
||||
|
||||
console.log("code:", h5plugin.getQueryString("code"));
|
||||
|
||||
// 微信环境授权
|
||||
if (h5plugin.isWX()) {
|
||||
// console.log("code:", h5plugin.getQueryString("code"));
|
||||
@ -179,7 +181,12 @@ onBeforeMount(() => {
|
||||
// getCode();
|
||||
// }
|
||||
|
||||
apiAll();
|
||||
if (h5plugin.getQueryString("code")) {
|
||||
getOpenId(h5plugin.getQueryString("code"));
|
||||
} else {
|
||||
wxAuthGetCode();
|
||||
}
|
||||
|
||||
|
||||
// 一步授权
|
||||
// if(h5plugin.getQueryString("openid")){
|
||||
@ -189,9 +196,6 @@ onBeforeMount(() => {
|
||||
// console.log("不存在openid");
|
||||
// getCode2();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -211,7 +215,8 @@ 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"
|
||||
.get(
|
||||
"https://test.szxgl.cn/zszq-celebration/zsApi/xfhdAuthorize1"
|
||||
// {
|
||||
// params:{
|
||||
// // redirect_uri: redirect_uri,
|
||||
@ -230,6 +235,25 @@ const getCode2 = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const wxAuthGetCode = () => {
|
||||
var appId = "wx35766a64d73d08a9";
|
||||
var REDIRECT_URI = window.location.href;
|
||||
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
|
||||
`;
|
||||
|
||||
// service
|
||||
// .post(process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize", {
|
||||
// redirect_uri: redirect_uri,
|
||||
// })
|
||||
// .then((res) => {
|
||||
// let code = res.data.data;
|
||||
// console.log("get code结果3", res);
|
||||
// authCode.value = res.data.data;
|
||||
// window.location.href = res.data.data;
|
||||
// // location.href = res.data.data;
|
||||
// // window.open(res.data.data)
|
||||
// });
|
||||
};
|
||||
|
||||
const getCode = () => {
|
||||
let redirect_uri = window.location.href;
|
||||
@ -323,7 +347,7 @@ const stopBack = () => {
|
||||
|
||||
window.addEventListener("popstate", function () {
|
||||
// history.pushState(null, null, document.URL);
|
||||
history.back(-1)
|
||||
history.back(-1);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user