|
@@ -11,10 +11,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
- this.getCorpId()
|
|
|
+
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.setCode()
|
|
|
+ this.getCorpId()
|
|
|
},
|
|
|
methods: {
|
|
|
//获取corpid
|
|
@@ -22,6 +22,9 @@ export default {
|
|
|
get('/api/customer/chat_side/corpid/').then(res => {
|
|
|
if (res.code == 2000) {
|
|
|
this.corpid = res.data.corpid
|
|
|
+ if(this.corpid && this.corpid!==''&&this.corpid!=='undefind'){
|
|
|
+ this.setCode()
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -40,7 +43,7 @@ export default {
|
|
|
setCode () {
|
|
|
let query = this.getQuery()
|
|
|
if (!query.code) {
|
|
|
- return window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.corpid}&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE&agentid=AGENTID#wechat_redirect'
|
|
|
+ return window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.corpid}&redirect_uri=${encodeURIComponent(window.location.href)}&response_type=code&scope=snsapi_base&state=STATE&agentid=AGENTID#wechat_redirect`
|
|
|
} else {
|
|
|
this.$router.push({ name: 'index', query: { code: query.code } })
|
|
|
}
|