修改经纬度
This commit is contained in:
@@ -98,8 +98,8 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
name: stadium.name,
|
name: stadium.name,
|
||||||
address: stadium.address,
|
address: stadium.address,
|
||||||
latitude: stadium.longitude,
|
latitude: stadium.latitude,
|
||||||
longitude: stadium.latitude,
|
longitude: stadium.longitude,
|
||||||
istance: stadium.distance_km,
|
istance: stadium.distance_km,
|
||||||
court_type: court_type[0] || '',
|
court_type: court_type[0] || '',
|
||||||
court_surface: court_surface[0] || '',
|
court_surface: court_surface[0] || '',
|
||||||
|
|||||||
@@ -11,13 +11,23 @@ interface FormSwitchProps {
|
|||||||
|
|
||||||
const FormSwitch: React.FC<FormSwitchProps> = ({ value, onChange, subTitle, wechatId }) => {
|
const FormSwitch: React.FC<FormSwitchProps> = ({ value, onChange, subTitle, wechatId }) => {
|
||||||
const [editWechat, setEditWechat] = useState(false)
|
const [editWechat, setEditWechat] = useState(false)
|
||||||
|
const [wechatIdValue, setWechatIdValue] = useState('')
|
||||||
|
const [wechat, setWechat] = useState(wechatId)
|
||||||
const editWechatId = () => {
|
const editWechatId = () => {
|
||||||
|
setEditWechat(true)
|
||||||
}
|
}
|
||||||
const setWechatId = useCallback((e: any) => {
|
const setWechatId = useCallback((e: any) => {
|
||||||
const value = e.target.value
|
const value = e.target.value
|
||||||
onChange(value)
|
onChange && onChange(value)
|
||||||
}, [])
|
setWechatIdValue(value)
|
||||||
|
}, [onChange])
|
||||||
|
|
||||||
|
const fillWithPhone = () => {
|
||||||
|
if (wechat) {
|
||||||
|
setWechatIdValue(wechat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles['wechat-contact-section']}>
|
<View className={styles['wechat-contact-section']}>
|
||||||
@@ -32,7 +42,7 @@ const FormSwitch: React.FC<FormSwitchProps> = ({ value, onChange, subTitle, wech
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
wechatId && (
|
!editWechat && wechatId && (
|
||||||
<View className={styles['wechat-contact-id']}>
|
<View className={styles['wechat-contact-id']}>
|
||||||
<Text className={styles['wechat-contact-text']}>微信号: {wechatId.replace(/(\d{3})(\d{4})(\d{4})/, '$1 $2 $3')}</Text>
|
<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>
|
<View className={styles['wechat-contact-edit']} onClick={editWechatId}>修改</View>
|
||||||
@@ -41,8 +51,11 @@ const FormSwitch: React.FC<FormSwitchProps> = ({ value, onChange, subTitle, wech
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
editWechat && (
|
editWechat && (
|
||||||
<View className={styles['wechat-contact-edit']}>
|
<View className={styles['wechat-contact-id']}>
|
||||||
<Input value={wechatId} onInput={setWechatId} />
|
<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>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@use '~@/scss/themeColor.scss' as theme;
|
||||||
|
|
||||||
.wechat-contact-section {
|
.wechat-contact-section {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
@@ -86,6 +88,13 @@
|
|||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
border: 0.5px solid rgba(0, 0, 0, 0.06);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ import PublishService from '@/services/publishService';
|
|||||||
import { getNextHourTime, getEndTime, delay } from '@/utils';
|
import { getNextHourTime, getEndTime, delay } from '@/utils';
|
||||||
import images from '@/config/images'
|
import images from '@/config/images'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
const defaultFormData: PublishBallFormData = {
|
const defaultFormData: PublishBallFormData = {
|
||||||
title: '',
|
title: '',
|
||||||
@@ -164,7 +165,7 @@ const PublishBall: React.FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const validateFormData = (formData: PublishBallFormData, isOnSubmit: boolean = false) => {
|
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;
|
const { play_type, price, location_name } = activityInfo;
|
||||||
if (!image_list?.length) {
|
if (!image_list?.length) {
|
||||||
if (!isOnSubmit) {
|
if (!isOnSubmit) {
|
||||||
@@ -211,6 +212,30 @@ const PublishBall: React.FC = () => {
|
|||||||
}
|
}
|
||||||
return false
|
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
|
return true
|
||||||
}
|
}
|
||||||
const validateOnSubmit = () => {
|
const validateOnSubmit = () => {
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ const PublishForm: React.FC<{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取动态表单配置
|
// 获取动态表单配置
|
||||||
const dynamicConfig = getDynamicFormConfig()
|
const dynamicConfig = getDynamicFormConfig()
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ export interface createGameData extends PublishBallData {
|
|||||||
status: string,
|
status: string,
|
||||||
created_at: string,
|
created_at: string,
|
||||||
updated_at: string,
|
updated_at: string,
|
||||||
|
id?: string | number,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 响应接口
|
// 响应接口
|
||||||
|
|||||||
Reference in New Issue
Block a user