公众号授权登录代码(含跳转关注公众号)
注意:
跳转微信公众号页:
https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzU5Mzc1Mzk0NQ==&scene=110#wechat_redirect"
其中 __biz 参数是微信公众号的appid,base64转码后所得
代码
// 点击关注
follow() {
window.location.href =
"https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzU5Mzc1Mzk0NQ==&scene=110#wechat_redirect";
},
// 点击暂时不关注
Ignore() {
if (sessionStorage.getItem("redirect")) {
this.$router.replace(sessionStorage.getItem("redirect"));
} else {
this.$router.replace("/");
}
},
// 得到code跟后台换token
author() {
this.but_show = true; // 有 code 提示正在进入
this.$axios({
url: this.$api.login,
params: {
code: this.$route.query.code,
uid: this.uid
}
}).then(res => {
if (res.code == 200) {
sessionStorage.setIte