From 52bee95505412fcd770204aced5aea98b53f7dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=B1=E9=87=8E?= Date: Sat, 13 Sep 2025 10:55:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TimeSelector/TimeSelector.tsx | 9 +- .../FormBasicInfo/FormBasicInfo.scss | 2 +- .../PopupGameplay/PopupGameplay.tsx | 16 +- .../SelectStadium/SelectStadium.scss | 5 +- .../SelectStadium/SelectStadium.tsx | 36 +- .../SelectStadium/StadiumDetail.scss | 8 +- .../SelectStadium/StadiumDetail.tsx | 4 +- src/publish_pages/publishBall/index.tsx | 568 ++++++++---------- src/publish_pages/publishBall/publishForm.tsx | 18 +- 9 files changed, 317 insertions(+), 349 deletions(-) diff --git a/src/components/TimeSelector/TimeSelector.tsx b/src/components/TimeSelector/TimeSelector.tsx index ef4e934..dbe7fe8 100644 --- a/src/components/TimeSelector/TimeSelector.tsx +++ b/src/components/TimeSelector/TimeSelector.tsx @@ -30,13 +30,12 @@ const TimeSelector: React.FC = ({ const handleConfirm = (date: Date) => { console.log('选择的日期:', date) const start_time = currentTimeType === 'start' ? getDateStr(date) : value.start_time; - const isLater = dayjs(value.start_time).isAfter(dayjs(value.end_time)); + const end_time = currentTimeType === 'end' ? getDateStr(date) : value.end_time; + const isLater = dayjs(start_time).isAfter(dayjs(end_time)); if (isLater) { if (onChange) onChange({start_time, end_time: getEndTime(start_time)}) return } - const initEndTime = value.end_time ? value.end_time : getEndTime(start_time) - const end_time = currentTimeType === 'end' ? getDateStr(date) : initEndTime; if (onChange) onChange({start_time, end_time}) } const openPicker = (type: 'start' | 'end') => { @@ -87,12 +86,14 @@ const TimeSelector: React.FC = ({ - setVisible(false)} /> + } ) } diff --git a/src/publish_pages/publishBall/components/FormBasicInfo/FormBasicInfo.scss b/src/publish_pages/publishBall/components/FormBasicInfo/FormBasicInfo.scss index 0e07b71..6558670 100644 --- a/src/publish_pages/publishBall/components/FormBasicInfo/FormBasicInfo.scss +++ b/src/publish_pages/publishBall/components/FormBasicInfo/FormBasicInfo.scss @@ -58,7 +58,7 @@ font-size: 14px; color: #333; font-weight: 500; - width: 50px; + width: 60px; text-align: right; margin-right: 8px; } diff --git a/src/publish_pages/publishBall/components/PopupGameplay/PopupGameplay.tsx b/src/publish_pages/publishBall/components/PopupGameplay/PopupGameplay.tsx index e72f342..2de3ac2 100644 --- a/src/publish_pages/publishBall/components/PopupGameplay/PopupGameplay.tsx +++ b/src/publish_pages/publishBall/components/PopupGameplay/PopupGameplay.tsx @@ -13,28 +13,28 @@ interface PopupGameplayProps { export default function PopupGameplay({ visible, onClose, onConfirm, value = '不限', options = [] }: PopupGameplayProps) { const [selectedOption, setSelectedOption] = useState(value) - - + + useEffect(() => { if (visible && value) { setSelectedOption(value) } }, [visible, value]) - + const handleOptionSelect = (option: string) => { setSelectedOption(option) } - + const handleClose = () => { onClose() } - + const handleConfirm = () => { onConfirm(selectedOption) } - + return ( - handleOptionSelect(option.value)} diff --git a/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.scss b/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.scss index 3f6409b..61a0162 100644 --- a/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.scss +++ b/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.scss @@ -2,7 +2,8 @@ .select-stadium { width: 100%; - height: calc(100vh - 10px); + max-height: 80vh; + min-height: 80vh; background: #f5f5f5; display: flex; flex-direction: column; @@ -156,9 +157,9 @@ .stadium-list { flex: 1; width: auto; + height: calc(83vh - 130px); overflow-y: auto; -webkit-overflow-scrolling: touch; - .stadium-item { padding: 16px 20px; display: flex; diff --git a/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.tsx b/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.tsx index 7baa9df..a03cf46 100644 --- a/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.tsx +++ b/src/publish_pages/publishBall/components/SelectStadium/SelectStadium.tsx @@ -57,7 +57,7 @@ const SelectStadium: React.FC = ({ setLoading(false) } } - + useEffect(() => { if (visible) { @@ -138,8 +138,8 @@ const SelectStadium: React.FC = ({ const handleItemLocation = (stadium: Stadium) => { if (stadium.latitude && stadium.longitude) { Taro.openLocation({ - latitude: stadium.latitude, - longitude: stadium.longitude, + latitude: stadium.latitude * 1, + longitude: stadium.longitude * 1, name: stadium.name, address: stadium.address, success: (res) => { @@ -157,8 +157,8 @@ const SelectStadium: React.FC = ({ ) } - - + + // 如果显示详情页面 if (showDetail && selectedStadium) { @@ -194,7 +194,7 @@ const SelectStadium: React.FC = ({ position="bottom" round > - + {/* 搜索框 */} @@ -255,20 +255,20 @@ const SelectStadium: React.FC = ({ - { - e.stopPropagation() - handleItemLocation(stadium) + onClick={(e) => { + e.stopPropagation() + handleItemLocation(stadium) }} > - {calculateDistance(stadium)} · + {calculateDistance(stadium)} · - { - e.stopPropagation() - handleItemLocation(stadium) + onClick={(e) => { + e.stopPropagation() + handleItemLocation(stadium) }} > {stadium.address} @@ -276,7 +276,7 @@ const SelectStadium: React.FC = ({ - + ))} {searchValue && ( @@ -297,10 +297,10 @@ const SelectStadium: React.FC = ({ ) } {/* 场馆列表 */} - + ) } -export default SelectStadium \ No newline at end of file +export default SelectStadium \ No newline at end of file diff --git a/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.scss b/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.scss index 5036d6b..3c93bd5 100644 --- a/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.scss +++ b/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.scss @@ -1,13 +1,13 @@ .stadium-detail { width: 100%; - height: auto; - min-height: 60vh; background: white; display: flex; flex-direction: column; - overflow: hidden; + overflow-y: scroll; padding-bottom: env(safe-area-inset-bottom); - + .stadium-detail-scroll{ + height:72vh; + } // 已选球场 // 场馆列表 .stadium-item { diff --git a/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.tsx b/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.tsx index e3d6e6a..92d6083 100644 --- a/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.tsx +++ b/src/publish_pages/publishBall/components/SelectStadium/StadiumDetail.tsx @@ -1,6 +1,6 @@ import React, { useState, useCallback, forwardRef, useImperativeHandle } from 'react' import Taro from '@tarojs/taro' -import { View, Text, Image } from '@tarojs/components' +import { View, Text, Image, ScrollView } from '@tarojs/components' import images from '@/config/images' import TextareaTag from '@/components/TextareaTag' // import CoverImageUpload, { type CoverImage } from '@/components/ImageUpload' @@ -163,6 +163,7 @@ const StadiumDetail = forwardRef(({ console.log(stadium,'stadiumstadium'); return ( + {/* 已选球场 */} (({ return null })} + ) }) diff --git a/src/publish_pages/publishBall/index.tsx b/src/publish_pages/publishBall/index.tsx index 04b434e..de070ed 100644 --- a/src/publish_pages/publishBall/index.tsx +++ b/src/publish_pages/publishBall/index.tsx @@ -1,65 +1,60 @@ -import React, { useState, useEffect } from "react"; -import { View, Text, Button, Image } from "@tarojs/components"; -import { Checkbox } from "@nutui/nutui-react-taro"; -import Taro from "@tarojs/taro"; -import { type ActivityType } from "@/components/ActivityTypeSwitch"; -import CommonDialog from "@/components/CommonDialog"; -import { withAuth } from "@/components"; -import PublishForm from "./publishForm"; -import { - FormFieldConfig, - publishBallFormSchema, -} from "@/config/formSchema/publishBallFormSchema"; -import { PublishBallFormData } from "../../../types/publishBall"; -import PublishService from "@/services/publishService"; -import { getNextHourTime, getEndTime, delay } from "@/utils"; -import images from "@/config/images"; -import styles from "./index.module.scss"; -import dayjs from "dayjs"; +import React, { useState, useEffect } from 'react' +import { View, Text, Button, Image } from '@tarojs/components' +import { Checkbox } from '@nutui/nutui-react-taro' +import Taro from '@tarojs/taro' +import { type ActivityType } from '../../components/ActivityTypeSwitch' +import CommonDialog from '../../components/CommonDialog' +import { withAuth } from '@/components' +import PublishForm from './publishForm' +import { FormFieldConfig, publishBallFormSchema } from '../../config/formSchema/publishBallFormSchema'; +import { PublishBallFormData } from '../../../types/publishBall'; +import PublishService from '@/services/publishService'; +import { getNextHourTime, getEndTime, delay } from '@/utils'; +import images from '@/config/images' +import styles from './index.module.scss' +import dayjs from 'dayjs' const defaultFormData: PublishBallFormData = { - title: "", + title: '', image_list: [], timeRange: { start_time: getNextHourTime(), - end_time: getEndTime(getNextHourTime()), + end_time: getEndTime(getNextHourTime()) }, activityInfo: { - play_type: "不限", - price: "", + play_type: '不限', + price: '', venue_id: null, - location_name: "", - location: "", - latitude: "", - longitude: "", - court_type: "", - court_surface: "", + location_name: '', + location: '', + latitude: '', + longitude: '', + court_type: '', + court_surface: '', venue_description_tag: [], - venue_description: "", + venue_description: '', venue_image_list: [], }, players: [1, 1], skill_level: [1.0, 5.0], descriptionInfo: { - description: "", + description: '', description_tag: [], }, is_substitute_supported: true, is_wechat_contact: true, - wechat_contact: "14223332214", -}; + wechat_contact: '14223332214' +} const PublishBall: React.FC = () => { - const [activityType, setActivityType] = useState("individual"); - const [isSubmitDisabled, setIsSubmitDisabled] = useState(false); + const [activityType, setActivityType] = useState('individual') + const [isSubmitDisabled, setIsSubmitDisabled] = useState(false) // 获取页面参数并设置导航标题 - const [optionsConfig, setOptionsConfig] = useState( - publishBallFormSchema, - ); + const [optionsConfig, setOptionsConfig] = useState(publishBallFormSchema) const [formData, setFormData] = useState([ - defaultFormData, - ]); - const [checked, setChecked] = useState(true); + defaultFormData + ]) + const [checked, setChecked] = useState(true) // 删除确认弹窗状态 const [deleteConfirm, setDeleteConfirm] = useState<{ @@ -67,225 +62,200 @@ const PublishBall: React.FC = () => { index: number; }>({ visible: false, - index: -1, - }); + index: -1 + }) // 更新表单数据 - const updateFormData = ( - key: keyof PublishBallFormData, - value: any, - index: number, - ) => { - console.log(key, value, index, "key, value, index"); - setFormData((prev) => { - const newData = [...prev]; - newData[index] = { ...newData[index], [key]: value }; - console.log(newData, "newData"); - return newData; - }); - }; + const updateFormData = (key: keyof PublishBallFormData, value: any, index: number) => { + console.log(key, value, index, 'key, value, index'); + setFormData(prev => { + const newData = [...prev] + newData[index] = { ...newData[index], [key]: value } + console.log(newData, 'newData'); + return newData + }) + } + // 处理活动类型变化 const handleActivityTypeChange = (type: ActivityType) => { - if (type === "group") { - setFormData([defaultFormData]); + if (type === 'group') { + setFormData([defaultFormData]) } else { - setFormData([defaultFormData]); + setFormData([defaultFormData]) } - }; + } // 检查相邻两组数据是否相同 const checkAdjacentDataSame = (formDataArray: PublishBallFormData[]) => { - if (formDataArray.length < 2) return false; + if (formDataArray.length < 2) return false - const lastIndex = formDataArray.length - 1; - const secondLastIndex = formDataArray.length - 2; + const lastIndex = formDataArray.length - 1 + const secondLastIndex = formDataArray.length - 2 - const lastData = formDataArray[lastIndex]; - const secondLastData = formDataArray[secondLastIndex]; + const lastData = formDataArray[lastIndex] + const secondLastData = formDataArray[secondLastIndex] // 比较关键字段是否相同 - return JSON.stringify(lastData) === JSON.stringify(secondLastData); - }; + return (JSON.stringify(lastData) === JSON.stringify(secondLastData)) + } const handleAdd = () => { // 检查最后两组数据是否相同 if (checkAdjacentDataSame(formData)) { Taro.showToast({ - title: "信息不可与前序场完全一致", - icon: "none", - }); - return; + title: '信息不可与前序场完全一致', + icon: 'none' + }) + return } - const newStartTime = getNextHourTime(); - setFormData((prev) => [ - ...prev, - { - ...defaultFormData, - title: "", - timeRange: { - start_time: newStartTime, - end_time: getEndTime(newStartTime), - }, - }, - ]); - }; + const newStartTime = getNextHourTime() + setFormData(prev => [...prev, { + ...defaultFormData, + title: '', + timeRange: { + start_time: newStartTime, + end_time: getEndTime(newStartTime) + } + }]) + } + // 复制上一场数据 const handleCopyPrevious = (index: number) => { if (index > 0) { - setFormData((prev) => { - const newData = [...prev]; - newData[index] = { ...newData[index - 1] }; - return newData; - }); + setFormData(prev => { + const newData = [...prev] + newData[index] = { ...newData[index - 1] } + return newData + }) Taro.showToast({ - title: "复制上一场填入", - icon: "success", - }); + title: '复制上一场填入', + icon: 'success' + }) } - }; + } // 删除确认弹窗 const showDeleteConfirm = (index: number) => { setDeleteConfirm({ visible: true, - index, - }); - }; + index + }) + } // 关闭删除确认弹窗 const closeDeleteConfirm = () => { setDeleteConfirm({ visible: false, - index: -1, - }); - }; + index: -1 + }) + } // 确认删除 const confirmDelete = () => { if (deleteConfirm.index >= 0) { - setFormData((prev) => - prev.filter((_, index) => index !== deleteConfirm.index), - ); - closeDeleteConfirm(); + setFormData(prev => prev.filter((_, index) => index !== deleteConfirm.index)) + closeDeleteConfirm() Taro.showToast({ - title: "已删除该场次", - icon: "success", - }); + title: '已删除该场次', + icon: 'success' + }) } - }; + } - const validateFormData = ( - formData: PublishBallFormData, - isOnSubmit: boolean = false, - ) => { + const validateFormData = (formData: PublishBallFormData, isOnSubmit: boolean = false) => { const { activityInfo, image_list, title, timeRange } = formData; - const { play_type, price, location_name } = activityInfo; + const { play_type, price, location_name } = activityInfo; if (!image_list?.length) { if (!isOnSubmit) { Taro.showToast({ title: `请上传活动封面`, - icon: "none", - }); + icon: 'none' + }) } - return false; + return false } if (!title) { if (!isOnSubmit) { Taro.showToast({ title: `请输入活动标题`, - icon: "none", - }); + icon: 'none' + }) } - return false; + return false } - if ( - !price || - (typeof price === "number" && price <= 0) || - (typeof price === "string" && !price.trim()) - ) { + if (!price || (typeof price === 'number' && price <= 0) || (typeof price === 'string' && !price.trim())) { if (!isOnSubmit) { Taro.showToast({ title: `请输入费用`, - icon: "none", - }); + icon: 'none' + }) } - return false; + return false } if (!play_type || !play_type.trim()) { if (!isOnSubmit) { Taro.showToast({ title: `请选择玩法类型`, - icon: "none", - }); + icon: 'none' + }) } - return false; + return false } if (!location_name || !location_name.trim()) { if (!isOnSubmit) { Taro.showToast({ title: `请选择场地`, - icon: "none", - }); + icon: 'none' + }) } - return false; + return false } // 时间范围校验:结束时间需晚于开始时间,且至少间隔30分钟(支持跨天) if (timeRange?.start_time && timeRange?.end_time) { - const start = dayjs(timeRange.start_time); - const end = dayjs(timeRange.end_time); + const start = dayjs(timeRange.start_time) + const end = dayjs(timeRange.end_time) if (!end.isAfter(start)) { if (!isOnSubmit) { Taro.showToast({ title: `结束时间需晚于开始时间`, - icon: "none", - }); + icon: 'none' + }) } - return false; + return false } - if (end.isBefore(start.add(30, "minute"))) { + if (end.isBefore(start.add(30, 'minute'))) { if (!isOnSubmit) { Taro.showToast({ title: `时间间隔至少30分钟`, - icon: "none", - }); + icon: 'none' + }) } - return false; + return false } } - return true; - }; + return true + } const validateOnSubmit = () => { - const isValid = - activityType === "individual" - ? validateFormData(formData[0], true) - : formData.every((item) => validateFormData(item, true)); + const isValid = activityType === 'individual' ? validateFormData(formData[0], true) : formData.every(item => validateFormData(item, true)) if (!isValid) { - return false; + return false } - return true; - }; + return true + } // 提交表单 const handleSubmit = async () => { // 基础验证 - console.log(formData, "formData"); - if (activityType === "individual") { - const isValid = validateFormData(formData[0]); + console.log(formData, 'formData'); + if (activityType === 'individual') { + const isValid = validateFormData(formData[0]) if (!isValid) { - return; + return } - const { - activityInfo, - descriptionInfo, - timeRange, - players, - skill_level, - image_list, - ...rest - } = formData[0]; + const { activityInfo, descriptionInfo, timeRange, players, skill_level,image_list, ...rest } = formData[0]; const options = { ...rest, ...activityInfo, @@ -295,50 +265,43 @@ const PublishBall: React.FC = () => { current_players: players[0], skill_level_min: skill_level[0], skill_level_max: skill_level[1], - image_list: image_list.map((item) => item.url), - }; + image_list: image_list.map(item => item.url) + } const res = await PublishService.createPersonal(options); if (res.code === 0 && res.data) { Taro.showToast({ - title: "发布成功", - icon: "success", - }); - delay(1000); + title: '发布成功', + icon: 'success' + }) + delay(1000) // 如果是个人球局,则跳转到详情页,并自动分享 // 如果是畅打,则跳转第一个球局详情页,并自动分享 @刘杰 Taro.navigateTo({ // @ts-expect-error: id - url: `/game_pages/detail/index?id=${res.data.id || 1}&from=publish`, - }); + url: `/pages/detail/index?id=${res.data.id || 1}&from=publish&autoShare=1` + }) } else { Taro.showToast({ title: res.message, - icon: "none", - }); + icon: 'none' + }) } } - if (activityType === "group") { - const isValid = formData.every((item) => validateFormData(item)); + if (activityType === 'group') { + const isValid = formData.every(item => validateFormData(item)) if (!isValid) { - return; + return } if (checkAdjacentDataSame(formData)) { Taro.showToast({ - title: "信息不可与前序场完全一致", - icon: "none", - }); - return; + title: '信息不可与前序场完全一致', + icon: 'none' + }) + return } const options = formData.map((item) => { - const { - activityInfo, - descriptionInfo, - timeRange, - players, - skill_level, - ...rest - } = item; - return { + const { activityInfo, descriptionInfo, timeRange, players, skill_level, ...rest } = item; + return { ...rest, ...activityInfo, ...descriptionInfo, @@ -347,146 +310,146 @@ const PublishBall: React.FC = () => { current_players: players[0], skill_level_min: skill_level[0], skill_level_max: skill_level[1], - image_list: item.image_list.map((img) => img.url), - }; - }); - const res = await PublishService.create_play_pmoothlys({ rows: options }); + image_list: item.image_list.map(img => img.url) + } + }) + const res = await PublishService.create_play_pmoothlys({rows: options}); if (res.code === 0 && res.data) { Taro.showToast({ - title: "发布成功", - icon: "success", - }); - delay(1000); + title: '发布成功', + icon: 'success' + }) + delay(1000) // 如果是个人球局,则跳转到详情页,并自动分享 // 如果是畅打,则跳转第一个球局详情页,并自动分享 @刘杰 Taro.navigateTo({ // @ts-expect-error: id - url: `/game_pages/detail/index?id=${res.data?.[0].id || 1}&from=publish`, - }); + url: `/pages/detail/index?id=${res.data?.[0].id || 1}&from=publish&autoShare=1` + }) } else { Taro.showToast({ title: res.message, - icon: "none", - }); + icon: 'none' + }) } } - }; + } const initFormData = () => { - const currentInstance = Taro.getCurrentInstance(); - const params = currentInstance.router?.params; + const currentInstance = Taro.getCurrentInstance() + const params = currentInstance.router?.params if (params?.type) { - const type = params.type as ActivityType; - if (type === "individual" || type === "group") { - setActivityType(type); - if (type === "group") { + const type = params.type as ActivityType + if (type === 'individual' || type === 'group') { + setActivityType(type) + if (type === 'group') { const newFormSchema = publishBallFormSchema.reduce((acc, item) => { - if (item.prop === "is_wechat_contact") { - return acc; + if (item.prop === 'is_wechat_contact') { + return acc } - if (item.prop === "image_list") { + if (item.prop === 'image_list') { if (item.props) { - item.props.source = ["album", "history"]; + item.props.source = ['album', 'history'] } } - if (item.prop === "players") { + if (item.prop === 'players') { if (item.props) { - item.props.max = 100; + item.props.max = 100 } } - acc.push(item); - return acc; - }, [] as FormFieldConfig[]); - setOptionsConfig(newFormSchema); - setFormData([defaultFormData]); + acc.push(item) + return acc + }, [] as FormFieldConfig[]) + setOptionsConfig(newFormSchema) + setFormData([defaultFormData]) } // 根据type设置导航标题 - if (type === "group") { + if (type === 'group') { Taro.setNavigationBarTitle({ - title: "发布畅打活动", - }); + title: '发布畅打活动' + }) } else { Taro.setNavigationBarTitle({ - title: "发布", - }); + title: '发布' + }) } } - handleActivityTypeChange(type); + handleActivityTypeChange(type) } - }; + } const onCheckedChange = (checked: boolean) => { - setChecked(checked); - }; + setChecked(checked) + } useEffect(() => { - const isValid = validateOnSubmit(); + const isValid = validateOnSubmit() if (!isValid) { - setIsSubmitDisabled(true); + setIsSubmitDisabled(true) } else { - setIsSubmitDisabled(false); + setIsSubmitDisabled(false) } - console.log(formData, "formData"); - }, [formData]); + console.log(formData, 'formData'); + }, [formData]) useEffect(() => { - initFormData(); - }, []); + initFormData() + }, []) return ( - + {/* 活动类型切换 */} - + {/* */} - - {formData.map((item, index) => ( - - {/* 场次标题行 */} - {activityType === "group" && index > 0 && ( - - + + { + formData.map((item, index) => ( + + {/* 场次标题行 */} + {activityType === 'group' && index > 0 && ( + + 第{index + 1}场 showDeleteConfirm(index)} - > - + className={styles['session-delete']} + onClick={() => showDeleteConfirm(index)} + > + + + + + + + {index > 0 && ( + handleCopyPrevious(index)} + > + 复制上一场 + + )} - - {index > 0 && ( - handleCopyPrevious(index)} - > - 复制上一场 - - )} - - - )} - updateFormData(key, value, index)} - optionsConfig={optionsConfig} - /> - - ))} - {activityType === "group" && ( - - - 再添加一场 - - )} + )} + updateFormData(key, value, index)} + optionsConfig={optionsConfig} + /> + + )) + } + { + activityType === 'group' && ( + + + 再添加一场 + + ) + } {/* 删除确认弹窗 */} @@ -500,32 +463,33 @@ const PublishBall: React.FC = () => { contentDesc="该操作不可恢复" /> {/* 完成按钮 */} - - - {activityType === "individual" && ( - - 点击确定发布约球,即表示已经同意条款 - 《约球规则》 - - )} - {activityType === "group" && ( - - - 已认证 徐汇爱打球官方球场,请严格遵守签约协议 - - )} + { + activityType === 'individual' && ( + + 点击确定发布约球,即表示已经同意条款 + 《约球规则》 + + ) + } + { + activityType === 'group' && ( + + + 已认证 徐汇爱打球官方球场,请严格遵守签约协议 + + ) + } - ); -}; + ) +} -export default withAuth(PublishBall); +export default withAuth(PublishBall) diff --git a/src/publish_pages/publishBall/publishForm.tsx b/src/publish_pages/publishBall/publishForm.tsx index de61049..a68a5eb 100644 --- a/src/publish_pages/publishBall/publishForm.tsx +++ b/src/publish_pages/publishBall/publishForm.tsx @@ -2,8 +2,8 @@ import React, { useState, useEffect } from 'react' import { View, Text } from '@tarojs/components' import { ImageUpload, Range, TimeSelector, TextareaTag, NumberInterval, TitleTextarea, FormSwitch, UploadCover } from '@/components' import FormBasicInfo from './components/FormBasicInfo' -import { type CoverImage } from '@/components/index.types' -import { FormFieldConfig, FieldType } from '@/config/formSchema/publishBallFormSchema' +import { type CoverImage } from '../../components/index.types' +import { FormFieldConfig, FieldType } from '../../config/formSchema/publishBallFormSchema' import { PublishBallFormData } from '../../../types/publishBall'; import WechatSwitch from './components/WechatSwitch/WechatSwitch' import styles from './index.module.scss' @@ -97,15 +97,15 @@ const PublishForm: React.FC<{ console.warn('getNTRPText: ntrp 不是有效的数组格式:', ntrp); return '未设置'; } - + const [min, max] = ntrp; - + // 检查 min 和 max 是否为有效数字 if (typeof min !== 'number' || typeof max !== 'number') { console.warn('getNTRPText: min 或 max 不是有效数字:', { min, max }); return '未设置'; } - + if (min === 1.0 && max === 5.0) { return '不限' } @@ -124,7 +124,7 @@ const PublishForm: React.FC<{ if (min > 1.0 && max < 5.0) { return `${min.toFixed(1)} - ${max.toFixed(1)}之间` } - + return ''; } @@ -134,15 +134,15 @@ const PublishForm: React.FC<{ console.warn('getPlayersText: players 不是有效的数组格式:', players); return '未设置'; } - + const [min, max] = players; - + // 检查 min 和 max 是否为有效数字 if (typeof min !== 'number' || typeof max !== 'number') { console.warn('getPlayersText: min 或 max 不是有效数字:', { min, max }); return '未设置'; } - + return `最少${min}人,最多${max}人` }