修改日历与弹出窗
This commit is contained in:
@@ -133,7 +133,7 @@ const CommonPopup: React.FC<CommonPopupProps> = ({
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{!hideFooter && (
|
{!hideFooter && (
|
||||||
<View className={styles['common-popup__footer']}>
|
<View className={`${styles['common-popup__footer']} custom_footer`}>
|
||||||
<Button className={`${styles['common-popup__btn']} ${styles['common-popup__btn-cancel']}`} type='default' size='small' onClick={handleCancel}>
|
<Button className={`${styles['common-popup__btn']} ${styles['common-popup__btn-cancel']}`} type='default' size='small' onClick={handleCancel}>
|
||||||
{cancelText}
|
{cancelText}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ const DayDialog: React.FC<DayDialogProps> = ({
|
|||||||
onChange,
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
const [selected, setSelected] = useState<Date | Date[]>(value || new Date());
|
const [selected, setSelected] = useState<Date | Date[]>(value || new Date());
|
||||||
const [selectedBackup, setSelectedBackup] = useState<Date[]>(
|
|
||||||
Array.isArray(value) ? [...(value as Date[])] : [value as Date]
|
|
||||||
);
|
|
||||||
const calendarRef = useRef<CalendarUIRef>(null);
|
const calendarRef = useRef<CalendarUIRef>(null);
|
||||||
const [type, setType] = useState<"year" | "month" | "time">("year");
|
const [type, setType] = useState<"year" | "month" | "time">("year");
|
||||||
const [pendingJump, setPendingJump] = useState<{
|
const [pendingJump, setPendingJump] = useState<{
|
||||||
@@ -47,26 +44,6 @@ const DayDialog: React.FC<DayDialogProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleChange = (d: Date | Date[]) => {
|
const handleChange = (d: Date | Date[]) => {
|
||||||
if (searchType === "range") {
|
|
||||||
if (Array.isArray(d)) {
|
|
||||||
if (d.length === 2) {
|
|
||||||
return;
|
|
||||||
} else if (d.length === 1) {
|
|
||||||
if (selectedBackup.length === 0 || selectedBackup.length === 2) {
|
|
||||||
setSelected([...d]);
|
|
||||||
setSelectedBackup([...d]);
|
|
||||||
} else {
|
|
||||||
setSelected(
|
|
||||||
[...selectedBackup, d[0]].sort(
|
|
||||||
(a, b) => a.getTime() - b.getTime()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
setSelectedBackup([]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Array.isArray(d)) {
|
if (Array.isArray(d)) {
|
||||||
setSelected(d[0]);
|
setSelected(d[0]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ const HourDialog: React.FC<HourDialogProps> = ({
|
|||||||
const handleConfirm = () => {
|
const handleConfirm = () => {
|
||||||
const value = hourMinutePickerRef.current?.getValue();
|
const value = hourMinutePickerRef.current?.getValue();
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
onChange(value);
|
const [hour, minute] = value || [];
|
||||||
|
const hours = hour.toString().padStart(2, "0");
|
||||||
|
const minutes = minute.toString().padStart(2, "0");
|
||||||
|
onChange([hours, minutes]);
|
||||||
}
|
}
|
||||||
dialogClose();
|
dialogClose();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ const CustomPicker = ({
|
|||||||
Array.isArray(currentValue) &&
|
Array.isArray(currentValue) &&
|
||||||
valuesList.length === currentValue.length &&
|
valuesList.length === currentValue.length &&
|
||||||
valuesList.every((v: any, idx: number) => v === currentValue[idx])
|
valuesList.every((v: any, idx: number) => v === currentValue[idx])
|
||||||
|
|
||||||
console.log(isSame,valuesList, 'isSameisSameisSameisSame');
|
|
||||||
if (!isSame) {
|
if (!isSame) {
|
||||||
setCurrentValue(valuesList)
|
setCurrentValue(valuesList)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import dayjs from 'dayjs'
|
|||||||
const parseDate = (dateStr: string): Date => {
|
const parseDate = (dateStr: string): Date => {
|
||||||
if (!dateStr) return new Date();
|
if (!dateStr) return new Date();
|
||||||
// 将 "yyyy-MM-dd HH:mm:ss" 转换为 "yyyy-MM-ddTHH:mm:ss"
|
// 将 "yyyy-MM-dd HH:mm:ss" 转换为 "yyyy-MM-ddTHH:mm:ss"
|
||||||
|
console.log(dateStr, 'dateStrdateStrdateStr');
|
||||||
const isoStr = dateStr.replace(/^(\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2}(?::\d{2})?)$/, '$1T$2');
|
const isoStr = dateStr.replace(/^(\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2}(?::\d{2})?)$/, '$1T$2');
|
||||||
|
console.log(isoStr, 'isoStr');
|
||||||
|
console.log(new Date(isoStr), 'new Date');
|
||||||
return new Date(isoStr);
|
return new Date(isoStr);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -43,11 +46,11 @@ const TimeSelector: React.FC<TimeSelectorProps> = ({
|
|||||||
console.log('选择的日期:', date)
|
console.log('选择的日期:', date)
|
||||||
const start_time = currentTimeType === 'start' ? getDateStr(date) : value.start_time;
|
const start_time = currentTimeType === 'start' ? getDateStr(date) : value.start_time;
|
||||||
const end_time = currentTimeType === 'end' ? getDateStr(date) : value.end_time;
|
const end_time = currentTimeType === 'end' ? getDateStr(date) : value.end_time;
|
||||||
const isLater = dayjs(start_time).isAfter(dayjs(end_time));
|
// const isLater = dayjs(start_time).isAfter(dayjs(end_time));
|
||||||
if (isLater) {
|
// if (isLater) {
|
||||||
if (onChange) onChange({start_time, end_time: getEndTime(start_time)})
|
// if (onChange) onChange({start_time, end_time: getEndTime(start_time)})
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if (onChange) onChange({start_time, end_time})
|
if (onChange) onChange({start_time, end_time})
|
||||||
}
|
}
|
||||||
const onChangeDay = (years:any) => {
|
const onChangeDay = (years:any) => {
|
||||||
@@ -62,7 +65,7 @@ const TimeSelector: React.FC<TimeSelectorProps> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onChangeHour = (dates) => {
|
const onChangeHour = (dates) => {
|
||||||
const [hour, minute] = dates;
|
const [hour, minute = '00'] = dates;
|
||||||
if (onChange){
|
if (onChange){
|
||||||
if (currentTimeType === 'start') {
|
if (currentTimeType === 'start') {
|
||||||
const year = dayjs(value.start_time).format('YYYY-MM-DD')
|
const year = dayjs(value.start_time).format('YYYY-MM-DD')
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
|
||||||
// 搜索区域
|
// 搜索区域
|
||||||
.search-section {
|
.search-section {
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
background: white;
|
background: white;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
.stadium-detail-scroll{
|
.stadium-detail-scroll{
|
||||||
height:72vh;
|
height:60vh;
|
||||||
}
|
}
|
||||||
// 已选球场
|
// 已选球场
|
||||||
// 场馆列表
|
// 场馆列表
|
||||||
@@ -57,7 +56,9 @@
|
|||||||
// 场地类型
|
// 场地类型
|
||||||
.venue-type-section {
|
.venue-type-section {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
&.image-wrap{
|
||||||
|
padding-bottom: 30px;
|
||||||
|
}
|
||||||
.section-title {
|
.section-title {
|
||||||
padding: 18px 20px 10px 20px;
|
padding: 18px 20px 10px 20px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ const SectionTitle: React.FC<{ title: string,prop: string }> = ({ title, prop })
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 公共的容器组件
|
// 公共的容器组件
|
||||||
const SectionContainer: React.FC<{ title: string; children: React.ReactNode, prop: string }> = ({ title, children, prop }) => (
|
const SectionContainer: React.FC<{ title: string; children: React.ReactNode, prop: string, type?: string }> = ({ title, children, prop, type }) => (
|
||||||
<View className='venue-type-section'>
|
<View className={`venue-type-section ${type === 'image' ? 'image-wrap' : ''}`}>
|
||||||
<SectionTitle title={title} prop={prop}/>
|
<SectionTitle title={title} prop={prop}/>
|
||||||
<View className='option-buttons'>
|
<View className='option-buttons'>
|
||||||
{children}
|
{children}
|
||||||
@@ -218,8 +218,8 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
<TextareaTag
|
<TextareaTag
|
||||||
value={formData[item.prop]}
|
value={formData[item.prop]}
|
||||||
onChange={(value) => updateFormData(item.prop, value)}
|
onChange={(value) => updateFormData(item.prop, value)}
|
||||||
// onBlur={() => onAnyInput(false)}
|
onBlur={() => changePicker(false)}
|
||||||
// onFocus={() => onAnyInput(true)}
|
onFocus={() => changePicker(true)}
|
||||||
placeholder='有其他场地信息可备注'
|
placeholder='有其他场地信息可备注'
|
||||||
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
||||||
/>
|
/>
|
||||||
@@ -230,7 +230,7 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
|||||||
|
|
||||||
if (item.type === 'image') {
|
if (item.type === 'image') {
|
||||||
return (
|
return (
|
||||||
<SectionContainer key={item.label} title={item.label} prop={item.prop}>
|
<SectionContainer key={item.label} title={item.label} prop={item.prop} type={item.type}>
|
||||||
<UploadCover
|
<UploadCover
|
||||||
value={formData[item.prop]}
|
value={formData[item.prop]}
|
||||||
changePicker={changePicker}
|
changePicker={changePicker}
|
||||||
|
|||||||
Reference in New Issue
Block a user