mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-11 18:10:49 +08:00
fix
This commit is contained in:
@@ -151,7 +151,7 @@ onMounted(checkSubscribe);
|
||||
variant="elevated"
|
||||
size="small"
|
||||
v-if="props.media?.vote_average"
|
||||
:class="getChipColor('')"
|
||||
:class="getChipColor('rating')"
|
||||
class="absolute right-2 top-2 bg-opacity-80 shadow-md text-white font-bold"
|
||||
>
|
||||
{{ props.media?.vote_average }}
|
||||
|
||||
@@ -12,16 +12,16 @@ const props = defineProps({
|
||||
const siteIcon = ref<string>("");
|
||||
|
||||
// 查询站点图标
|
||||
const getSiteIcon = async (siteid: number) => {
|
||||
const getSiteIcon = async () => {
|
||||
try {
|
||||
siteIcon.value = (await api.get("site/icon/" + siteid)).data.icon;
|
||||
siteIcon.value = (await api.get("site/icon/" + props.site?.id)).data.icon;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getSiteIcon(props.site?.id ?? 0);
|
||||
getSiteIcon();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
// 根据 type 返回不同的图标
|
||||
const getIcon = (type: string) => {
|
||||
if (type === "电影") {
|
||||
const getIcon = () => {
|
||||
if (props.media?.type === "电影") {
|
||||
return "mdi-movie";
|
||||
} else if (type === "电视剧") {
|
||||
} else if (props.media?.type === "电视剧") {
|
||||
return "mdi-television-classic";
|
||||
} else {
|
||||
return "mdi-help-circle";
|
||||
@@ -19,23 +19,22 @@ const getIcon = (type: string) => {
|
||||
};
|
||||
|
||||
// 计算百分比
|
||||
const getPercentage = (total: number, lack: number) => {
|
||||
if (total === 0) {
|
||||
const getPercentage = () => {
|
||||
if (props.media?.total_episode === 0) {
|
||||
return 0;
|
||||
}
|
||||
return Math.round(((total - lack) / total) * 100);
|
||||
return Math.round((((props.media?.total_episode || 0) - (props.media?.lack_episode || 0)) / (props.media?.total_episode || 1)) * 100);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard
|
||||
:key="props.media?.id"
|
||||
:image="props.media?.backdrop || props.media?.poster"
|
||||
class="card-with-overlay"
|
||||
>
|
||||
<VCard :key="props.media?.id">
|
||||
<template #image>
|
||||
<VImg :src="props.media?.backdrop || props.media?.poster" aspect-ratio="2/3" cover class="brightness-50" />
|
||||
</template>
|
||||
<VCardItem>
|
||||
<template #prepend>
|
||||
<VIcon size="1.9rem" color="white" :icon="getIcon(props.media?.type || '')" />
|
||||
<VIcon size="1.9rem" color="white" :icon="getIcon()" />
|
||||
</template>
|
||||
<VCardTitle class="text-white">
|
||||
{{ props.media?.name }}
|
||||
@@ -59,32 +58,13 @@ const getPercentage = (total: number, lack: number) => {
|
||||
<IconBtn icon="mdi-star" color="white" class="me-1" />
|
||||
<span class="text-subtitle-2 text-white me-4">{{ props.media?.vote }}</span>
|
||||
|
||||
<IconBtn
|
||||
icon="mdi-progress-clock"
|
||||
color="white"
|
||||
class="me-1"
|
||||
v-if="props.media?.total_episode"
|
||||
/>
|
||||
<span class="text-subtitle-2 text-white" v-if="props.media?.season"
|
||||
>{{ (props.media?.total_episode || 0) - (props.media?.lack_episode || 0) }} /
|
||||
{{ props.media?.total_episode }}</span
|
||||
>
|
||||
<IconBtn icon="mdi-progress-clock" color="white" class="me-1" v-if="props.media?.total_episode" />
|
||||
<span class="text-subtitle-2 text-white" v-if="props.media?.season">{{ (props.media?.total_episode || 0) -
|
||||
(props.media?.lack_episode || 0) }} /
|
||||
{{ props.media?.total_episode }}</span>
|
||||
</div>
|
||||
</VCardText>
|
||||
|
||||
<VProgressLinear
|
||||
v-if="props.media?.lack_episode || 0 > 0"
|
||||
:model-value="
|
||||
getPercentage(props.media?.total_episode || 0, props.media?.lack_episode || 0)
|
||||
"
|
||||
bg-color="success"
|
||||
color="success"
|
||||
/>
|
||||
<VProgressLinear v-if="getPercentage() > 0" :model-value="getPercentage()" bg-color="success" color="success" />
|
||||
</VCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.card-with-overlay img {
|
||||
@apply brightness-50;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -28,5 +28,6 @@ onMounted(fetchData);
|
||||
<style type="scss">
|
||||
.grid-site-card {
|
||||
grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
|
||||
padding-block-end: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -51,5 +51,6 @@ const filteredDataList = computed(() => {
|
||||
<style type="scss">
|
||||
.grid-subscribe-card {
|
||||
grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
|
||||
padding-block-end: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user