From bf7d9b02d3a4f8e0fe59e025a2446823e8254dd6 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Wed, 30 Apr 2025 16:56:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0google=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=8F=8A=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 16 +++++ package.json | 1 + src/assets/img/google-logo.png | Bin 0 -> 1305 bytes src/assets/img/google-logo_resized.png | Bin 0 -> 1503 bytes src/views/pages/login.vue | 81 ++++++++++++++++--------- src/views/pages/ucenter.vue | 26 ++++++-- yarn.lock | 12 ++++ 7 files changed, 103 insertions(+), 33 deletions(-) create mode 100644 src/assets/img/google-logo.png create mode 100644 src/assets/img/google-logo_resized.png diff --git a/package-lock.json b/package-lock.json index 8a35d05..218dd9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,7 @@ "xlsx": "^0.18.5" }, "devDependencies": { + "@types/node": "^22.15.3", "@vitejs/plugin-vue": "^3.0.0", "@vue/compiler-sfc": "^3.1.2", "typescript": "^4.6.4", @@ -920,6 +921,15 @@ "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==" }, + "node_modules/@types/node": { + "version": "22.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", + "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", + "dev": true, + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/trusted-types": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", @@ -5034,6 +5044,12 @@ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==" }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true + }, "node_modules/unimport": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/unimport/-/unimport-1.3.0.tgz", diff --git a/package.json b/package.json index 1f5dd7a..59a1268 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "xlsx": "^0.18.5" }, "devDependencies": { + "@types/node": "^22.15.3", "@vitejs/plugin-vue": "^3.0.0", "@vue/compiler-sfc": "^3.1.2", "typescript": "^4.6.4", diff --git a/src/assets/img/google-logo.png b/src/assets/img/google-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..796b00a71ff3ff3d0a0d9202fecb752b8812d010 GIT binary patch literal 1305 zcmV+!1?KvRP))VL5 z87v`;4#FV3D6A^rKp62h7_x!92!n+Q+k(z$lR>-QH6XaFx_xpPWD<=ZOpI#_YmXN< z7oaaZ=Exv*gZ6GcT8#ZC|1VAN>F;;f=eeg>2nr^cV0;e1L?P1^XdYFJ5Y|le&bU%A zH!c&nEPG>tMHmY#`veOU3Uv0a3N_mb`2$obKNnz72o&i2RSw5d1;`Cc66!R^#{xFB z$OTSY9&%&4Dmuph;MIaRs66zxB|*RndPNaoEU+CxMrV$r;eLUi`VeV0O9TtPfv-{A8(hMz7$+E`6QIqIbHk(*N`{OYNbF`|1Iy5)XZRG94; zETKwcFe(=rrI*iD&b*OR_?cQX+#(aWn1WB0AYDu*pBY1+u^r`Kau=bvhNm;BMt))f zZ#|5d?$_~NWIH~+?prgE@il=5-|yNnKMc=LmGOajx5p*#7SKQ&p!F6937>WtVLNobGj&CRiSR*d4ZEEiQWdS$JmX$cz5{aUW38C zx|qei%cL6VhSqEBM!0H4frou?A$kI+lb(jwYwRR^#gl-;2)D5r?}dCL;Ht@0J%4!p zK!=ex=23u*N(z*~TczL3di_8<2~TUt#8mX5P;)Wf*%=v6J+TWK+&H9S`6X~Tnnhr)OUNk0yXUwDz5_p z06k?l^6o5w+l?^j9}t2R?SVyjx`%ZNXU9Oo4zA$qTPj|TEY`a`!ABm&ofwHRdz$Ak z!u2%#3>gh-aQQO0dn>NWEhH)O`SBn|Vj;Y85Uf5}7)MvyDjX!7gTpdKzL zR*&%EMTQ0JQ;gNkb2%M^xLL_Sz+I$HFC95+5My5v3F0e*@nM%q(Uu;=9$~v7vE~FW zze&Hx{TO9mD#&WaKv)5}qCml^#!kqW)Dw~srUJe+yX$?h{hgtI!KYN8{}u8z8co{9 zW4it0ev#W@weJb3|eTI{E)5FNGr07}9Bs0L^@PtEtB|NqJNXfy!Ya2^*QX~M<& zN?i75fi`(IORI3vSBTyOrfZc8^lRl;_nR6B3DIRp%%+clf(a%V$k+S>oe^=S0`doh P00000NkvXXu0mjfpVVA} literal 0 HcmV?d00001 diff --git a/src/assets/img/google-logo_resized.png b/src/assets/img/google-logo_resized.png new file mode 100644 index 0000000000000000000000000000000000000000..713f719b0b29c2793775694a00458b185ad561ea GIT binary patch literal 1503 zcmV<51t9u~P)Px)nMp)JR9HvVm}zWORTRh1x$n)=mM+to=|T&(1vF?2vIYV|H;N*l1g9S)THMg6 zArO;N6qCUqkbsC*jf$uQB~n1d6xm^l$QDa#r>T|<-DrVA=}c$Byf<&VW-v6&K9n}W z_x0R+&hP%uz4x5^5FW4(A21&He*?9cv$U}-`V5rm1XRId*@cs+lO$0dSWo~^OC?Nz zUJ|GL2{LY_D!AZG=yLQQuz@h@`eq+Kq;Uam7@{j`b9@C6K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)_Z-&fg&ZN 第三方登录 @@ -134,6 +123,26 @@ const login = ref(null); const maxLoginRepeatRequest = 30; //最大请求次数 const currentLoginRequest = ref(0); //当前请求次数 +const thirdPartyLogoInfoList = ref([ + { + name: "github", + logo: "https://www.ljsea.top/wp-content/uploads/2025/04/github-logo.png", + }, + { + name: "gitee", + logo: "https://www.ljsea.top/wp-content/uploads/2025/04/gitee.png", + }, + { + name: "qq", + logo: "https://wiki.connect.qq.com/wp-content/uploads/2016/12/Connect_logo_4.png", + }, + { + name: "google", + logo: "https://www.ljsea.top/wp-content/uploads/2025/04/google-logo_resized.png", + }, +]); + + //表单数据 var loginData = ref({ username: "", @@ -141,6 +150,12 @@ var loginData = ref({ password: "", ip: "", }); +const thirdPartyPlatform = ref([ + { label: 'QQ', value: 'qq' }, + { label: 'Github', value: 'github' }, + { label: 'Gitee', value: 'gitee' }, + { label: 'Google', value: 'google' }, +]); const thirdLogin = async (type) => { //获取uuid @@ -155,10 +170,15 @@ const thirdLogin = async (type) => { return; } let result={}; - if(type !== "github" && type !== "qq" && type !== "gitee") { - - ElMessage.error("不支持的登录平台!请稍后再试:"+type); - return; + //平台 + for(let i = 0; i < thirdPartyPlatform.value.length; i++) { + if (thirdPartyPlatform.value[i].value === type) { + break; + } + if (i === thirdPartyPlatform.value.length - 1) { + ElMessage.error("不支持的登录平台!请稍后再试:"+type); + return; + } } result = await getThirdPartyLoginUrl({uuid: uuid,"type": "login", "platform": type }); if (result["code"] !== 0) { @@ -364,4 +384,7 @@ const getMyUserInfo = async (id) => { background-image: url(https://wiki.connect.qq.com/wp-content/uploads/2016/12/Connect_logo_4.png); } +.google-btn { + background-image: url(../../assets/img/google-logo_resized.png) !important; +} diff --git a/src/views/pages/ucenter.vue b/src/views/pages/ucenter.vue index 3e9c5b8..c562c31 100644 --- a/src/views/pages/ucenter.vue +++ b/src/views/pages/ucenter.vue @@ -74,9 +74,14 @@
- + + + 绑定
@@ -158,6 +163,13 @@ const currentLoginRequest = ref(0); //当前请求次数 const thirdPartyUserInfo = ref([]); +const thirdPartyPlatform = ref([ + { label: 'QQ', value: 'qq' }, + { label: 'Github', value: 'github' }, + { label: 'Gitee', value: 'gitee' }, + { label: 'Google', value: 'google' }, +]); + const reset_password = () => { localStorage.removeItem("ms_username"); @@ -379,9 +391,15 @@ const thirdLogin = async (type) => { return; } let result={}; - if(type !== "github" && type !== "qq" && type !== "gitee") { - ElMessage.error("不支持的登录平台!请稍后再试:"+type); - return; + //判断登录平台是否支持,thirdPartyPlatform + for(let i = 0; i < thirdPartyPlatform.value.length; i++) { + if (thirdPartyPlatform.value[i].value === type) { + break; + } + if (i === thirdPartyPlatform.value.length - 1) { + ElMessage.error("不支持的登录平台!请稍后再试:"+type); + return; + } } result = await getThirdPartyLoginUrl({uuid: uuid,"type": "add", "platform": type, "token": localStorage.getItem("token") }); if (result["code"] !== 0) { diff --git a/yarn.lock b/yarn.lock index 1ee343d..d66ac36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -600,6 +600,13 @@ resolved "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz" integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA== +"@types/node@^22.15.3", "@types/node@>= 14": + version "22.15.3" + resolved "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz" + integrity sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw== + dependencies: + undici-types "~6.21.0" + "@types/trusted-types@^2.0.7": version "2.0.7" resolved "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz" @@ -3187,6 +3194,11 @@ ufo@^1.5.4: resolved "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz" integrity sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ== +undici-types@~6.21.0: + version "6.21.0" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz" + integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== + unimport@^1.0.1: version "1.3.0" resolved "https://registry.npmjs.org/unimport/-/unimport-1.3.0.tgz"