ai_images/portal-ui/src/views/authLogin.vue

50 lines
869 B
Vue

<template>
<div :class="prefixCls"></div>
</template>
<script>
export default {
data() {
return {
prefixCls: 'auth-login'
}
},
created() {
let { state, code } = this.$route.query || {}
if (state && code) {
this.$axios({
url: '/api/oauth/google/callback',
method: 'GET',
data: {
code,
state
}
}).then((res) => {
if (res.code == 200) {
window.opener.postMessage(
{
type: 'google-login',
token: res.token
},
'*'
)
window.close()
// this.$store.dispatch('user/setToken', res.token)
// this.$store.dispatch('user/getInfo').then((userRes) => {
// this.$router.replace('/')
// })
}
})
}
},
mounted() {}
}
</script>
<style lang="less" scoped>
.auth-login {
height: 100%;
background: linear-gradient(0deg, #091125 0%, #000000 100%);
}
</style>