Merge remote-tracking branch 'origin/publish_hanxia'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { InputNumber } from '@nutui/nutui-react-taro'
|
||||
import { Checkbox } from '@nutui/nutui-react-taro'
|
||||
@@ -17,7 +17,19 @@ const NumberInterval: React.FC<NumberIntervalProps> = ({
|
||||
min,
|
||||
max
|
||||
}) => {
|
||||
const { min:minParticipants, max:maxParticipants, organizer_joined } = value || { min: 1, max: 1, organizer_joined: true }
|
||||
const [organizer_joined, setOrganizerJoined] = useState(true);
|
||||
const [minParticipants, setMinParticipants] = useState(1);
|
||||
const [maxParticipants, setMaxParticipants] = useState(1);
|
||||
|
||||
useEffect(() => {
|
||||
if (value) {
|
||||
setOrganizerJoined(value.organizer_joined);
|
||||
setMinParticipants(value.min);
|
||||
setMaxParticipants(value.max);
|
||||
}
|
||||
console.log(value, 'valuevaluevaluevaluevaluevalue');
|
||||
}, [value]);
|
||||
|
||||
const handleChange = (value: { min: number | string, max: number | string, organizer_joined: boolean }) => {
|
||||
const toNumber = (v: number | string): number => typeof v === 'string' ? Number(v) : v
|
||||
const { min, max, organizer_joined } = value;
|
||||
@@ -32,7 +44,7 @@ const NumberInterval: React.FC<NumberIntervalProps> = ({
|
||||
<View className='control-buttons'>
|
||||
<InputNumber
|
||||
className="format-width"
|
||||
defaultValue={minParticipants}
|
||||
value={minParticipants}
|
||||
min={min}
|
||||
max={maxParticipants}
|
||||
onChange={(value) => handleChange({ min: value, max: maxParticipants, organizer_joined: organizer_joined })}
|
||||
@@ -45,7 +57,7 @@ const NumberInterval: React.FC<NumberIntervalProps> = ({
|
||||
<View className='control-buttons'>
|
||||
<InputNumber
|
||||
className="format-width"
|
||||
defaultValue={maxParticipants}
|
||||
value={maxParticipants}
|
||||
onChange={(value) => handleChange({ min: minParticipants, max: value, organizer_joined: organizer_joined })}
|
||||
min={minParticipants}
|
||||
max={max}
|
||||
|
||||
@@ -89,7 +89,7 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
<Image src={images.ICON_GROUP} />
|
||||
</View>
|
||||
</View>
|
||||
<View
|
||||
{/* <View
|
||||
className={`${styles.menuItem} ${styles.aiItem}`}
|
||||
onClick={() => handleMenuItemClick('ai')}
|
||||
>
|
||||
@@ -105,7 +105,7 @@ const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
<View className={styles.menuIcon}>
|
||||
<Image src={images.ICON_IMPORTANT_BTN} />
|
||||
</View>
|
||||
</View>
|
||||
</View> */}
|
||||
</View>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user