mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-06-08 01:00:36 +08:00
更新国际化支持:在多个对话框组件中引入 vue-i18n,优化文本翻译,确保多语言显示的一致性和准确性。
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||
import api from '@/api'
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
// 多语言支持
|
||||
const { t } = useI18n()
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['done', 'close'])
|
||||
@@ -89,17 +93,17 @@ async function handleDone() {
|
||||
// 认证处理
|
||||
async function checkUser() {
|
||||
if (!authForm.value.site) {
|
||||
$toast.error('请选择认证站点!')
|
||||
$toast.error(t('dialog.userAuth.selectSiteRequired'))
|
||||
return
|
||||
}
|
||||
if (!authSites.value[authForm.value.site]) {
|
||||
$toast.error('站点配置不存在!')
|
||||
$toast.error(t('dialog.userAuth.siteConfigNotExist'))
|
||||
return
|
||||
}
|
||||
if (formFields.value.length > 0) {
|
||||
for (const field of formFields.value) {
|
||||
if (!authForm.value.params[field.site.toUpperCase() + '_' + field.key.toUpperCase()]) {
|
||||
$toast.error(`请输入${field.name}!`)
|
||||
$toast.error(t('dialog.userAuth.fieldRequired', { name: field.name }))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -108,13 +112,13 @@ async function checkUser() {
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post(`site/auth`, authForm.value)
|
||||
if (result.success) {
|
||||
$toast.success('用户认证成功,请重新登录!')
|
||||
$toast.success(t('dialog.userAuth.authSuccess'))
|
||||
// 1秒后刷新页面
|
||||
setTimeout(() => {
|
||||
emit('done')
|
||||
}, 1000)
|
||||
} else {
|
||||
$toast.error(`认证失败:${result.message}`)
|
||||
$toast.error(t('dialog.userAuth.authFailed', { message: result.message }))
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
@@ -130,7 +134,7 @@ onMounted(async () => {
|
||||
|
||||
<template>
|
||||
<VDialog width="40rem" max-height="85vh">
|
||||
<VCard title="用户认证" class="rounded-t">
|
||||
<VCard :title="t('dialog.userAuth.title')" class="rounded-t">
|
||||
<VDialogCloseBtn @click="emit('close')" />
|
||||
<VCardText>
|
||||
<VRow>
|
||||
@@ -140,7 +144,7 @@ onMounted(async () => {
|
||||
:items="dropdownItems"
|
||||
item-value="key"
|
||||
item-title="name"
|
||||
label="选择认证站点"
|
||||
:label="t('dialog.userAuth.selectSite')"
|
||||
item-props
|
||||
>
|
||||
</VSelect>
|
||||
@@ -169,7 +173,7 @@ onMounted(async () => {
|
||||
size="large"
|
||||
:disabled="loading"
|
||||
>
|
||||
开始认证
|
||||
{{ t('dialog.userAuth.authBtn') }}
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
|
||||
Reference in New Issue
Block a user