https://blog.csdn.net/weixin_39246975/article/details/108733053
//用于展示二维码图片
<iframe
style="height: 380px"
:src="loginUrl"
class="scan-qrcode-iframe"
frameborder="0"
></iframe>
computed: {
//处理地址,添加
loginUrl() {
return (
//redirect_uri :授权登录之后目的跳转网址,需要做urlencode处理。所在域名需要与授权完成回调域名一致,这个是在前面的配置登录授权里面的 授权完成回调的域名
//state:用于企业或服务商自行校验session,防止跨域攻击
//usertype :支持登录的类型。admin代表管理员登录(使用微信扫码),member代表成员登录(使用企业微信扫码),默认为admin
//最后的构造的链接大概就是这样:
'https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid=ww466b8c154f5c214f&redirect_uri=' +
encodeURIComponent('https://scrm.51xctec.com/login') +
'&usertype=member'
)
}
},
watch: {
//监听路由变化,将auth_code返回给后端
$route: {
handler: function (to) {
console.log(to, 'to')
if (to.query.auth_code) {
this.getStaffInfo(to.query.auth_code)
}
const query = to.query
console.log(query, 'query')
if (query) {
this.redirect = query.redirect
this.otherQuery = this.getOtherQuery(query)
console.log(this.redirect, 'redirect')
console.log(this.otherQuery, 'otherQuery')
}
},
immediate: true
}