修复动漫页面每日放送无图片时的报错

This commit is contained in:
mtvpls
2025-12-05 00:04:12 +08:00
parent bb49a31e9a
commit 81588443f1
2 changed files with 16 additions and 14 deletions

View File

@@ -312,18 +312,20 @@ function DoubanPageClient() {
data = {
code: 200,
message: 'success',
list: weekdayData.items.map((item) => ({
id: item.id?.toString() || '',
title: item.name_cn || item.name,
poster:
item.images.large ||
item.images.common ||
item.images.medium ||
item.images.small ||
item.images.grid,
rate: item.rating?.score?.toFixed(1) || '',
year: item.air_date?.split('-')?.[0] || '',
})),
list: weekdayData.items
.filter((item) => item.images) // 过滤掉没有图片的
.map((item) => ({
id: item.id?.toString() || '',
title: item.name_cn || item.name,
poster:
item.images.large ||
item.images.common ||
item.images.medium ||
item.images.small ||
item.images.grid,
rate: item.rating?.score?.toFixed(1) || '',
year: item.air_date?.split('-')?.[0] || '',
})),
};
} else {
throw new Error('没有找到对应的日期');

View File

@@ -412,11 +412,11 @@ function HomeClient() {
];
const currentWeekday = weekdays[today.getDay()];
// 找到当前星期对应的番剧数据
// 找到当前星期对应的番剧数据,并过滤掉没有图片的
const todayAnimes =
bangumiCalendarData.find(
(item) => item.weekday.en === currentWeekday
)?.items || [];
)?.items.filter((anime) => anime.images) || [];
return todayAnimes.map((anime, index) => (
<div