press-next
Version:
Vue3 组件库,支持 Composition API
167 lines (154 loc) • 4.98 kB
text/typescript
// AI办赛模版组件演示数据
export interface TagConfig {
text: string;
iconName?: string;
}
export type MatchStatus = 'upcoming' | 'doing' | 'finished' | 'deadline';
export type MatchType = 'online' | 'offline';
export interface PrizeInfo {
pic: string;
title?: string;
description?: string;
}
export interface TemplateContent {
title: string; // 标题
pic: string; // 图片
matchType?: MatchType; // 比赛类型:线上/线下
startTime?: string; // 开赛时间
tags?: Array<string | TagConfig>; // 标签列表
location?: string; // 位置信息
buttonText?: string; // 按钮文本
buttonColor?: string; // 按钮颜色
prizes?: Array<PrizeInfo>; // 奖品信息列表
status?: MatchStatus; // 状态
countdownTime?: number; // 倒计时时间(毫秒)
countdownText?: string; // 倒计时文本
showCountdown?: boolean; // 是否显示倒计时
}
export function getMockData() {
// 基础用法示例
const basicContent: TemplateContent = {
title: '王者荣耀夏季赛',
pic: 'https://mike-1255355338.cos.ap-guangzhou.myqcloud.com/article/2023/10/own_mike_a17f94292a34e9f644.jpeg',
matchType: 'online',
startTime: '8.20',
tags: [
'精英赛',
'限时活动',
'限时',
'百万奖金',
'海盗',
'荣耀',
'沙漠四人赛',
],
buttonText: '立即报名',
buttonColor: '#5300c3',
status: 'deadline',
countdownTime: 2 * 60 * 60 * 1000, // 2小时
showCountdown: true,
};
// 线下赛事示例
const offlineContent: TemplateContent = {
title: '线下电竞大赛总决赛',
pic: 'https://mike-1255355338.cos.ap-guangzhou.myqcloud.com/article/2023/10/own_mike_a17f94292a34e9f644.jpeg',
matchType: 'offline',
tags: [
{ text: '线下赛', iconName: 'location' },
{ text: '总决赛', iconName: 'trophy' },
'高额奖金',
],
location: '深圳市南山区腾讯滨海大厦',
buttonText: '查看详情',
buttonColor: '#138c55',
status: 'upcoming',
showCountdown: false,
};
// 进行中状态示例
const doingContent: TemplateContent = {
title: '和平精英春季联赛',
pic: 'https://mike-1255355338.cos.ap-guangzhou.myqcloud.com/article/2023/10/own_mike_a17f94292a34e9f644.jpeg',
matchType: 'online',
tags: [
{ text: '4人组队', iconName: 'team' },
{ text: '生存模式', iconName: 'target' },
],
buttonText: '观看直播',
buttonColor: '#ff6b00',
status: 'doing',
showCountdown: false,
};
// 已结束状态示例
const finishedContent: TemplateContent = {
title: '英雄联盟城市争霸赛',
pic: 'https://mike-1255355338.cos.ap-guangzhou.myqcloud.com/article/2023/10/own_mike_a17f94292a34e9f644.jpeg',
matchType: 'online',
tags: [
{ text: '5v5', iconName: 'team' },
{ text: '单淘汰', iconName: 'tournament' },
],
buttonText: '查看结果',
buttonColor: '#73737b',
status: 'finished',
showCountdown: false,
};
// 带奖品信息示例
const prizeContent: TemplateContent = {
title: '移动游戏锦标赛',
pic: 'https://mike-1255355338.cos.ap-guangzhou.myqcloud.com/article/2023/10/own_mike_a17f94292a34e9f644.jpeg',
matchType: 'online',
tags: [
{ text: '个人赛', iconName: 'user' },
{ text: '积分制', iconName: 'star' },
],
prizes: [
{
pic: 'https://image-1251917893.file.myqcloud.com/tip-project/pubg/pubg-match/label-prize-new.png',
title: '一等奖',
description: '奖品描述',
},
{
pic: 'https://image-1251917893.file.myqcloud.com/tip-project/pubg/pubg-match/label-prize-new.png',
title: '二等奖',
description: '奖品描述',
},
{
pic: 'https://image-1251917893.file.myqcloud.com/tip-project/pubg/pubg-match/label-prize-new.png',
title: '一等奖',
description: '奖品描述',
},
{
pic: 'https://image-1251917893.file.myqcloud.com/tip-project/pubg/pubg-match/label-prize-new.png',
title: '二等奖',
description: '奖品描述',
},
{
pic: 'https://image-1251917893.file.myqcloud.com/tip-project/pubg/pubg-match/label-prize-new.png',
title: '一等奖',
description: '奖品描述',
},
{
pic: 'https://image-1251917893.file.myqcloud.com/tip-project/pubg/pubg-match/label-prize-new.png',
title: '二等奖',
description: '奖品描述',
},
],
buttonText: '立即参赛',
buttonColor: '#5300c3',
status: 'upcoming',
countdownTime: 5 * 60 * 60 * 1000, // 5小时
showCountdown: true,
};
// 组件属性配置
const componentProps = {
basicContent,
offlineContent,
doingContent,
finishedContent,
prizeContent,
};
return componentProps;
}
const DEMO_DATA = {
...getMockData(),
};
export default DEMO_DATA;