feat:热门列表 BigVideoCard 下方穿插双列直播卡片

This commit is contained in:
Developer
2026-03-19 20:45:33 +08:00
parent c0b7b8e974
commit d8c13a98ab
2 changed files with 36 additions and 23 deletions

View File

@@ -46,21 +46,27 @@ export function toListRows(pages: VideoItem[][], liveRooms?: LiveRoom[]): ListRo
// if (liveRooms && roomIdx < liveRooms.length && pairs.length > 0) {
// const seed = chunk[0]?.aid ?? 0;
// const insertAt = seed % (pairs.length + 1);
// pairs.splice(insertAt, 0, {
// type: 'live',
// left: liveRooms[roomIdx],
// });
// roomIdx++;
// }
if (liveRooms && liveRooms.length >= 2) {
const a = liveRooms[roomIdx % liveRooms.length];
const b = liveRooms[(roomIdx + 1) % liveRooms.length];
roomIdx += 2;
if (rows.length < 20) {
rows.push({ type: 'big', item: bigItem }, ...pairs);
if (rows.length < 20) {
rows.push({ type: 'big', item: bigItem });
rows.push({ type: 'live', left: a, right: b });
rows.push(...pairs);
} else {
rows.push(...pairs);
rows.push({ type: 'big', item: bigItem });
rows.push({ type: 'live', left: a, right: b });
}
} else {
rows.push(...pairs, { type: 'big', item: bigItem });
// No live data, fall back to original logic
if (rows.length < 20) {
rows.push({ type: 'big', item: bigItem }, ...pairs);
} else {
rows.push(...pairs, { type: 'big', item: bigItem });
}
}
}
return rows;