// 表单字段类型枚举 export enum FieldType { TEXT = 'text', TEXTAREA = 'textarea', SELECT = 'select', DATE = 'date', TIME = 'time', NUMBER = 'number', SWITCH = 'switch', RADIO = 'radio', CHECKBOX = 'checkbox', LOCATION = 'location', UPLOADIMAGE = 'uploadimage', TIMEINTERVAL = 'timeinterval', NUMBERINTERVAL = 'numberinterval', RANGE = 'range', TEXTAREATAG = 'textareaTag', ACTIVITYINFO = 'activityInfo' } // 表单字段配置接口 export interface FormFieldConfig { key: string label: string type: FieldType placeholder?: string required?: boolean defaultValue?: any options?: Array<{ label: string; value: any }> rules?: Array<{ required?: boolean min?: number max?: number pattern?: RegExp message: string }> props?: Record description?: string children?: FormFieldConfig[] iconType?: string } // 发布球局表单配置 export const publishBallFormSchema: FormFieldConfig[] = [ { key: 'coverImages', label: '活动封页', type: FieldType.UPLOADIMAGE, placeholder: '请选择活动类型', required: true, props: { maxCount: 9 } }, { key: 'title', label: '', type: FieldType.TEXT, placeholder: '好的标题更吸引人哦', required: true, props: { maxLength: 80 }, rules: [ { required: true, message: '请输入活动标题' }, { max: 20, message: '标题不能超过20个字符' } ] }, { key: 'date', label: '', type: FieldType.TIMEINTERVAL, placeholder: '请选择活动日期', required: true, rules: [ { required: true, message: '请选择活动日期' } ] }, { key: 'timeRange', label: '活动信息', type: FieldType.ACTIVITYINFO, placeholder: '请选择活动时间', required: true, rules: [ { required: true, message: '请选择活动时间' } ], children: [ { key: 'fee', label: '费用', iconType: 'ICON_COST', type: FieldType.NUMBER, placeholder: '请输入活动费用(元)', defaultValue: 0, rules: [ { min: 0, message: '费用不能为负数' }, { max: 1000, message: '费用不能超过1000元' } ], }, { key: 'location', label: '地点', iconType: 'ICON_LOCATION', type: FieldType.LOCATION, placeholder: '请选择活动地点', required: true, }, { key: 'sport', label: '玩法', iconType: 'ICON_GAMEPLAY', type: FieldType.SELECT, placeholder: '请选择玩法', required: true, options: [ { label: '篮球', value: 'basketball' }, { label: '足球', value: 'football' }, { label: '羽毛球', value: 'badminton' }, { label: '网球', value: 'tennis' }, { label: '乒乓球', value: 'pingpong' }, { label: '排球', value: 'volleyball' } ], } ] }, { key: 'minParticipants', label: '人数要求', type: FieldType.NUMBERINTERVAL, placeholder: '请输入最少参与人数', defaultValue: 1, props: { showSummary: true, summary: '最少1人,最多4人', }, rules: [ { min: 1, message: '最少参与人数不能为0' }, { max: 4, message: '最少参与人数不能超过100人' } ], }, { key: 'ntpLevel', label: 'NTRP 水平要求', type: FieldType.RANGE, placeholder: '请选择开始时间', required: true, props: { showTitle: false, showSummary: true, className: 'ntrp-range', step: 0.5, min: 1.0, max: 5.0, } }, { key: 'additionalRequirements', label: '补充要求(选填)', type: FieldType.TEXTAREATAG, placeholder: '补充性别偏好、特殊要求和注意事项等信息', required: true, options:[ { label: '仅限男生', value: 'beginner' }, { label: '仅限女生', value: 'intermediate' }, { label: '性别不限', value: 'advanced' } ], rules: [ { max: 100, message: '补充要求不能超过100个字符' } ] }, { key: 'autoDegrade', label: '', type: FieldType.CHECKBOX, placeholder: '开启自动候补逻辑', required: true, props:{ subTitle: '开启自动候补逻辑', showToast: true, description: '开启后,当活动人数不足时,系统会自动将活动状态改为“候补”,并通知用户。', }, rules: [ { required: true, message: '请选择开启自动候补逻辑' } ] } ]