修复动漫页面每日放送无图片时的报错
This commit is contained in:
+14
-12
@@ -312,18 +312,20 @@ function DoubanPageClient() {
|
|||||||
data = {
|
data = {
|
||||||
code: 200,
|
code: 200,
|
||||||
message: 'success',
|
message: 'success',
|
||||||
list: weekdayData.items.map((item) => ({
|
list: weekdayData.items
|
||||||
id: item.id?.toString() || '',
|
.filter((item) => item.images) // 过滤掉没有图片的
|
||||||
title: item.name_cn || item.name,
|
.map((item) => ({
|
||||||
poster:
|
id: item.id?.toString() || '',
|
||||||
item.images.large ||
|
title: item.name_cn || item.name,
|
||||||
item.images.common ||
|
poster:
|
||||||
item.images.medium ||
|
item.images.large ||
|
||||||
item.images.small ||
|
item.images.common ||
|
||||||
item.images.grid,
|
item.images.medium ||
|
||||||
rate: item.rating?.score?.toFixed(1) || '',
|
item.images.small ||
|
||||||
year: item.air_date?.split('-')?.[0] || '',
|
item.images.grid,
|
||||||
})),
|
rate: item.rating?.score?.toFixed(1) || '',
|
||||||
|
year: item.air_date?.split('-')?.[0] || '',
|
||||||
|
})),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw new Error('没有找到对应的日期');
|
throw new Error('没有找到对应的日期');
|
||||||
|
|||||||
+2
-2
@@ -412,11 +412,11 @@ function HomeClient() {
|
|||||||
];
|
];
|
||||||
const currentWeekday = weekdays[today.getDay()];
|
const currentWeekday = weekdays[today.getDay()];
|
||||||
|
|
||||||
// 找到当前星期对应的番剧数据
|
// 找到当前星期对应的番剧数据,并过滤掉没有图片的
|
||||||
const todayAnimes =
|
const todayAnimes =
|
||||||
bangumiCalendarData.find(
|
bangumiCalendarData.find(
|
||||||
(item) => item.weekday.en === currentWeekday
|
(item) => item.weekday.en === currentWeekday
|
||||||
)?.items || [];
|
)?.items.filter((anime) => anime.images) || [];
|
||||||
|
|
||||||
return todayAnimes.map((anime, index) => (
|
return todayAnimes.map((anime, index) => (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user