修改发布

This commit is contained in:
筱野
2025-09-25 23:16:45 +08:00
parent 8e1c486352
commit 4492a22f1f

View File

@@ -348,17 +348,21 @@ const PublishBall: React.FC = () => {
}
const mergeWithDefault = (data: any): PublishBallFormData => {
const userPhone = (userInfo as any)?.phone || ''
const { start_time, end_time, play_type, price, venue_id, location_name, location, latitude,
longitude, court_type, court_surface, venue_description_tag, venue_description, venue_image_list,
const { start_time, end_time, play_type, price,
description, description_tag, max_players, min_players, skill_level_max, skill_level_min,
venueDtl
} = data;
let activityInfo = {};
if (venueDtl) {
const { latitude, longitude } = venueDtl;
const { latitude, longitude,venue_type, surface_type, facilities, name, id } = venueDtl;
activityInfo = {
latitude,
longitude,
court_type: venue_type,
court_surface: surface_type,
venue_description: facilities,
location_name: name,
venue_id: id
}
}
return {
@@ -373,16 +377,7 @@ const PublishBall: React.FC = () => {
...defaultFormData.activityInfo,
...(play_type ? { play_type } : {}),
...((price) ? { price } : {}),
...(venue_id ? { venue_id } : {}),
...(location_name ? { location_name } : {}),
...(location ? { location } : {}),
...(latitude ? { latitude } : {}),
...(longitude ? { longitude } : {}),
...(court_type ? { court_type } : {}),
...(court_surface ? { court_surface } : {}),
...(venue_description_tag ? { venue_description_tag } : {}),
...(venue_description ? { venue_description } : {}),
...(venue_image_list ? { venue_image_list } : {}),
...activityInfo
},
descriptionInfo: {
...defaultFormData.descriptionInfo,
@@ -433,6 +428,10 @@ const PublishBall: React.FC = () => {
if (publishAiData) {
Taro.showToast({
title: '智能识别成功,请完善剩余信息',
icon: 'none'
})
if (Array.isArray(publishAiData)) {
const merged = publishAiData.map(item => mergeWithDefault(item))
setFormData(merged.length ? merged : [defaultFormData])