From 9c23f4e12289718bb3052e55521aa3951d9c5539 Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Mon, 20 Jan 2025 17:51:00 +0800 Subject: [PATCH] fix --- src/component/LoginPage/googleLogin.vue | 60 +++++++++++++------------ src/views/LoginPage.vue | 2 +- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/component/LoginPage/googleLogin.vue b/src/component/LoginPage/googleLogin.vue index a560dadc..f9d5ff1f 100644 --- a/src/component/LoginPage/googleLogin.vue +++ b/src/component/LoginPage/googleLogin.vue @@ -6,7 +6,6 @@ {{ $props.text }}
-
@@ -38,34 +37,37 @@ // 使用谷歌登录的api const createGmailLogin = async ()=>{ var existingScript = document.querySelector(`script[src="${data.scriptSrc}"]`); - if(!existingScript){ - await new Promise((resolve, reject) => { - const script = document.createElement("script"); - script.src = data.scriptSrc - script.onload=()=>{ - resolve() - } - document.body.appendChild(script); - }) - } - window.google.accounts.id.initialize({ - // 主要就是填写client_id - client_id: GOOGLE_CLIENT_ID, - auto_select: false, - callback: handleCredentialResponse, - // context:"signin", - ux_mode:"popup", - itp_support:true, - }); - window.google.accounts.id.renderButton( - document.querySelector('.Container #g_id_signin'), - { - type:"icon",//icon为只有一个icon - shape:"circle", - theme:"outline", - size:"large", - logo_alignment:"center", + if(!window.isAddGmail){ + if(!existingScript){ + window.isAddGmail = true + await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.src = data.scriptSrc + script.onload=()=>{ + resolve() + } + document.body.appendChild(script); + }) + } + window.google.accounts.id.initialize({ + // 主要就是填写client_id + client_id: GOOGLE_CLIENT_ID, + auto_select: false, + callback: handleCredentialResponse, + // context:"signin", + ux_mode:"popup", + itp_support:true, }); + window.google.accounts.id.renderButton( + document.querySelector('.Container #g_id_signin'), + { + type:"icon",//icon为只有一个icon + shape:"circle", + theme:"outline", + size:"large", + logo_alignment:"center", + }); + } } onBeforeUnmount(()=>{ var existingScript = document.querySelector(`script[src="${data.scriptSrc}"]`); @@ -133,7 +135,7 @@ .S9gUrf-YoZ4jf{ width: 100%; height: 100%; - iframe{ + :deep(iframe){ width: 100% !important; height: 100% !important; margin: 0 !important; diff --git a/src/views/LoginPage.vue b/src/views/LoginPage.vue index a7988843..6e48c64e 100644 --- a/src/views/LoginPage.vue +++ b/src/views/LoginPage.vue @@ -1010,7 +1010,7 @@ export default defineComponent({ } .thirdPartyLogin{ display: flex; - justify-content: flex-start; + // justify-content: flex-start; > div{ position: relative; margin-right: 1rem;