Compare commits

...

2 Commits

Author SHA1 Message Date
f4da5d9455 添加微信登录 2020-07-23 08:31:38 +08:00
20345ae9ce 添加微信登录 2020-07-23 08:25:24 +08:00
2 changed files with 15 additions and 1 deletions

View File

@ -17,7 +17,21 @@ export default {
if (!code) { this.notice = '<p style="color: #999">非法访问,缺少授权参数"code"。<p><br><br> <a href="https://www.wyr.me" target="_blank">返回首页<a>'; this.$finishLoad(); return }
if (type === 'weixin') {
const { data } = await this.$axios.post(`${process.env.baseURL}/visitor/user/weixin`, {
code,
app: 'wx9d5e677f533d1e84'
})
if (data.status !== 1) {
this.$toasted.show('微信登录失败,请重试或换用其它登录方式。', {
position: 'top-center',
duration: 5000
})
return
}
window.authSuccess(data)
return
}
const { data } = await this.$axios.post('/visitor/user/auth', {

View File

@ -682,7 +682,7 @@ export default {
this.commentLoading = false
this.currentLoginType = null
this.useWeixinLogin = false
window.location.href = `https://open.weixin.qq.com/connect/authorize?appid=wx9d5e677f533d1e84&redirect_uri=${encodeURIComponent('https://tool.sercretcore.com/auth.php')}&response_type=code&scope=snsapi_userinfo&state=blog-${this.postID}#wechat_redirect`
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9d5e677f533d1e84&redirect_uri=${encodeURIComponent('https://tool.sercretcore.com/auth.php')}&response_type=code&scope=snsapi_userinfo&state=blog-${this.postID}#wechat_redirect`
} else {
const { data } = await this.$axios.get('https://weixin.openapi.site/img?appid=wx2d1d6aa2f86768d7&redirect_uri=https://wyr.me')