Skip to content

Commit 7797b9e

Browse files
121xjcodexlin
authored andcommitted
feat: ✨ 新增三方登录图标
link #16
1 parent 265ce5d commit 7797b9e

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/views/user/login/LoginView.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<script lang="ts" setup>
2-
import { WechatOutlined } from '@ant-design/icons-vue'
2+
import { WechatOutlined, QqCircleFilled, GithubFilled } from '@ant-design/icons-vue'
33
import { gsap } from 'gsap'
44
import { getCaptcha, registerApi } from './api'
55
import { useUserStore } from '@/stores/modules/user'
66
import Motion from '@/components/functional/Motion'
7-
87
const user = useUserStore()
98
// const { tt } = useLocalI18n()
109
const state = reactive<ILoginForm>({
@@ -41,7 +40,21 @@ async function getImg() {
4140
console.trace(error)
4241
}
4342
}
44-
43+
// 触发 QQ 登录
44+
const qqLogin = () => {
45+
if (window.QC) {
46+
window.QC.Login.showPopup() // 显示 QQ 登录窗口
47+
} else {
48+
console.error('QQ SDK 未加载')
49+
}
50+
}
51+
// 触发 gitHub 登录
52+
const loginGithub = () => {
53+
const authorize_uri = 'https://github.com/login/oauth/authorize'
54+
const client_id = 'Ov23liKReLQSwNqVFcak'
55+
const redirect_url = 'http://localhost:3005/login'
56+
window.location.href = `${authorize_uri}?client_id=${client_id}&redirect_url=${redirect_url}`
57+
}
4558
onMounted(() => {
4659
gsap.to('.img', {
4760
rotation: 55, // 顺时针旋转90度
@@ -111,6 +124,8 @@ onMounted(() => {
111124
<div class="extra-login">
112125
<a>
113126
<wechat-outlined style="font-size: 40px; color: #24bf24" />
127+
<QqCircleFilled style="font-size: 38px; color: #4da4de; margin-left: 20px" @click="qqLogin" />
128+
<GithubFilled style="font-size: 36px; color: #000; margin: 0px 0 0px 20px" @click="loginGithub" />
114129
</a>
115130
</div>
116131
</a-form-item>
@@ -301,8 +316,8 @@ onMounted(() => {
301316
302317
h2 {
303318
text-align: center;
319+
text-shadow: 0 1px 2px 0 rgb(135 76 255 / 30%);
304320
letter-spacing: 0.02em;
305-
text-shadow: 0 1px 2px rgb(135 76 255 / 30%);
306321
background: linear-gradient(98deg, #741bfe 0%, #f224fd 54%, #fc4b34 100%);
307322
background-clip: text;
308323
-webkit-text-fill-color: transparent;

0 commit comments

Comments
 (0)