This commit is contained in:
筱野
2025-09-25 21:42:40 +08:00
parent 19a51fc679
commit 76d26831ca
4 changed files with 45 additions and 44 deletions

View File

@@ -39,7 +39,11 @@ const defaultFormData: PublishBallFormData = {
venue_description: '',
venue_image_list: [],
},
players: [1, 1],
players: {
min: 1,
max: 1,
is_participate: true
},
skill_level: [1.0, 5.0],
descriptionInfo: {
description: '',
@@ -257,14 +261,16 @@ const PublishBall: React.FC = () => {
if (!isValid) {
return
}
const { activityInfo, descriptionInfo, timeRange, players, skill_level,image_list,wechat, ...rest } = formData[0];
const { activityInfo, descriptionInfo, timeRange, players, skill_level, image_list, wechat, ...rest } = formData[0];
const { min, max, is_participate } = players;
const options = {
...rest,
...activityInfo,
...descriptionInfo,
...timeRange,
max_players: players[1],
min_players: players[0],
max_players: max,
min_players: min,
is_participate: is_participate,
skill_level_min: skill_level[0],
skill_level_max: skill_level[1],
image_list: image_list.map(item => item.url),
@@ -305,13 +311,15 @@ const PublishBall: React.FC = () => {
}
const options = formData.map((item) => {
const { activityInfo, descriptionInfo, timeRange, players, skill_level, ...rest } = item;
const { min, max, is_participate } = players;
return {
...rest,
...activityInfo,
...descriptionInfo,
...timeRange,
max_players: players[1],
min_players: players[0],
max_players: max,
min_players: min,
is_participate: is_participate,
skill_level_min: skill_level[0],
skill_level_max: skill_level[1],
image_list: item.image_list.map(img => img.url)
@@ -382,7 +390,7 @@ const PublishBall: React.FC = () => {
...(description_tag ? { description_tag } : {}),
},
...(skill_level_max && skill_level_min ? { skill_level: [skill_level_min, skill_level_max] } : {}),
...(max_players && min_players ? { players: [min_players, max_players] } : {}),
...(max_players && min_players ? { players: { min: min_players, max: max_players, is_participate: true } } : {}),
wechat: { ...defaultFormData.wechat, default_wechat_contact: userPhone }
}
}