mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-08 07:28:37 +08:00
feat:热门列表 BigVideoCard 下方穿插双列直播卡片
This commit is contained in:
@@ -207,14 +207,24 @@ export default function HomeScreen() {
|
||||
}
|
||||
if (row.type === "live") {
|
||||
return (
|
||||
<View style={styles.liveRow}>
|
||||
<View style={styles.row}>
|
||||
<View style={styles.leftCol}>
|
||||
<LiveCard
|
||||
isLivePulse
|
||||
item={row.left}
|
||||
fullWidth
|
||||
onPress={() => router.push(`/live/${row.left.roomid}` as any)}
|
||||
/>
|
||||
</View>
|
||||
{row.right && (
|
||||
<View style={styles.rightCol}>
|
||||
<LiveCard
|
||||
isLivePulse
|
||||
item={row.right}
|
||||
onPress={() => router.push(`/live/${row.right!.roomid}` as any)}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
const right = row.right;
|
||||
@@ -559,9 +569,6 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
leftCol: { marginLeft: 4, marginRight: 2 },
|
||||
rightCol: { marginLeft: 2, marginRight: 4 },
|
||||
liveRow: {
|
||||
paddingHorizontal: 4,
|
||||
},
|
||||
footer: {
|
||||
height: 48,
|
||||
alignItems: "center",
|
||||
|
||||
@@ -46,22 +46,28 @@ 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 });
|
||||
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 {
|
||||
// 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user