feat: add google auth integration

This commit is contained in:
Tim
2025-07-05 14:51:29 +08:00
parent e5ee4fcabb
commit ed12fb0fc9
6 changed files with 49 additions and 2 deletions

View File

@@ -46,7 +46,7 @@
</div>
<div class="other-login-page-content">
<div class="login-page-button">
<div class="login-page-button" @click="loginWithGoogle">
<img class="login-page-button-icon" src="../assets/icons/google.svg" alt="Google Logo" />
<div class="login-page-button-text">Google 登录</div>
</div>
@@ -57,6 +57,7 @@
<script>
import { API_BASE_URL, toast } from '../main'
import { setToken } from '../utils/auth'
import { googleSignIn } from '../utils/google'
export default {
name: 'LoginPageView',
data() {
@@ -87,6 +88,11 @@ export default {
} catch (e) {
toast.error('登录失败')
}
},
loginWithGoogle() {
googleSignIn(() => {
this.$router.push('/')
})
}
}
}

View File

@@ -91,7 +91,7 @@
</div>
<div class="other-signup-page-content">
<div class="signup-page-button">
<div class="signup-page-button" @click="signupWithGoogle">
<img class="signup-page-button-icon" src="../assets/icons/google.svg" alt="Google Logo" />
<div class="signup-page-button-text">Google 注册</div>
</div>
@@ -101,6 +101,7 @@
<script>
import { API_BASE_URL, toast } from '../main'
import { googleSignIn } from '../utils/google'
export default {
name: 'SignupPageView',
@@ -187,6 +188,11 @@ export default {
} catch (e) {
toast.error('注册失败')
}
},
signupWithGoogle() {
googleSignIn(() => {
this.$router.push('/')
})
}
}
}