103 lines
3.3 KiB
TypeScript
103 lines
3.3 KiB
TypeScript
"use client";
|
|
|
|
import type { ReactNode } from "react";
|
|
|
|
import { AdBanners, AdIcons } from "@/components/common/ads";
|
|
import { BackButton } from "@/components/common/back-button";
|
|
import { HlAction, InfoList, SectionTitle, TagLinks, VideoRecommend, type InfoRow, type TagLinkItem } from "@/components/media-page/parts";
|
|
import { XgPlayer } from "@/components/player/xg-player";
|
|
import type { ShortDramaItem } from "@/components/short-drama/data";
|
|
|
|
import { formatCount, type VideoDetail } from "./data";
|
|
|
|
type StatsProps = {
|
|
liked: boolean;
|
|
/** 接口 likeNum:点赞数 */
|
|
likeNum?: number;
|
|
collected: boolean;
|
|
/** 接口 countCollect:收藏数 */
|
|
countCollect?: number;
|
|
onLike: () => void;
|
|
onCollect: () => void;
|
|
onShare: () => void;
|
|
};
|
|
|
|
/** H5 视频页:播放器吸顶 → 正文(h1 / 资料 / 标签 / 介绍 / 操作)→ 相关视频推荐(替代原评论标签页) */
|
|
export function H5VideoPlay({
|
|
detail,
|
|
src,
|
|
related = [],
|
|
infoRows,
|
|
tags,
|
|
onPlaySuccess,
|
|
adGrid,
|
|
bannerAds,
|
|
liked,
|
|
likeNum,
|
|
collected,
|
|
countCollect,
|
|
onLike,
|
|
onCollect,
|
|
onShare,
|
|
}: StatsProps & {
|
|
detail: VideoDetail;
|
|
src: string;
|
|
related?: ShortDramaItem[];
|
|
infoRows: InfoRow[];
|
|
tags: TagLinkItem[];
|
|
onPlaySuccess?: () => void;
|
|
adGrid?: ReactNode;
|
|
bannerAds?: ReactNode;
|
|
}) {
|
|
const title = detail.title || "视频";
|
|
const desc = detail.desc?.trim() || "";
|
|
|
|
return (
|
|
<div data-component="hl-video-play-h5" className="flex flex-col bg-[#0C0B10] lg:hidden">
|
|
<div className="sticky top-0 z-20 aspect-video w-full overflow-hidden bg-black">
|
|
<XgPlayer
|
|
src={src}
|
|
poster={detail.coverImg || ""}
|
|
onPlaySuccess={onPlaySuccess}
|
|
clickToPlay
|
|
className="absolute inset-0"
|
|
options={{ ignores: ["cssfullscreen"], fullscreen: { rotateFullscreen: true } }}
|
|
/>
|
|
<BackButton fallback="/video/hot" className="absolute top-3 left-4 z-10" />
|
|
</div>
|
|
|
|
<div className="flex flex-col gap-6 px-4 pt-4 pb-10">
|
|
<article className="flex flex-col gap-3">
|
|
<p className="text-[11px] leading-4 tracking-[0.15em] text-[#FFB020]">视频库</p>
|
|
<h1 className="text-lg leading-7 font-bold text-white">{title}</h1>
|
|
<InfoList rows={infoRows} compact />
|
|
<TagLinks tags={tags} compact />
|
|
<div className="flex items-center gap-2">
|
|
<HlAction kind="like" label={formatCount(likeNum ?? detail.likeNum)} active={liked} onClick={onLike} compact />
|
|
<HlAction
|
|
kind="collect"
|
|
label={formatCount(countCollect ?? detail.countCollect)}
|
|
active={collected}
|
|
onClick={onCollect}
|
|
compact
|
|
/>
|
|
<HlAction kind="share" label="分享" onClick={onShare} compact />
|
|
</div>
|
|
{desc ? (
|
|
<section className="flex flex-col gap-2 pt-1">
|
|
<SectionTitle compact>视频介绍</SectionTitle>
|
|
<p className="text-[13px] leading-[22px] whitespace-pre-line text-[#A9A7B3]">{desc}</p>
|
|
</section>
|
|
) : null}
|
|
</article>
|
|
|
|
{adGrid ?? <AdIcons variant="h5" />}
|
|
|
|
<VideoRecommend items={related} compact />
|
|
|
|
{bannerAds ?? <AdBanners variant="h5" />}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|