mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-12 02:21:06 +08:00
fix torrent card
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import api from "@/api";
|
||||
import { Context } from "@/api/types";
|
||||
import { useToast } from "vue-toast-notification";
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
@@ -9,6 +10,9 @@ const props = defineProps({
|
||||
height: String,
|
||||
});
|
||||
|
||||
// 提示框
|
||||
const $toast = useToast();
|
||||
|
||||
// 种子信息
|
||||
const torrent = ref(props.torrent?.torrent_info);
|
||||
// 媒体信息
|
||||
@@ -28,6 +32,32 @@ const getSiteIcon = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 添加下载
|
||||
const addDownload = async () => {
|
||||
try {
|
||||
const result: { [key: string]: Any } = await api.post("download/add", {
|
||||
torrent_info: torrent?.value,
|
||||
media_info: media?.value,
|
||||
meta_info: meta?.value,
|
||||
});
|
||||
if (result.success) {
|
||||
// 添加下载成功
|
||||
$toast.success(
|
||||
`${torrent.value?.site_name} ${torrent.value?.title} 添加下载成功!`
|
||||
);
|
||||
} else {
|
||||
console.log(`添加下载失败:${result.message}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
// 打开种子详情
|
||||
const openTorrentDetail = () => {
|
||||
window.open(torrent?.value?.page_url, "_blank");
|
||||
};
|
||||
|
||||
// 装载时查询站点图标
|
||||
onMounted(() => {
|
||||
getSiteIcon();
|
||||
@@ -40,12 +70,12 @@ onMounted(() => {
|
||||
<VImg :src="siteIcon" />
|
||||
</VAvatar>
|
||||
</template>
|
||||
<VCardTitle>
|
||||
<VCardTitle @click="addDownload">
|
||||
{{ media?.title }} {{ meta?.season_episode }}
|
||||
<span class="text-green-700 ms-2 text-sm">↑{{ torrent?.seeders }}</span>
|
||||
<span class="text-orange-700 ms-2 text-sm">↓{{ torrent?.peers }}</span>
|
||||
</VCardTitle>
|
||||
<VCardText>
|
||||
<VCardText @click="openTorrentDetail">
|
||||
{{ torrent?.title }}
|
||||
</VCardText>
|
||||
<VCardText>{{ torrent?.description }}</VCardText>
|
||||
@@ -55,6 +85,7 @@ onMounted(() => {
|
||||
size="small"
|
||||
v-for="label in torrent?.labels"
|
||||
color="primary"
|
||||
class="me-1"
|
||||
>{{ label }}</VChip
|
||||
>
|
||||
</VCardItem>
|
||||
|
||||
Reference in New Issue
Block a user