mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-27 03:09:45 +08:00
更新国际化支持:为站点Cookie更新对话框及相关组件添加多语言文本,提升用户体验
This commit is contained in:
@@ -4,6 +4,10 @@ import { Site } from '@/api/types'
|
||||
import { requiredValidator } from '@/@validators'
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import ProgressDialog from '../dialog/ProgressDialog.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
// 国际化
|
||||
const { t } = useI18n()
|
||||
|
||||
// 输入参数
|
||||
const cardProps = defineProps({
|
||||
@@ -33,7 +37,7 @@ const updateButtonDisable = ref(false)
|
||||
const progressDialog = ref(false)
|
||||
|
||||
// 进度文本
|
||||
const progressText = ref('请稍候 ...')
|
||||
const progressText = ref(t('dialog.siteCookieUpdate.processing'))
|
||||
|
||||
// 调用API,更新站点Cookie UA
|
||||
async function updateSiteCookie() {
|
||||
@@ -44,7 +48,7 @@ async function updateSiteCookie() {
|
||||
updateButtonDisable.value = true
|
||||
|
||||
progressDialog.value = true
|
||||
progressText.value = `正在更新 ${cardProps.site?.name} Cookie & UA ...`
|
||||
progressText.value = t('dialog.siteCookieUpdate.updating', { site: cardProps.site?.name })
|
||||
|
||||
const result: { [key: string]: any } = await api.get(`site/cookie/${cardProps.site?.id}`, {
|
||||
params: {
|
||||
@@ -55,9 +59,9 @@ async function updateSiteCookie() {
|
||||
})
|
||||
|
||||
if (result.success) {
|
||||
$toast.success(`${cardProps.site?.name} 更新Cookie & UA 成功!`)
|
||||
$toast.success(t('dialog.siteCookieUpdate.success', { site: cardProps.site?.name }))
|
||||
emit('done')
|
||||
} else $toast.error(`${cardProps.site?.name} 更新失败:${result.message}`)
|
||||
} else $toast.error(t('dialog.siteCookieUpdate.failed', { site: cardProps.site?.name, message: result.message }))
|
||||
|
||||
progressDialog.value = false
|
||||
updateButtonDisable.value = false
|
||||
@@ -69,19 +73,19 @@ async function updateSiteCookie() {
|
||||
<template>
|
||||
<VDialog max-width="30rem">
|
||||
<!-- Dialog Content -->
|
||||
<VCard title="更新站点Cookie & UA">
|
||||
<VCard :title="t('dialog.siteCookieUpdate.title')">
|
||||
<VDialogCloseBtn @click="emit('close')" />
|
||||
<VDivider />
|
||||
<VCardText>
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VRow>
|
||||
<VCol cols="12">
|
||||
<VTextField v-model="userPwForm.username" label="用户名" :rules="[requiredValidator]" />
|
||||
<VTextField v-model="userPwForm.username" :label="t('login.username')" :rules="[requiredValidator]" />
|
||||
</VCol>
|
||||
<VCol cols="12">
|
||||
<VTextField
|
||||
v-model="userPwForm.password"
|
||||
label="密码"
|
||||
:label="t('login.password')"
|
||||
:type="isPasswordVisible ? 'text' : 'password'"
|
||||
:append-inner-icon="isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
|
||||
:rules="[requiredValidator]"
|
||||
@@ -90,7 +94,7 @@ async function updateSiteCookie() {
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12">
|
||||
<VTextField v-model="userPwForm.code" label="两步验证" />
|
||||
<VTextField v-model="userPwForm.code" :label="t('login.otpCode')" />
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
@@ -105,7 +109,7 @@ async function updateSiteCookie() {
|
||||
prepend-icon="mdi-refresh"
|
||||
class="px-5"
|
||||
>
|
||||
开始更新
|
||||
{{ t('dialog.siteCookieUpdate.updateButton') }}
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
|
||||
@@ -1304,15 +1304,12 @@ export default {
|
||||
codeCopied: 'Task workflow code copied to clipboard!',
|
||||
},
|
||||
siteCookieUpdate: {
|
||||
title: 'Update Site Cookie',
|
||||
checkHint: 'Checking login status, please wait...',
|
||||
confirmUpdateTitle: 'Confirm Update',
|
||||
confirmUpdateMessage: "Do you want to update this site's cookie with the local cookie?",
|
||||
processing: 'Processing...',
|
||||
success: 'Cookie updated successfully',
|
||||
failed: 'Failed to update cookie',
|
||||
confirm: 'Confirm',
|
||||
cancel: 'Cancel',
|
||||
title: 'Update Site Cookie & UA',
|
||||
processing: 'Please wait...',
|
||||
updating: 'Updating {site} Cookie & UA...',
|
||||
success: '{site} Cookie & UA updated successfully!',
|
||||
failed: '{site} update failed: {message}',
|
||||
updateButton: 'Start Update',
|
||||
},
|
||||
siteAddEdit: {
|
||||
addTitle: 'Add Site',
|
||||
|
||||
@@ -1281,15 +1281,12 @@ export default {
|
||||
codeCopied: '任务流程代码已复制到剪贴板!',
|
||||
},
|
||||
siteCookieUpdate: {
|
||||
title: '更新站点Cookie',
|
||||
checkHint: '正在检查登录状态,请稍候...',
|
||||
confirmUpdateTitle: '确认更新',
|
||||
confirmUpdateMessage: '是否要用本地Cookie更新该站点的Cookie?',
|
||||
processing: '处理中...',
|
||||
success: '更新Cookie成功',
|
||||
failed: '更新Cookie失败',
|
||||
confirm: '确认',
|
||||
cancel: '取消',
|
||||
title: '更新站点Cookie & UA',
|
||||
processing: '请稍候...',
|
||||
updating: '正在更新 {site} Cookie & UA...',
|
||||
success: '{site} 更新Cookie & UA成功!',
|
||||
failed: '{site} 更新失败:{message}',
|
||||
updateButton: '开始更新',
|
||||
},
|
||||
siteAddEdit: {
|
||||
addTitle: '添加站点',
|
||||
|
||||
@@ -1278,15 +1278,12 @@ export default {
|
||||
codeCopied: '任務流程代碼已複製到剪貼簿!',
|
||||
},
|
||||
siteCookieUpdate: {
|
||||
title: '更新站點Cookie',
|
||||
checkHint: '正在檢查登入狀態,請稍候...',
|
||||
confirmUpdateTitle: '確認更新',
|
||||
confirmUpdateMessage: '是否要用本地Cookie更新該站點的Cookie?',
|
||||
processing: '處理中...',
|
||||
success: '更新Cookie成功',
|
||||
failed: '更新Cookie失敗',
|
||||
confirm: '確認',
|
||||
cancel: '取消',
|
||||
title: '更新站點Cookie & UA',
|
||||
processing: '請稍候...',
|
||||
updating: '正在更新 {site} Cookie & UA...',
|
||||
success: '{site} 更新Cookie & UA成功!',
|
||||
failed: '{site} 更新失敗:{message}',
|
||||
updateButton: '開始更新',
|
||||
},
|
||||
siteAddEdit: {
|
||||
addTitle: '新增站點',
|
||||
|
||||
Reference in New Issue
Block a user