mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 07:28:37 +08:00
fix torrent card
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import api from "@/api";
|
import api from "@/api";
|
||||||
import { Context } from "@/api/types";
|
import { Context } from "@/api/types";
|
||||||
|
import { useToast } from "vue-toast-notification";
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -9,6 +10,9 @@ const props = defineProps({
|
|||||||
height: String,
|
height: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 提示框
|
||||||
|
const $toast = useToast();
|
||||||
|
|
||||||
// 种子信息
|
// 种子信息
|
||||||
const torrent = ref(props.torrent?.torrent_info);
|
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(() => {
|
onMounted(() => {
|
||||||
getSiteIcon();
|
getSiteIcon();
|
||||||
@@ -40,12 +70,12 @@ onMounted(() => {
|
|||||||
<VImg :src="siteIcon" />
|
<VImg :src="siteIcon" />
|
||||||
</VAvatar>
|
</VAvatar>
|
||||||
</template>
|
</template>
|
||||||
<VCardTitle>
|
<VCardTitle @click="addDownload">
|
||||||
{{ media?.title }} {{ meta?.season_episode }}
|
{{ media?.title }} {{ meta?.season_episode }}
|
||||||
<span class="text-green-700 ms-2 text-sm">↑{{ torrent?.seeders }}</span>
|
<span class="text-green-700 ms-2 text-sm">↑{{ torrent?.seeders }}</span>
|
||||||
<span class="text-orange-700 ms-2 text-sm">↓{{ torrent?.peers }}</span>
|
<span class="text-orange-700 ms-2 text-sm">↓{{ torrent?.peers }}</span>
|
||||||
</VCardTitle>
|
</VCardTitle>
|
||||||
<VCardText>
|
<VCardText @click="openTorrentDetail">
|
||||||
{{ torrent?.title }}
|
{{ torrent?.title }}
|
||||||
</VCardText>
|
</VCardText>
|
||||||
<VCardText>{{ torrent?.description }}</VCardText>
|
<VCardText>{{ torrent?.description }}</VCardText>
|
||||||
@@ -55,6 +85,7 @@ onMounted(() => {
|
|||||||
size="small"
|
size="small"
|
||||||
v-for="label in torrent?.labels"
|
v-for="label in torrent?.labels"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
class="me-1"
|
||||||
>{{ label }}</VChip
|
>{{ label }}</VChip
|
||||||
>
|
>
|
||||||
</VCardItem>
|
</VCardItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user