目前前端代码中引入js后
<div id="login_container"></div>
watch: {
$route: {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
this.wxCode = route.code || "";
console.log(this.wxCode, '===', route.query);
//本地存储code是因为从其他页面返回vue页面存在缓存需要自定义刷新
if (this.wxCode == localStorage["wxCode"] && this.wxCode != "") {
window.location.href = this.redirect_uri; //回调地址
} else {
localStorage.setItem("wxCode", this.wxCode); //设置b为"isaac"
}
if (this.wxCode) {
let params = {
code: this.wxCode,
state: "",
};
wechatLogin(params)
.then((res) => {
if (res.status) {
//返回参数如果绑定微信返回token正常存储登录未绑定账号返回unionid绑定当然也可以以微信信息为主题自动生成账号
}
})
.catch(() => {
//返回失败因为二维码已经被使用过所以需要刷新重新获取
window.location.href = this.redirect_uri;
});
}
},
immediate: true,
},
}
//初始化微信相关参数
loginQR().then((result) => {
this.redirect_uri = result.data.redirect_uri;
var obj = new WxLogin({
self_redirect: true,
id: "login_container", // 需要显示的容器id
appid: result.data.appid, // 公众号appid wx*******
scope: result.data.scope, // 网页默认即可
redirect_uri: result.data.redirect_uri, // 授权成功后回调的url
state: result.data.state, // 可设置为简单的随机数加session用来校验
style: "black", // 提供"black"、"white"可选。二维码的样式
href: "data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7d2lkdGg6IDIwMHB4O30KLmltcG93ZXJCb3ggLnRpdGxlIHtkaXNwbGF5OiBub25lO30KLmltcG93ZXJCb3ggLmluZm8ge3dpZHRoOiAyMDBweDt9Ci5zdGF0dXNfaWNvbiB7ZGlzcGxheTogbm9uZX0KLmltcG93ZXJCb3ggLnN0YXR1cyB7dGV4dC1hbGlnbjogY2VudGVyO30NCiN3ZWNoYXRfY29kZT5pZnJhbWV7aGVpZ2h0OiAyODBweDt9",
});
});
后端进行提供二维码和进行回调的操作
然后本地跟线上扫码成功后都不走监听 只在页面二维码部位展示后端回调的地址
请问扫码成功后的流程是什么!