From 785b685e8d1bbea1041d9f1b15816115910cb9e3 Mon Sep 17 00:00:00 2001 From: Xwen <929716663@qq.com> Date: Mon, 8 Jan 2024 23:11:07 +0800 Subject: [PATCH] =?UTF-8?q?perf:=E5=8C=BA=E5=88=86=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E6=8E=88=E6=9D=83=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Bbs.Vue3/src/views/Auth/index.vue | 10 ++++++++-- Yi.Bbs.Vue3/src/views/login/index.vue | 16 ++++++++++++---- Yi.Bbs.Vue3/src/views/profile/AccountSetting.vue | 4 ++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Yi.Bbs.Vue3/src/views/Auth/index.vue b/Yi.Bbs.Vue3/src/views/Auth/index.vue index 5235d447..73c664a8 100644 --- a/Yi.Bbs.Vue3/src/views/Auth/index.vue +++ b/Yi.Bbs.Vue3/src/views/Auth/index.vue @@ -10,6 +10,7 @@ import { authOtherLogin, authOtherBind } from "@/apis/auth.js"; const route = useRoute(); const code = ref(route.query.code); +const type = ref(route.query.state); const message = ref(""); watch( @@ -20,8 +21,13 @@ watch( const regex = /\/auth\/([\w-]+)[?]?/; const result = regex.exec(route.fullPath); const authParam = result != null ? result[1].toUpperCase() : null; - const res = await authOtherBind({ code: val }, authParam); - console.log(res, "res"); + if (type.value === 0) { + const res = await authOtherLogin({ code: val }, authParam); + console.log(res, "type.value === 0"); + } else if (type.value === 1) { + const res = await authOtherBind({ code: val }, authParam); + console.log(res, "type.value === 1"); + } message.value = "授权成功"; // window.close(); } diff --git a/Yi.Bbs.Vue3/src/views/login/index.vue b/Yi.Bbs.Vue3/src/views/login/index.vue index 8c422604..09197fe2 100644 --- a/Yi.Bbs.Vue3/src/views/login/index.vue +++ b/Yi.Bbs.Vue3/src/views/login/index.vue @@ -140,10 +140,10 @@
- +
-
- +
+
@@ -305,7 +305,15 @@ const handleContact = () => { const handleQQLogin = () => { window.open( - "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=true&scope=get_user_info", + "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=0&scope=get_user_info", + undefined, + "width=500,height=500,left=50,top=50" + ); +}; + +const handleGiteeLogin = () => { + window.open( + "https://gitee.com/oauth/authorize?client_id=949f3519969adc5cfe82c209b71300e8e0868e8536f3d7f59195c8f1e5b72502&redirect_uri=https%3A%2F%2Fccnetcore.com%2Fauth%2Fgitee&state=0&response_type=code", undefined, "width=500,height=500,left=50,top=50" ); diff --git a/Yi.Bbs.Vue3/src/views/profile/AccountSetting.vue b/Yi.Bbs.Vue3/src/views/profile/AccountSetting.vue index ddd05a44..181e9e11 100644 --- a/Yi.Bbs.Vue3/src/views/profile/AccountSetting.vue +++ b/Yi.Bbs.Vue3/src/views/profile/AccountSetting.vue @@ -92,7 +92,7 @@ onMounted(async () => { const handleQQLogin = () => { window.open( - "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=true&scope=get_user_info", + "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=102087446&redirect_uri=https://ccnetcore.com/auth/qq&state=1&scope=get_user_info", undefined, "width=500,height=500,left=50,top=50" ); @@ -100,7 +100,7 @@ const handleQQLogin = () => { const handleGiteeLogin = () => { window.open( - "https://gitee.com/oauth/authorize?client_id=949f3519969adc5cfe82c209b71300e8e0868e8536f3d7f59195c8f1e5b72502&redirect_uri=https%3A%2F%2Fccnetcore.com%2Fauth%2Fgitee&response_type=code", + "https://gitee.com/oauth/authorize?client_id=949f3519969adc5cfe82c209b71300e8e0868e8536f3d7f59195c8f1e5b72502&redirect_uri=https%3A%2F%2Fccnetcore.com%2Fauth%2Fgitee&state=1&response_type=code", undefined, "width=500,height=500,left=50,top=50" );