修复切换语言,登录页谷歌登录和微信登录按钮添加语言适配

This commit is contained in:
X1627315083
2025-12-15 10:59:24 +08:00
parent c9b65b6090
commit b5f393ceb7
5 changed files with 23 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
<!-- <div class="icon" @click="toGmailLogin"> --> <!-- <div class="icon" @click="toGmailLogin"> -->
<div class="icon"> <div class="icon">
<img src="@/assets/images/loginPage/gmailIcon.svg" alt=""> <img src="@/assets/images/loginPage/gmailIcon.svg" alt="">
<span>{{ $props.text }}</span> <span>{{ displayText }}</span>
</div> </div>
</div> </div>
</template> </template>
@@ -21,7 +21,7 @@
props: { props: {
text: { text: {
type: String, type: String,
default: 'Sign in with Google' default: ''
} }
}, },
setup(props, { emit }) { setup(props, { emit }) {
@@ -108,6 +108,9 @@
const toGmailLogin = ()=>{ const toGmailLogin = ()=>{
message.info(t('account.canNotUtilize')) message.info(t('account.canNotUtilize'))
} }
const displayText = computed(() => {
return props.text || t('Login.LoginWithGoogle')
})
onBeforeUnmount(()=>{ onBeforeUnmount(()=>{
var existingScript = document.querySelector(`script[src="${data.scriptSrc}"]`); var existingScript = document.querySelector(`script[src="${data.scriptSrc}"]`);
if(existingScript){ if(existingScript){
@@ -120,6 +123,7 @@
}) })
return { return {
toGmailLogin, toGmailLogin,
displayText,
} }
}, },
}) })

View File

@@ -2,7 +2,7 @@
<div class="Container"> <div class="Container">
<div class="icon" @click="openWeiXinModel"> <div class="icon" @click="openWeiXinModel">
<img src="@/assets/images/loginPage/weiXinIcon.svg" alt="" /> <img src="@/assets/images/loginPage/weiXinIcon.svg" alt="" />
<span>{{ $props.text }}</span> <span>{{ displayText }}</span>
</div> </div>
<weiXinModel ref="weiXinModel"></weiXinModel> <weiXinModel ref="weiXinModel"></weiXinModel>
</div> </div>
@@ -18,6 +18,7 @@ import {
toRefs, toRefs,
} from "vue"; } from "vue";
import weiXinModel from "./weiXinModel.vue"; import weiXinModel from "./weiXinModel.vue";
import { useI18n } from 'vue-i18n'
export default defineComponent({ export default defineComponent({
name: "login", name: "login",
components: { components: {
@@ -26,20 +27,25 @@ export default defineComponent({
props: { props: {
text: { text: {
type: String, type: String,
default: "Sign in with Wechat", default: ''
}, },
}, },
setup() { setup(props) {
let weiXinDom = reactive({ let weiXinDom = reactive({
weiXinModel: null, weiXinModel: null,
}); });
const { t } = useI18n()
const openWeiXinModel = () => { const openWeiXinModel = () => {
weiXinDom.weiXinModel.init(); weiXinDom.weiXinModel.init();
}; };
const displayText = computed(() => {
return props.text || t('Login.LoginWithWechat')
})
onMounted(() => {}); onMounted(() => {});
return { return {
...toRefs(weiXinDom), ...toRefs(weiXinDom),
openWeiXinModel, openWeiXinModel,
displayText,
}; };
}, },
}); });

View File

@@ -1543,11 +1543,13 @@ export default {
LoginMethod: '使用以下方式登录:', LoginMethod: '使用以下方式登录:',
Individual: '个人账号', Individual: '个人账号',
Academic: '学术账号', Academic: '学术账号',
LogoOnToAiDA: '登录到AiDA 3.1', LogonToAiDA: '登录到AiDA 3.1',
Infomation: '请填写以下信息', Infomation: '请填写以下信息',
Device: '请使用iPad或电脑登录', Device: '请使用iPad或电脑登录',
AgreePolicies: '请勾选条款、隐私政策和费用', AgreePolicies: '请勾选条款、隐私政策和费用',
PasswordConditions: '您必须满足所有密码条件才能注册' PasswordConditions: '您必须满足所有密码条件才能注册',
LoginWithGoogle: '使用谷歌账号登录',
LoginWithWechat: '使用微信登录',
}, },
LoginPersonal: { LoginPersonal: {
Email: '邮箱', Email: '邮箱',

View File

@@ -1591,7 +1591,9 @@ export default {
Infomation: 'Please fill your information below', Infomation: 'Please fill your information below',
Device: 'If you need to design, please log in using an iPad or computer.', Device: 'If you need to design, please log in using an iPad or computer.',
AgreePolicies: 'Please agree to all terms, privacy policy, and fees.', AgreePolicies: 'Please agree to all terms, privacy policy, and fees.',
PasswordConditions: 'You must satisfy ALL password conditions to register.' PasswordConditions: 'You must satisfy ALL password conditions to register.',
LoginWithGoogle: 'Sign in with Google',
LoginWithWechat: 'Sign in with Wechat',
}, },
LoginPersonal: { LoginPersonal: {
Email: 'Email', Email: 'Email',

View File

@@ -432,6 +432,7 @@
ref="home" ref="home"
@setNewProject="() => (leftShow = true)" @setNewProject="() => (leftShow = true)"
@setTask="setTask" @setTask="setTask"
:key="userDetail.language"
></home> ></home>
</div> </div>
</div> </div>