修改提交
This commit is contained in:
@@ -7,7 +7,7 @@ import { type Stadium, type CoverImage } from '../../components/index.types'
|
||||
import { FormFieldConfig, FieldType } from '../../config/formSchema/publishBallFormSchema'
|
||||
import { PublishBallFormData } from '../../../types/publishBall';
|
||||
|
||||
import './index.scss'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
// 组件映射器
|
||||
const componentMap = {
|
||||
@@ -35,7 +35,7 @@ const PublishForm: React.FC<{
|
||||
}
|
||||
|
||||
// 更新表单数据
|
||||
const updateFormData = (key: keyof FormData, value: any) => {
|
||||
const updateFormData = (key: keyof PublishBallFormData, value: any) => {
|
||||
onChange(key, value)
|
||||
}
|
||||
|
||||
@@ -50,7 +50,12 @@ const PublishForm: React.FC<{
|
||||
setShowStadiumSelector(false)
|
||||
}
|
||||
|
||||
|
||||
const renderSummary = (item: FormFieldConfig) => {
|
||||
if (item.props?.showSummary) {
|
||||
return <Text className={styles['section-summary']}>{item.props?.summary}</Text>
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -83,15 +88,17 @@ const PublishForm: React.FC<{
|
||||
}
|
||||
|
||||
return (
|
||||
<View className='publish-form'>
|
||||
<View className='publish-ball__content'>
|
||||
<View className={styles['publish-form']}>
|
||||
<View className={styles['publish-ball__content']}>
|
||||
{
|
||||
optionsConfig.map((item) => {
|
||||
const Component = componentMap[item.type]
|
||||
const optionProps = {
|
||||
...item.props,
|
||||
...(item.key === 'additionalRequirements' ? { options: item.options } : {})
|
||||
...(item.key === 'additionalRequirements' ? { options: item.options } : {}),
|
||||
...(item.props?.className ? { className: styles[item.props.className] } : {})
|
||||
}
|
||||
console.log(item.props?.className)
|
||||
console.log(optionProps, item.label, formData[item.key]);
|
||||
if (item.type === FieldType.UPLOADIMAGE) {
|
||||
/* 活动封面 */
|
||||
@@ -103,15 +110,15 @@ const PublishForm: React.FC<{
|
||||
}
|
||||
if (item.type === FieldType.ACTIVITYINFO) {
|
||||
return <>
|
||||
<View className='activity-description'>
|
||||
<Text className='description-text'>
|
||||
<View className={styles['activity-description']}>
|
||||
<Text className={styles['description-text']}>
|
||||
活动开始前2小时未达到最低人数,活动自动取消;活动
|
||||
结束后,报名者累计到达最低人数时,一旦到达期即有序。
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{/* 费用地点玩法区域 - 合并白色块 */}
|
||||
<View className='bg-section'>
|
||||
<View className={styles['bg-section']}>
|
||||
<FormBasicInfo
|
||||
fee={formData.fee}
|
||||
location={formData.location}
|
||||
@@ -127,18 +134,20 @@ const PublishForm: React.FC<{
|
||||
</>
|
||||
}
|
||||
return (
|
||||
<View className='section-wrapper'>
|
||||
<View className={styles['section-wrapper']}>
|
||||
{
|
||||
item.label && <View className='section-title-wrapper' >
|
||||
<Text className='section-title'>{item.label}</Text>
|
||||
<Text className='section-summary'>最少1人,最多4人</Text>
|
||||
item.label && <View className={styles['section-title-wrapper']} >
|
||||
<Text className={styles['section-title']}>{item.label}</Text>
|
||||
{
|
||||
item.props?.showSummary && <Text className={styles['section-summary']}>{renderSummary(item)}</Text>
|
||||
}
|
||||
</View>
|
||||
}
|
||||
<View className='bg-section'>
|
||||
<View className={styles['bg-section']}>
|
||||
<Component
|
||||
label={item.label}
|
||||
value={formData[item.key]}
|
||||
onChange={(value) => updateFormData(item.key as keyof FormData, value)}
|
||||
onChange={(value) => updateFormData(item.key as keyof PublishBallFormData, value)}
|
||||
{...optionProps}
|
||||
placeholder={item.placeholder}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user