From 1e77138f3d54f26782b2f1d15515911fb244bf44 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 9 Jul 2023 09:16:38 +0800 Subject: [PATCH] torrents more --- src/components/cards/TorrentCard.vue | 64 ++++++++++++++++++---- src/views/discover/TorrentCardListView.vue | 48 +++++++++++++++- 2 files changed, 98 insertions(+), 14 deletions(-) diff --git a/src/components/cards/TorrentCard.vue b/src/components/cards/TorrentCard.vue index 61a34e9d..d4f6e515 100644 --- a/src/components/cards/TorrentCard.vue +++ b/src/components/cards/TorrentCard.vue @@ -9,6 +9,7 @@ import { useConfirm } from "vuetify-use-dialog"; // 输入参数 const props = defineProps({ torrent: Object as PropType, + more: Array as PropType, width: String, height: String, }); @@ -19,6 +20,9 @@ const $toast = useToast(); // 确认框 const createConfirm = useConfirm(); +// 更多来源界面 +const showMoreTorrents = ref(false); + // 种子信息 const torrent = ref(props.torrent?.torrent_info); // 媒体信息 @@ -39,10 +43,19 @@ const getSiteIcon = async () => { }; // 询问并添加下载 -const handleAddDownload = async () => { +const handleAddDownload = async ( + _site: any = undefined, + _media: any = undefined, + _torrent: any = undefined +) => { + if (!_media || !_torrent || !_site) { + _site = torrent.value?.site_name; + _media = media.value; + _torrent = torrent.value; + } const isConfirmed = await createConfirm({ title: "确认", - content: `是否确认下载 ${torrent.value?.title} ?`, + content: `是否确认下载【${_site}】${_torrent?.title} ?`, confirmationText: "确认", cancellationText: "取消", dialogProps: { @@ -52,25 +65,23 @@ const handleAddDownload = async () => { if (!isConfirmed) return; - addDownload(); + addDownload(_media, _torrent); }; // 添加下载 -const addDownload = async () => { +const addDownload = async (_media: any, _torrent: any) => { startNProgress(); try { const result: { [key: string]: any } = await api.post("download", { - media_in: media?.value, - torrent_in: torrent?.value, + media_in: _media, + torrent_in: _torrent, }); if (result.success) { // 添加下载成功 - $toast.success( - `${torrent.value?.site_name} ${torrent.value?.title} 添加下载成功!` - ); + $toast.success(`${_torrent?.site_name} ${_torrent?.title} 添加下载成功!`); } else { // 添加下载失败 - $toast.error(`${torrent.value?.site_name} ${torrent.value?.title} 添加下载失败!`); + $toast.error(`${_torrent?.site_name} ${_torrent?.title} 添加下载失败!`); } } catch (error) { console.error(error); @@ -108,12 +119,12 @@ onMounted(() => {