press-pix
Version:
基于 PixUI 的 Press 组件库
92 lines (84 loc) • 3.81 kB
text/typescript
// 共享的赛程组件类型定义
// 队伍比赛信息
export interface TeamMatchInfo {
name: string; // 队伍名称
img: string; // 队伍logo
score: string; // 队伍得分
win?: boolean; // 是否胜利队伍
isMine?: boolean; // 是否我的队伍
tag?: 'champion' | 'runner-up' | 'third' | 'qi'; // 队伍标签 冠军、亚军、季军、弃权
}
// 轮次Tab
export interface RoundTab {
name: string;
status: 'waiting' | 'ing' | 'end';
showIngTag?: boolean; // 是否显示进行中标签
}
// 比赛项
export interface MatchItem {
schId: string | number;
teamA: TeamMatchInfo;
teamB: TeamMatchInfo;
tips: string;
status: 'waiting' | 'ing' | 'end'; // waiting 未开始 ing 进行中 end 已结束
scheCodeName?: string; // 赛程代号名称
onClickLive?: (schId: string | number) => void; // 点击直播回调
onClickTeams?: (schId: string | number) => void; // 点击队伍回调
}
// 轮次数据
export interface RoundData {
name: string;
scheCodeName?: string; // 赛程代号名称
list: MatchItem[];
}
// 冠军赛程项
export interface ChampoinScheduleItem {
teamA: TeamMatchInfo;
teamB: TeamMatchInfo;
tips: string;
status: 'waiting' | 'ing' | 'end'; // waiting 未开始 ing 进行中 end 已结束
schId: string | number;
subscribeStatus: 'subscribed' | 'unsubscribed'; // 订阅比赛状态
onChampoinClickLive?: (schId: string | number) => void; // 点击直播回调
onChampoinClickTeams?: (schId: string | number) => void; // 点击队伍回调
onChampoinSubscribeClick?: () => void; // 订阅比赛点击回调
showVsTag?: boolean; // 是否显示 VS 文字(否则显示冒号图标)
}
// 通用的赛程容器 Props(ScheTree 和 SchePage 共享)
export interface BaseScheContainerProps {
title?: string; // 标题
groupCount?: number; // 分组数量(用于计算滑块位置) 大于1时显示滑块
activeTab?: string; // 当前赛程类型
onTabChange?: (tab: string) => void; // tab 切换回调
roundTabList?: RoundTab[]; // 轮次tab列表
roundList?: RoundData[]; // 轮次赛程数据
typeTabs?: { name: string; value: string }[]; // 赛程类型tab列表
myScheNum?: number; // 我的赛程数量
selectGroup?: (groupIndex: number) => void; // 选择分组回调
onRoundChange?: (startIndex: number) => void; // 轮次显示变化回调
showMySche?: boolean; // 是否显示我的赛程
onMyScheClick?: () => void; // 我的赛程点击回调
onBackClick?: () => void; // 返回按钮点击回调
onClickLive?: (schId: string | number) => void; // 点击直播回调
onClickTeams?: (schId: string | number) => void; // 点击队伍回调
showSubscribe?: boolean; // 是否显示订阅比赛
onSubscribeClick?: () => void; // 订阅比赛点击回调
subscribeStatus?: 'subscribed' | 'unsubscribed'; // 订阅比赛状态
battleNavList?: { id: number; title: string }[]; // 比赛导航列表
activeIndex?: number; // 当前比赛导航索引
navClick?: (id: number) => void; // 比赛导航点击回调
groupTabs?: { value: number; title: string }[]; // 分组tab列表
activeGroupTab?: number; // 当前分组tab索引
onGroupTabChange?: (value: number) => void; // 分组tab点击回调
showEmpty?: boolean; // 是否显示空状态
emptyText?: string; // 空状态提示文字
}
// 通用的赛程容器 State(ScheTree 和 SchePage 共享)
export interface BaseScheContainerState {
sliderPosition: number; // 滑块位置 (0 到 1)
isDragging: boolean; // 是否正在拖拽
currentGroupIndex: number; // 当前分组索引 (1 到 groupCount)
contentScrollLeft: number; // content-box 横向滚动位置
currentRoundIndex: number; // 当前轮次索引
contentOpacity: number; // 赛程内容透明度 (0 到 1)
}