From 193e3085a9aab80418648abc55a17b63e275354e Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 13 Apr 2024 09:01:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=B8=8B=E8=BD=BD=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/TorrentCard.vue | 9 +++++++-- src/components/cards/TorrentItem.vue | 13 ++++++++++--- src/views/discover/TorrentRowListView.vue | 6 +++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/cards/TorrentCard.vue b/src/components/cards/TorrentCard.vue index 11cc1463..863542f1 100644 --- a/src/components/cards/TorrentCard.vue +++ b/src/components/cards/TorrentCard.vue @@ -5,7 +5,7 @@ import { useConfirm } from 'vuetify-use-dialog' import { formatFileSize } from '@/@core/utils/formatters' import api from '@/api' import { doneNProgress, startNProgress } from '@/api/nprogress' -import type { Context } from '@/api/types' +import type { Context, MediaInfo, TorrentInfo } from '@/api/types' // 输入参数 const props = defineProps({ @@ -36,6 +36,9 @@ const meta = ref(props.torrent?.meta_info) // 站点图标 const siteIcon = ref('') +// 存储是否已经下载过的记录 +const downloaded = ref([]) + // 查询站点图标 async function getSiteIcon() { try { @@ -76,7 +79,7 @@ async function handleAddDownload(_site: any = undefined, } // 添加下载 -async function addDownload(_media: any, _torrent: any) { +async function addDownload(_media: MediaInfo, _torrent: TorrentInfo) { startNProgress() try { const result: { [key: string]: any } = await api.post('download/', { @@ -87,6 +90,7 @@ async function addDownload(_media: any, _torrent: any) { if (result.success) { // 添加下载成功 $toast.success(`${_torrent?.site_name} ${_torrent?.title} 添加下载成功!`) + downloaded.value.push(_torrent?.enclosure || '') } else { // 添加下载失败 @@ -131,6 +135,7 @@ onMounted(() => {