修改经纬度

This commit is contained in:
筱野
2025-09-07 22:34:43 +08:00
6 changed files with 57 additions and 10 deletions

View File

@@ -98,8 +98,8 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
const [formData, setFormData] = useState({
name: stadium.name,
address: stadium.address,
latitude: stadium.longitude,
longitude: stadium.latitude,
latitude: stadium.latitude,
longitude: stadium.longitude,
istance: stadium.distance_km,
court_type: court_type[0] || '',
court_surface: court_surface[0] || '',

View File

@@ -11,13 +11,23 @@ interface FormSwitchProps {
const FormSwitch: React.FC<FormSwitchProps> = ({ value, onChange, subTitle, wechatId }) => {
const [editWechat, setEditWechat] = useState(false)
const [wechatIdValue, setWechatIdValue] = useState('')
const [wechat, setWechat] = useState(wechatId)
const editWechatId = () => {
setEditWechat(true)
}
const setWechatId = useCallback((e: any) => {
const value = e.target.value
onChange(value)
}, [])
onChange && onChange(value)
setWechatIdValue(value)
}, [onChange])
const fillWithPhone = () => {
if (wechat) {
setWechatIdValue(wechat)
}
}
return (
<>
<View className={styles['wechat-contact-section']}>
@@ -32,7 +42,7 @@ const FormSwitch: React.FC<FormSwitchProps> = ({ value, onChange, subTitle, wech
</View>
</View>
{
wechatId && (
!editWechat && wechatId && (
<View className={styles['wechat-contact-id']}>
<Text className={styles['wechat-contact-text']}>: {wechatId.replace(/(\d{3})(\d{4})(\d{4})/, '$1 $2 $3')}</Text>
<View className={styles['wechat-contact-edit']} onClick={editWechatId}></View>
@@ -41,8 +51,11 @@ const FormSwitch: React.FC<FormSwitchProps> = ({ value, onChange, subTitle, wech
}
{
editWechat && (
<View className={styles['wechat-contact-edit']}>
<Input value={wechatId} onInput={setWechatId} />
<View className={styles['wechat-contact-id']}>
<View className={styles['wechat-contact-edit-input']}>
<Input value={wechatIdValue} onInput={setWechatId} placeholder='请输入正确微信号' />
</View>
<View className={styles['wechat-contact-edit']} onClick={fillWithPhone}>{wechat}</View>
</View>
)
}

View File

@@ -1,3 +1,5 @@
@use '~@/scss/themeColor.scss' as theme;
.wechat-contact-section {
background: #fff;
border-radius: 12px;
@@ -86,6 +88,13 @@
border-radius: 100px;
border: 0.5px solid rgba(0, 0, 0, 0.06);
}
.wechat-contact-edit-input {
max-width: 200px;
font-size: 12px;
.input-placeholder{
color: theme.$textarea-placeholder-color;
}
}
}
}

View File

@@ -12,6 +12,7 @@ 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: '',
@@ -164,7 +165,7 @@ const PublishBall: React.FC = () => {
}
const validateFormData = (formData: PublishBallFormData, isOnSubmit: boolean = false) => {
const { activityInfo, image_list, title } = formData;
const { activityInfo, image_list, title, timeRange } = formData;
const { play_type, price, location_name } = activityInfo;
if (!image_list?.length) {
if (!isOnSubmit) {
@@ -211,6 +212,30 @@ const PublishBall: React.FC = () => {
}
return false
}
// 时间范围校验结束时间需晚于开始时间且至少间隔30分钟支持跨天
if (timeRange?.start_time && 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'
})
}
return false
}
if (end.isBefore(start.add(30, 'minute'))) {
if (!isOnSubmit) {
Taro.showToast({
title: `时间间隔至少30分钟`,
icon: 'none'
})
}
return false
}
}
return true
}
const validateOnSubmit = () => {

View File

@@ -136,7 +136,6 @@ const PublishForm: React.FC<{
// 获取动态表单配置
const dynamicConfig = getDynamicFormConfig()

View File

@@ -34,6 +34,7 @@ export interface createGameData extends PublishBallData {
status: string,
created_at: string,
updated_at: string,
id?: string | number,
}
// 响应接口