增加发布

This commit is contained in:
筱野
2025-08-10 23:02:41 +08:00
parent 86e14cb445
commit 68a6558776
10 changed files with 1661 additions and 0 deletions

View File

@@ -0,0 +1,173 @@
// 表单字段类型定义
export type FieldType =
| 'image-upload'
| 'text-input'
| 'number-input'
| 'time-display'
| 'multi-select'
| 'counter'
| 'slider'
| 'radio-group'
| 'checkbox'
| 'venue-input'
// 表单字段配置接口
export interface FormFieldConfig {
key: string // 字段名
type: FieldType // 字段类型
title: string // 显示标题
required?: boolean // 是否必填
placeholder?: string // 占位符
hint?: string // 提示文字
defaultValue?: any // 默认值
validation?: { // 验证规则
min?: number
max?: number
pattern?: string
message?: string
}
options?: Array<{ // 选项(用于选择类型)
label: string
value: any
}>
config?: { // 特殊配置
maxImages?: number // 图片上传最大数量
minValue?: number // 计数器最小值
maxValue?: number // 计数器最大值
range?: [number, number] // 滑动条范围
unit?: string // 单位
showArrow?: boolean // 是否显示箭头
}
}
// 完整的表单配置
export interface FormConfig {
title: string // 表单标题
reminder?: string // 提醒文本
fields: FormFieldConfig[] // 字段列表
actions?: { // 底部操作
addText?: string
submitText?: string
disclaimer?: string
}
}
// 发布球的表单配置
export const publishBallFormConfig: FormConfig = {
title: '发布个人约球',
reminder: '提醒: 活动开始前x小时未达到最低招募人数活动自动取消活动结束2天后报名费自动转入[钱包—余额],可提现到微信。',
fields: [
{
key: 'cover',
type: 'image-upload',
title: '活动封面',
required: false,
defaultValue: [],
config: {
maxImages: 9
}
},
{
key: 'theme',
type: 'text-input',
title: '活动主题 (选填)',
required: false,
placeholder: '好的主题更吸引人哦',
defaultValue: ''
},
{
key: 'time',
type: 'time-display',
title: '活动时间',
required: true,
defaultValue: {
startTime: '2025-11-23 08:00',
endTime: '2025-11-23 10:00'
}
},
{
key: 'venue',
type: 'venue-input',
title: '活动场地',
required: true,
placeholder: '选择活动地点',
defaultValue: '',
config: {
showArrow: true
}
},
{
key: 'price',
type: 'number-input',
title: '人均价格/元',
required: true,
placeholder: '请填写每个人多少钱',
defaultValue: '',
validation: {
min: 0,
message: '价格不能为负数'
}
},
{
key: 'playStyle',
type: 'multi-select',
title: '活动玩法',
required: true,
defaultValue: [],
options: [
{ label: '单打', value: '单打' },
{ label: '双打', value: '双打' },
{ label: '娱乐拉球', value: '娱乐拉球' },
{ label: '到了再说', value: '到了再说' }
]
},
{
key: 'playerCount',
type: 'counter',
title: '招募人数',
required: true,
defaultValue: { min: 1, max: 4 },
config: {
minValue: 1,
maxValue: 50
}
},
{
key: 'ntrpRange',
type: 'slider',
title: 'NTRP水平区间',
required: true,
defaultValue: [2.0, 4.0],
config: {
range: [1.0, 7.0],
unit: ''
}
},
{
key: 'genderPreference',
type: 'radio-group',
title: '补充要求 (选填)',
hint: '补充性别偏好、特殊要求和注意事项等信息',
required: false,
defaultValue: 'unlimited',
options: [
{ label: '选择填入', value: 'select' },
{ label: '仅限男生', value: 'male' },
{ label: '仅限女生', value: 'female' },
{ label: '性别不限', value: 'unlimited' }
]
},
{
key: 'autoStandby',
type: 'checkbox',
title: '开启自动候补逻辑',
required: false,
defaultValue: true
}
],
actions: {
addText: '再添加一场',
submitText: '完成',
disclaimer: '点击确定发布按钮,即表示已阅读并同意《约球规则》'
}
}