From 5f2e93dde36a10fdf069a10caec13e09025ed961 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 2 May 2025 08:00:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8B=E8=BD=BD=E5=99=A8?= =?UTF-8?q?=E5=92=8C=E5=AA=92=E4=BD=93=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=80=89?= =?UTF-8?q?=E9=A1=B9=EF=BC=8C=E9=87=8D=E6=9E=84=E7=9B=B8=E5=85=B3=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=BB=A5=E6=94=AF=E6=8C=81=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E6=9B=B4=E6=96=B0=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E4=BB=A5=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/constants.ts | 45 +++++++++++++++++++--- src/components/cards/DirectoryCard.vue | 4 +- src/components/cards/DownloaderCard.vue | 16 ++++++-- src/components/cards/MediaServerCard.vue | 15 +++++--- src/components/cards/StorageCard.vue | 29 ++++++++++---- src/locales/en-US.ts | 5 +++ src/locales/zh-CN.ts | 9 ++++- src/locales/zh-TW.ts | 5 +++ src/views/setting/AccountSettingSystem.vue | 21 +++------- 9 files changed, 108 insertions(+), 41 deletions(-) diff --git a/src/api/constants.ts b/src/api/constants.ts index a30696ee..cbde31df 100644 --- a/src/api/constants.ts +++ b/src/api/constants.ts @@ -26,11 +26,6 @@ export const storageAttributes = [ icon: 'mdi-server-network-outline', remote: true, }, - { - type: 'custom', - icon: 'mdi-database', - remote: true, - }, ] export const storageIconDict = storageAttributes.reduce((dict, item) => { @@ -43,6 +38,46 @@ export const storageRemoteDict = storageAttributes.reduce((dict, item) => { return dict }, {} as Record) +export const downloaderOptions = [ + { + value: 'qbittorrent', + title: i18n.global.t('setting.system.qbittorrent'), + }, + { + value: 'transmission', + title: i18n.global.t('setting.system.transmission'), + }, +] + +export const downloaderDict = downloaderOptions.reduce((dict, item) => { + dict[item.value] = item.title + return dict +}, {} as Record) + +export const mediaServerOptions = [ + { + value: 'emby', + title: i18n.global.t('setting.system.emby'), + }, + { + value: 'jellyfin', + title: i18n.global.t('setting.system.jellyfin'), + }, + { + value: 'plex', + title: i18n.global.t('setting.system.plex'), + }, + { + value: 'trimemedia', + title: i18n.global.t('setting.system.trimeMedia'), + }, +] + +export const mediaServerDict = mediaServerOptions.reduce((dict, item) => { + dict[item.value] = item.title + return dict +}, {} as Record) + export const innerFilterRules = [ { title: i18n.global.t('filterRules.specSub'), value: ' SPECSUB ' }, { title: i18n.global.t('filterRules.cnSub'), value: ' CNSUB ' }, diff --git a/src/components/cards/DirectoryCard.vue b/src/components/cards/DirectoryCard.vue index 82829f70..1fa83712 100644 --- a/src/components/cards/DirectoryCard.vue +++ b/src/components/cards/DirectoryCard.vue @@ -33,8 +33,8 @@ const isCollapsed = ref(true) // 类型下拉字典 const typeItems = computed(() => [ { title: t('common.all'), value: '' }, - { title: t('media.movie'), value: '电影' }, - { title: t('media.tv'), value: '电视剧' }, + { title: t('mediaType.movie'), value: '电影' }, + { title: t('mediaType.tv'), value: '电视剧' }, ]) // 计算资源存储字典(整理方式为下载器时不能为远程存储) diff --git a/src/components/cards/DownloaderCard.vue b/src/components/cards/DownloaderCard.vue index 65526abc..f454504b 100644 --- a/src/components/cards/DownloaderCard.vue +++ b/src/components/cards/DownloaderCard.vue @@ -9,6 +9,7 @@ import transmission_image from '@images/logos/transmission.png' import custom_image from '@images/logos/downloader.png' import { cloneDeep } from 'lodash-es' import { useI18n } from 'vue-i18n' +import { downloaderDict } from '@/api/constants' // 获取i18n实例 const { t } = useI18n() @@ -173,11 +174,11 @@ onUnmounted(() => { /> {{ downloader.name }} -
+
{{ `↑ ${formatFileSize(upload_rate, 1)}/s ` }} {{ `↓ ${formatFileSize(download_rate, 1)}/s` }}
-
+
自定义下载器
@@ -324,11 +325,20 @@ onUnmounted(() => { + + + diff --git a/src/components/cards/MediaServerCard.vue b/src/components/cards/MediaServerCard.vue index 4b16cc39..2dcb4350 100644 --- a/src/components/cards/MediaServerCard.vue +++ b/src/components/cards/MediaServerCard.vue @@ -9,6 +9,7 @@ import custom_image from '@images/logos/mediaserver.png' import api from '@/api' import { cloneDeep } from 'lodash-es' import { useI18n } from 'vue-i18n' +import { mediaServerDict } from '@/api/constants' // 获取i18n实例 const { t } = useI18n() @@ -186,12 +187,12 @@ onMounted(() => {
{{ mediaserver.name }}
-
+
{{ item.amount }}
-
+
自定义媒体服务器
@@ -453,11 +454,15 @@ onMounted(() => { + + + diff --git a/src/components/cards/StorageCard.vue b/src/components/cards/StorageCard.vue index db5048b4..67e3a53d 100644 --- a/src/components/cards/StorageCard.vue +++ b/src/components/cards/StorageCard.vue @@ -15,6 +15,7 @@ import AlistConfigDialog from '../dialog/AlistConfigDialog.vue' import { useToast } from 'vue-toast-notification' import { isNullOrEmptyObject } from '@/@core/utils' import { useI18n } from 'vue-i18n' +import { storageIconDict } from '@/api/constants' // 国际化 const { t } = useI18n() @@ -50,6 +51,9 @@ const storage_ref = ref(props.storage) // 自定义存储名称 const customName = ref(props.storage.name) +// 自定义存储类型 +const storageType = ref(props.storage.type) + // 阿里云盘认证对话框 const aliyunAuthDialog = ref(false) // 115网盘认证对话框 @@ -76,11 +80,11 @@ function openStorageDialog() { case 'alist': aListConfigDialog.value = true break - case 'custom': - customConfigDialog.value = true + case 'local': + $toast.info(t('storage.noConfigNeeded')) break default: - $toast.info(t('storage.noConfigNeeded')) + customConfigDialog.value = true break } } @@ -98,10 +102,8 @@ const getIcon = computed(() => { return rclone_png case 'alist': return alist_png - case 'custom': - return custom_png default: - return storage_png + return custom_png } }) @@ -139,7 +141,9 @@ function handleDone() { rcloneConfigDialog.value = false aListConfigDialog.value = false customConfigDialog.value = false + // 更新存储 storage_ref.value.name = customName.value + storage_ref.value.type = storageType.value emit('done', storage_ref.value) } @@ -155,11 +159,11 @@ function onClose() {