fix: login i18n bug

--bug=1051922 --user=王孝刚 【国际化】扫码登录没有国际化 https://www.tapd.cn/57709429/s/1649970
This commit is contained in:
wxg0103 2025-01-22 18:55:11 +08:00 committed by wxg
parent bb77448231
commit 39e7119d9a
9 changed files with 359 additions and 348 deletions

View File

@ -18,7 +18,7 @@ export default {
ldap_filterPlaceholder: 'Please enter user filter', ldap_filterPlaceholder: 'Please enter user filter',
ldap_mapping: 'LDAP Attribute Mapping', ldap_mapping: 'LDAP Attribute Mapping',
ldap_mappingPlaceholder: 'Please enter LDAP attribute mapping', ldap_mappingPlaceholder: 'Please enter LDAP attribute mapping',
enableAuthentication: 'Enable LDAP Authentication', enableAuthentication: 'Enable LDAP Authentication'
}, },
cas: { cas: {
title: 'CAS Settings', title: 'CAS Settings',
@ -85,7 +85,9 @@ export default {
appSecretPlaceholder: 'Please enter APP secret', appSecretPlaceholder: 'Please enter APP secret',
corpIdPlaceholder: 'Please enter corp ID', corpIdPlaceholder: 'Please enter corp ID',
agentIdPlaceholder: 'Please enter agent ID', agentIdPlaceholder: 'Please enter agent ID',
callbackWarning: 'Please enter a valid URL address' callbackWarning: 'Please enter a valid URL address',
larkQrCode: 'Lark Scan Code Login',
dingtalkQrCode: 'DingTalk Scan Code Login'
} }
}, },
theme: { theme: {
@ -143,6 +145,6 @@ export default {
smtpPassword: 'SMTP Password', smtpPassword: 'SMTP Password',
smtpPasswordPlaceholder: 'Please enter SMTP password', smtpPasswordPlaceholder: 'Please enter SMTP password',
enableSSL: 'Enable SSL (if the SMTP port is 465, you usually need to enable SSL)', enableSSL: 'Enable SSL (if the SMTP port is 465, you usually need to enable SSL)',
enableTLS: 'Enable TLS (if the SMTP port is 587, you usually need to enable TLS)', enableTLS: 'Enable TLS (if the SMTP port is 587, you usually need to enable TLS)'
} }
} }

View File

@ -85,7 +85,9 @@ export default {
appSecretPlaceholder: '请输入 App Secret', appSecretPlaceholder: '请输入 App Secret',
corpIdPlaceholder: '请输入 Corp Id', corpIdPlaceholder: '请输入 Corp Id',
agentIdPlaceholder: '请输入 Agent Id', agentIdPlaceholder: '请输入 Agent Id',
callbackWarning: '请输入有效的 URL 地址' callbackWarning: '请输入有效的 URL 地址',
larkQrCode: '飞书扫码登录',
dingtalkQrCode: '钉钉扫码登录'
} }
}, },
theme: { theme: {

View File

@ -19,7 +19,7 @@ export default {
ldap_filterPlaceholder: '請輸入使用者過濾器', ldap_filterPlaceholder: '請輸入使用者過濾器',
ldap_mapping: 'LDAP 屬性對應', ldap_mapping: 'LDAP 屬性對應',
ldap_mappingPlaceholder: '請輸入 LDAP 屬性對應', ldap_mappingPlaceholder: '請輸入 LDAP 屬性對應',
enableAuthentication: '啟用 LDAP 認證', enableAuthentication: '啟用 LDAP 認證'
}, },
cas: { cas: {
title: 'CAS 設定', title: 'CAS 設定',
@ -86,7 +86,9 @@ export default {
appSecretPlaceholder: '請輸入 App Secret', appSecretPlaceholder: '請輸入 App Secret',
corpIdPlaceholder: '請輸入 Corp Id', corpIdPlaceholder: '請輸入 Corp Id',
agentIdPlaceholder: '請輸入 Agent Id', agentIdPlaceholder: '請輸入 Agent Id',
callbackWarning: '請輸入有效的 URL 位址' callbackWarning: '請輸入有效的 URL 位址',
larkQrCode: '飛書掃碼登錄',
dingtalkQrCode: '釘釘掃碼登錄'
} }
}, },
theme: { theme: {
@ -142,6 +144,6 @@ export default {
smtpPassword: '發件人密碼', smtpPassword: '發件人密碼',
smtpPasswordPlaceholder: '請輸入發件人密碼', smtpPasswordPlaceholder: '請輸入發件人密碼',
enableSSL: '啟用 SSL如果 SMTP 端口是 465通常需要啟用 SSL', enableSSL: '啟用 SSL如果 SMTP 端口是 465通常需要啟用 SSL',
enableTLS: '啟用 TLS如果 SMTP 端口是 587通常需要啟用 TLS', enableTLS: '啟用 TLS如果 SMTP 端口是 587通常需要啟用 TLS'
} }
} }

View File

@ -26,9 +26,8 @@
</div> </div>
</template> </template>
<el-row :gutter="8"> <div class="flex">
<el-col :span="12"> <div class="setting-preview border border-r-4 mr-16" style="min-width: 400px">
<div class="setting-preview border border-r-4 mr-16">
<div class="setting-preview-container"> <div class="setting-preview-container">
<div class="setting-preview-header" :style="customStyle"> <div class="setting-preview-header" :style="customStyle">
<div class="flex-between"> <div class="flex-between">
@ -121,12 +120,7 @@
class="p-16 text-center w-full" class="p-16 text-center w-full"
> >
<img src="@/assets/display-bg1.png" alt="" class="w-full" /> <img src="@/assets/display-bg1.png" alt="" class="w-full" />
<el-text <el-text type="info" v-if="xpackForm.disclaimer" class="mt-8" style="font-size: 12px">
type="info"
v-if="xpackForm.disclaimer"
class="mt-8"
style="font-size: 12px"
>
<auto-tooltip :content="xpackForm.disclaimer_value"> <auto-tooltip :content="xpackForm.disclaimer_value">
{{ xpackForm.disclaimer_value }} {{ xpackForm.disclaimer_value }}
</auto-tooltip> </auto-tooltip>
@ -151,8 +145,7 @@
/> />
</div> </div>
</div> </div>
</el-col>
<el-col :span="12">
<el-form ref="displayFormRef" :model="form"> <el-form ref="displayFormRef" :model="form">
<el-row class="w-full mb-8"> <el-row class="w-full mb-8">
<el-col :span="12"> <el-col :span="12">
@ -371,8 +364,7 @@
></span> ></span>
</el-space> </el-space>
</el-form> </el-form>
</el-col> </div>
</el-row>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex-center mb-16"> <div class="flex-center mb-16">
<img src="@/assets/logo_dingtalk.svg" alt="" width="24px" class="mr-4" /> <img src="@/assets/logo_dingtalk.svg" alt="" width="24px" class="mr-4" />
<h2>钉钉扫码登录</h2> <h2>{{ $t('views.system.authentication.scanTheQRCode.dingtalkQrCode') }}</h2>
</div> </div>
<div class="ding-talk-qrName"> <div class="ding-talk-qrName">
<div id="ding-talk-qr"></div> <div id="ding-talk-qr"></div>
@ -14,6 +14,7 @@ import { useScriptTag } from '@vueuse/core'
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import useStore from '@/stores' import useStore from '@/stores'
import { MsgError } from '@/utils/message' import { MsgError } from '@/utils/message'
import { t } from '@/locales'
// DTFrameLogin QRLogin // DTFrameLogin QRLogin
declare global { declare global {

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex-center mb-16"> <div class="flex-center mb-16">
<img src="@/assets/logo_lark.svg " alt="" width="24px" class="mr-4" /> <img src="@/assets/logo_lark.svg " alt="" width="24px" class="mr-4" />
<h2>飞书扫码登录</h2> <h2>{{ $t('views.system.authentication.scanTheQRCode.larkQrCode') }}</h2>
</div> </div>
<div id="lark-qr" class="lark-qrName"></div> <div id="lark-qr" class="lark-qrName"></div>
</template> </template>

View File

@ -5,7 +5,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import * as ww from '@wecom/jssdk' import * as ww from '@wecom/jssdk'
import { WWLoginPanelSizeType, WWLoginRedirectType, WWLoginType } from '@wecom/jssdk' import {
WWLoginLangType,
WWLoginPanelSizeType,
WWLoginRedirectType,
WWLoginType
} from '@wecom/jssdk'
import { ref, nextTick, defineProps } from 'vue' import { ref, nextTick, defineProps } from 'vue'
import { MsgError } from '@/utils/message' import { MsgError } from '@/utils/message'
import useStore from '@/stores' import useStore from '@/stores'
@ -31,6 +36,7 @@ const init = async () => {
corpId: props.config.corp_id, corpId: props.config.corp_id,
agentId: props.config.agent_id agentId: props.config.agent_id
} }
const lang = localStorage.getItem('MaxKB-locale') || 'zh-CN'
const redirectUri = window.location.origin const redirectUri = window.location.origin
try { try {
wwLogin.value = ww.createWWLoginPanel({ wwLogin.value = ww.createWWLoginPanel({
@ -41,6 +47,7 @@ const init = async () => {
agentid: data.agentId, agentid: data.agentId,
redirect_uri: redirectUri, redirect_uri: redirectUri,
state: 'fit2cloud-wecom-qr', state: 'fit2cloud-wecom-qr',
lang: lang === 'zh-CN' || lang === 'zh-Hant' ? WWLoginLangType.zh : WWLoginLangType.en,
redirect_type: WWLoginRedirectType.callback, redirect_type: WWLoginRedirectType.callback,
panel_size: WWLoginPanelSizeType.small panel_size: WWLoginPanelSizeType.small
}, },

View File

@ -249,7 +249,12 @@ onMounted(() => {
QrList.value.forEach((item) => { QrList.value.forEach((item) => {
orgOptions.value.push({ orgOptions.value.push({
key: item, key: item,
value: item === 'wecom' ? '企业微信' : item === 'dingtalk' ? '钉钉' : '飞书' value:
item === 'wecom'
? t('views.system.authentication.scanTheQRCode.wecom')
: item === 'dingtalk'
? t('views.system.authentication.scanTheQRCode.dingtalk')
: t('views.system.authentication.scanTheQRCode.lark')
}) })
}) })
} }

View File

@ -202,31 +202,31 @@
v-model="themeForm.showUserManual" v-model="themeForm.showUserManual"
:label="$t('views.system.theme.showUserManual')" :label="$t('views.system.theme.showUserManual')"
/> />
<div class="ml-16"> <div class="ml-24">
<el-input <el-input
v-model="themeForm.userManualUrl" v-model="themeForm.userManualUrl"
:placeholder="$t('views.system.theme.urlPlaceholder')" :placeholder="$t('views.system.theme.urlPlaceholder')"
/> />
</div> </div>
</div> </div>
<div class="my-2"> <div class="mt-4">
<el-checkbox <el-checkbox
v-model="themeForm.showForum" v-model="themeForm.showForum"
:label="$t('views.system.theme.showForum')" :label="$t('views.system.theme.showForum')"
/> />
<div class="ml-16"> <div class="ml-24">
<el-input <el-input
v-model="themeForm.forumUrl" v-model="themeForm.forumUrl"
:placeholder="$t('views.system.theme.urlPlaceholder')" :placeholder="$t('views.system.theme.urlPlaceholder')"
/> />
</div> </div>
</div> </div>
<div class="mt-2"> <div class="mt-4">
<el-checkbox <el-checkbox
v-model="themeForm.showProject" v-model="themeForm.showProject"
:label="$t('views.system.theme.showProject')" :label="$t('views.system.theme.showProject')"
/> />
<div class="ml-16"> <div class="ml-24">
<el-input <el-input
v-model="themeForm.projectUrl" v-model="themeForm.projectUrl"
:placeholder="$t('views.system.theme.urlPlaceholder')" :placeholder="$t('views.system.theme.urlPlaceholder')"