fix torrent card

This commit is contained in:
jxxghp
2023-07-08 14:38:05 +08:00
parent 95c0c35dc4
commit 777d32b750
2 changed files with 67 additions and 5 deletions

View File

@@ -95,6 +95,8 @@ export interface MediaInfo {
title?: string
// 年份
year?: string
// 标题(年)
title_year?: string
// 季号
season?: number;
// TMDB ID
@@ -121,31 +123,50 @@ export interface MediaInfo {
overview?: string
// 二级分类
category?: string
// 详情页面
detail_link?: string
}
// TMDB季信息
export interface TmdbSeason {
// 上映日期
air_date?: string
// 总集数
episode_count?: number
// 季名称
name?: string
// 描述
overview?: string
// 海报
poster_path?: string
// 季号
season_number?: number
// 评分
vote_average?: number
}
// TMDB集信息
export interface TmdbEpisodes {
// 上映日期
air_date?: string
// 集号
episode_number?: number
// 剧集名称
name?: string
// 描述
overview?: string
// 时长
runtime?: number
// 季号
season_number?: number
// 海报
still_path?: string
// 评分
vote_average?: number
// 演职人员
crew: Object[]
// 嘉宾
guest_stars: Object[]
}

View File

@@ -1,4 +1,5 @@
<script lang="ts" setup>
import api from "@/api";
import { Context } from "@/api/types";
// 输入参数
@@ -7,15 +8,55 @@ const props = defineProps({
width: String,
height: String,
});
// 种子信息
const torrent = ref(props.torrent?.torrent_info);
// 媒体信息
const media = ref(props.torrent?.media_info);
// 识别元数据
const meta = ref(props.torrent?.meta_info);
// 站点图标
const siteIcon = ref("");
// 查询站点图标
const getSiteIcon = async () => {
try {
siteIcon.value = (await api.get("site/icon/" + torrent?.value?.site)).data.icon;
} catch (error) {
console.error(error);
}
};
// 装载时查询站点图标
onMounted(() => {
getSiteIcon();
});
</script>
<template>
<VCard :width="props.width" :height="props.height">
<VCardItem>
<VCardTitle>{{ props.torrent?.torrent_info.title }}</VCardTitle>
</VCardItem>
<template #image>
<VAvatar class="absolute right-2 bottom-2" variant="flat" rounded="0">
<VImg :src="siteIcon" />
</VAvatar>
</template>
<VCardTitle>
{{ 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>
{{ props.torrent?.torrent_info.description }}
{{ torrent?.title }}
</VCardText>
<VCardText>{{ torrent?.description }}</VCardText>
<VCardItem class="pb-3 pt-0" v-if="torrent?.labels">
<VChip
variant="elevated"
size="small"
v-for="label in torrent?.labels"
color="primary"
>{{ label }}</VChip
>
</VCardItem>
</VCard>
</template>