添加github登陆功能

This commit is contained in:
2020-07-15 01:22:34 +08:00
parent 7e61d738cf
commit 3f8396a254
2 changed files with 7 additions and 12 deletions

View File

@ -13,20 +13,20 @@ export default {
async mounted () {
const code = this.$route.query.code
if (!code) { this.notice = '<p style="color: #999">非法访问,缺少授权参数"code"。<p><br><br> <a href="https://www.wyr.me" target="_blank">返回首页<a>' }
if (!code) { this.notice = '<p style="color: #999">非法访问,缺少授权参数"code"。<p><br><br> <a href="https://www.wyr.me" target="_blank">返回首页<a>'; this.$finishLoad(); return }
const { data } = await this.$axios.post('/visitor/user/auth', {
const { data } = await this.$axios.post('http://127.0.0.1:65534/visitor/user/auth', {
type: 'github',
code
})
if (data.status !== 1) {
this.notice = '<p style="color: #999">授权失败,请再试一次。<p><br><br> <a href="https://www.wyr.me" target="_blank">返回首页<a>'
this.notice = '<p style="color: #999">授权失败,请关闭页面从登陆入口再试一次。<p><br><br> <a href="https://www.wyr.me" target="_blank">返回首页<a>'
this.$finishLoad()
return
}
console.log(data)
window.opener.localStorage.visitorToken = data.token
window.opener.localStorage.visitorToken = data.result
window.opener.authSuccess(data)
window.close()