修改日历与弹出窗
This commit is contained in:
@@ -133,7 +133,7 @@ const CommonPopup: React.FC<CommonPopupProps> = ({
|
||||
</View>
|
||||
|
||||
{!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}>
|
||||
{cancelText}
|
||||
</Button>
|
||||
|
||||
@@ -24,9 +24,6 @@ const DayDialog: React.FC<DayDialogProps> = ({
|
||||
onChange,
|
||||
}) => {
|
||||
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 [type, setType] = useState<"year" | "month" | "time">("year");
|
||||
const [pendingJump, setPendingJump] = useState<{
|
||||
@@ -47,26 +44,6 @@ const DayDialog: React.FC<DayDialogProps> = ({
|
||||
}
|
||||
|
||||
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)) {
|
||||
setSelected(d[0]);
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,10 @@ const HourDialog: React.FC<HourDialogProps> = ({
|
||||
const handleConfirm = () => {
|
||||
const value = hourMinutePickerRef.current?.getValue();
|
||||
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();
|
||||
};
|
||||
|
||||
@@ -51,8 +51,6 @@ const CustomPicker = ({
|
||||
Array.isArray(currentValue) &&
|
||||
valuesList.length === currentValue.length &&
|
||||
valuesList.every((v: any, idx: number) => v === currentValue[idx])
|
||||
|
||||
console.log(isSame,valuesList, 'isSameisSameisSameisSame');
|
||||
if (!isSame) {
|
||||
setCurrentValue(valuesList)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@ import dayjs from 'dayjs'
|
||||
const parseDate = (dateStr: string): Date => {
|
||||
if (!dateStr) return new Date();
|
||||
// 将 "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');
|
||||
console.log(isoStr, 'isoStr');
|
||||
console.log(new Date(isoStr), 'new Date');
|
||||
return new Date(isoStr);
|
||||
};
|
||||
|
||||
@@ -43,11 +46,11 @@ const TimeSelector: React.FC<TimeSelectorProps> = ({
|
||||
console.log('选择的日期:', date)
|
||||
const start_time = currentTimeType === 'start' ? getDateStr(date) : value.start_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 isLater = dayjs(start_time).isAfter(dayjs(end_time));
|
||||
// if (isLater) {
|
||||
// if (onChange) onChange({start_time, end_time: getEndTime(start_time)})
|
||||
// return
|
||||
// }
|
||||
if (onChange) onChange({start_time, end_time})
|
||||
}
|
||||
const onChangeDay = (years:any) => {
|
||||
@@ -62,7 +65,7 @@ const TimeSelector: React.FC<TimeSelectorProps> = ({
|
||||
}
|
||||
}
|
||||
const onChangeHour = (dates) => {
|
||||
const [hour, minute] = dates;
|
||||
const [hour, minute = '00'] = dates;
|
||||
if (onChange){
|
||||
if (currentTimeType === 'start') {
|
||||
const year = dayjs(value.start_time).format('YYYY-MM-DD')
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
|
||||
|
||||
// 搜索区域
|
||||
.search-section {
|
||||
background: #f5f5f5;
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
background: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
.stadium-detail-scroll{
|
||||
height:72vh;
|
||||
height:60vh;
|
||||
}
|
||||
// 已选球场
|
||||
// 场馆列表
|
||||
@@ -57,7 +56,9 @@
|
||||
// 场地类型
|
||||
.venue-type-section {
|
||||
flex-shrink: 0;
|
||||
|
||||
&.image-wrap{
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
.section-title {
|
||||
padding: 18px 20px 10px 20px;
|
||||
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 }) => (
|
||||
<View className='venue-type-section'>
|
||||
const SectionContainer: React.FC<{ title: string; children: React.ReactNode, prop: string, type?: string }> = ({ title, children, prop, type }) => (
|
||||
<View className={`venue-type-section ${type === 'image' ? 'image-wrap' : ''}`}>
|
||||
<SectionTitle title={title} prop={prop}/>
|
||||
<View className='option-buttons'>
|
||||
{children}
|
||||
@@ -218,8 +218,8 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
<TextareaTag
|
||||
value={formData[item.prop]}
|
||||
onChange={(value) => updateFormData(item.prop, value)}
|
||||
// onBlur={() => onAnyInput(false)}
|
||||
// onFocus={() => onAnyInput(true)}
|
||||
onBlur={() => changePicker(false)}
|
||||
onFocus={() => changePicker(true)}
|
||||
placeholder='有其他场地信息可备注'
|
||||
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
||||
/>
|
||||
@@ -230,7 +230,7 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
|
||||
if (item.type === 'image') {
|
||||
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
|
||||
value={formData[item.prop]}
|
||||
changePicker={changePicker}
|
||||
|
||||
Reference in New Issue
Block a user