fix douan image

This commit is contained in:
jxxghp
2023-07-10 12:26:38 +08:00
parent 4734d1e56d
commit e6b7535773
3 changed files with 18 additions and 3 deletions
+2 -1
View File
@@ -7,6 +7,7 @@
<meta name="viewport" content="initial-scale=1, viewport-fit=cover, width=device-width, user-scalable=no" /> <meta name="viewport" content="initial-scale=1, viewport-fit=cover, width=device-width, user-scalable=no" />
<title>MoviePilot</title> <title>MoviePilot</title>
<meta name="Robots" content="noindex,nofollow,noarchive"> <meta name="Robots" content="noindex,nofollow,noarchive">
<meta name="referrer" content="origin">
<link rel="icon" type="image/png" href="/logo.png"> <link rel="icon" type="image/png" href="/logo.png">
<link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="apple-touch-startup-image" href="/splash/apple-splash-750-1334.png"> <link rel="apple-touch-startup-image" href="/splash/apple-splash-750-1334.png">
@@ -121,4 +122,4 @@
</script> </script>
</body> </body>
</html> </html>
+15 -2
View File
@@ -18,6 +18,9 @@ const $toast = useToast();
// 图片加载状态 // 图片加载状态
const isImageLoaded = ref(false); const isImageLoaded = ref(false);
// 图片加载失败
const imageLoadError = ref(false);
// TMDB识别标志 // TMDB识别标志
const tmdbFlag = ref(true); const tmdbFlag = ref(true);
@@ -342,6 +345,15 @@ const seasonsHeaders = [
// 选中的订阅季 // 选中的订阅季
const seasonsSelected = ref<TmdbSeason[]>([]); const seasonsSelected = ref<TmdbSeason[]>([]);
// 计算图片地址
const getImgUrl = (url: string) => {
// 如果地址中包含douban则使用中转代理
if (url.includes("doubanio.com")) {
return `${import.meta.env.VITE_API_BASE_URL}douban/img/${encodeURIComponent(url)}`;
}
return url;
};
</script> </script>
<template> <template>
@@ -359,10 +371,11 @@ const seasonsSelected = ref<TmdbSeason[]>([]);
> >
<VImg <VImg
aspect-ratio="2/3" aspect-ratio="2/3"
:src="props.media?.poster_path" :src="getImgUrl(props.media?.poster_path || '')"
class="object-cover aspect-w-2 aspect-h-3" class="object-cover aspect-w-2 aspect-h-3"
:class="hover.isHovering ? 'on-hover' : ''" :class="hover.isHovering ? 'on-hover' : ''"
@load="isImageLoaded = true" @load="isImageLoaded = true"
@error="imageLoadError = true"
cover cover
> >
<template #placeholder> <template #placeholder>
@@ -392,7 +405,7 @@ const seasonsSelected = ref<TmdbSeason[]>([]);
<!-- 详情 --> <!-- 详情 -->
<VCardText <VCardText
class="w-full flex flex-col flex-wrap justify-end align-left text-white absolute bottom-0 cursor-pointer pa-2" class="w-full flex flex-col flex-wrap justify-end align-left text-white absolute bottom-0 cursor-pointer pa-2"
v-show="hover.isHovering" v-show="hover.isHovering || imageLoadError"
@click.stop="openDetailWindow" @click.stop="openDetailWindow"
> >
<span class="font-bold">{{ props.media?.year }}</span> <span class="font-bold">{{ props.media?.year }}</span>
+1
View File
@@ -21,6 +21,7 @@ const titles: { [key: string]: any } = {
tvs: "最新电视剧", tvs: "最新电视剧",
tv_weekly_chinese: "华语剧集榜", tv_weekly_chinese: "华语剧集榜",
tv_weekly_global: "全球剧集榜", tv_weekly_global: "全球剧集榜",
movie_top250: "电影Top250",
}, },
media: { media: {
search: "搜索", search: "搜索",