press-next
Version:
Vue3 组件库,支持 Composition API
218 lines (205 loc) • 5.36 kB
text/typescript
export interface CreateItem {
title: string;
desc?: string;
tip?: string;
showSwitch?: boolean;
showTitle?: boolean;
checked?: boolean;
disabled?: boolean;
type?: string;
aiType?: string;
activeColor?: string;
switchSize?: string;
isBasic?: boolean;
isMore?: boolean;
}
export interface ModeItem {
id: string | number;
title: string;
description: string;
hot?: boolean;
label?: string;
srcPic?: string;
}
// 奖品配置数据
export interface PrizeSetData {
id?: string | number;
title: string;
name: string;
description: string;
image: string;
quantity: number;
quantityType?: 'per_person' | 'total';
}
export function getMockData() {
// 基础创建项目(总是显示)
const basicCreateList: CreateItem[] = [
{
title: '比赛类型',
desc: '团队赛(四人)',
showTitle: false,
type: 'input',
isBasic: true,
},
{
title: '比赛局数及地图',
desc: '共一局(零号大坝)',
showTitle: false,
type: 'datetime',
isBasic: true,
},
{
title: '报名截止',
desc: '6月10日 10:50',
showTitle: false,
type: 'datetime',
isBasic: true,
},
{
title: '开赛时间',
desc: '6月10日 10:50',
showTitle: false,
type: 'datetime',
isBasic: true,
},
];
// 更多创建项目(点击"更多"后显示)
const moreCreateList: CreateItem[] = [
{
title: '开启ai直播',
desc: '',
aiType: '单人解说',
showSwitch: true,
showTitle: true,
checked: true,
disabled: false,
switchSize: '20px',
activeColor: '#366ff4',
type: 'switch',
isMore: true,
},
{
title: '比赛群二维码',
desc: '',
showTitle: true,
type: 'input',
isMore: true,
},
{
title: '比赛规则',
desc: '默认规则',
showTitle: true,
type: 'input',
isMore: true,
},
{
title: '开赛方式',
desc: '手动开赛',
showTitle: true,
type: 'input',
isMore: true,
},
];
// 组合完整列表
const createList = [...basicCreateList, ...moreCreateList];
// 模拟模式列表数据
const modeList: ModeItem[] = [
{
id: 1,
title: '烽火地带',
description: '经典5v5团队竞技模式',
hot: true,
label: '',
srcPic: 'https://image-1251917893.file.myqcloud.com/general-match-components/img/create-game/swiper-pic.png',
},
{
id: 2,
title: '单人模式',
description: '1v1单挑,考验个人实力',
hot: false,
label: '竞技',
srcPic: 'https://image-1251917893.file.myqcloud.com/general-match-components/img/create-game/swiper-pic.png',
},
{
id: 3,
title: '团队赛',
description: '3v3小队竞技模式',
hot: false,
label: '团队',
srcPic: 'https://image-1251917893.file.myqcloud.com/general-match-components/img/create-game/swiper-pic.png',
},
{
id: 4,
title: '自由模式',
description: '自定义规则,自由发挥',
hot: false,
label: '自由',
srcPic: 'https://image-1251917893.file.myqcloud.com/general-match-components/img/create-game/swiper-pic.png',
},
];
// 奖励配置模拟数据
const prizeData: PrizeSetData = {
id: 1,
title: '冠军奖励',
name: '王者荣耀限定皮肤',
description: '赛季限定皮肤礼包 + 专属头像框',
image: 'https://placehold.co/74x74/ff6b00/ffffff?text=Prize',
quantity: 1,
quantityType: 'per_person',
};
// 多个奖品配置示例
const prizeList: PrizeSetData[] = [
{
id: 1,
title: '冠军奖励',
name: '王者荣耀限定皮肤',
description: '赛季限定皮肤礼包 + 专属头像框',
image: 'https://placehold.co/74x74/ff6b00/ffffff?text=1st',
quantity: 1,
quantityType: 'per_person',
},
{
id: 2,
title: '亚军奖励',
name: '游戏点券',
description: '1000点券 + 铭文碎片',
image: 'https://placehold.co/74x74/52c41a/ffffff?text=2nd',
quantity: 2,
quantityType: 'per_person',
},
{
id: 3,
title: '季军奖励',
name: '游戏道具',
description: '英雄体验卡 + 皮肤体验卡',
image: 'https://placehold.co/74x74/1890ff/ffffff?text=3rd',
quantity: 3,
quantityType: 'per_person',
},
];
// 组件属性配置
const componentProps = {
customClass: '',
logoPic: 'https://img.yzcdn.cn/vant/cat.jpeg',
createButtonText: '创建我的赛事', // 自定义创建文字
saveButtonText: '保存赛事设置', // 自定义保存文字
isModify: false,
matchName: '我的比赛',
curModeIndex: 0,
isCreateQuick: false, // 控制是否显示更多按钮
isShowMore: false, // 控制更多内容展开状态
moreText: 'AI直播、比赛规则、奖品等更多设置', // 更多按钮文字
modeList,
createList,
basicCreateList, // 基础列表
moreCreateList, // 更多列表
// 奖励配置相关
prizeData,
prizeList,
};
return componentProps;
}
const DEMO_DATA = {
...getMockData(),
};
export default DEMO_DATA;