|
|
@@ -16,7 +16,7 @@ export default function Component() {
|
|
|
const [key, setKey] = useState('');
|
|
|
const [value, setValue] = useState('');
|
|
|
const user = useSelector((state: any) => state.user);
|
|
|
- // const common = useSelector((state: any) => state.common);
|
|
|
+ const common = useSelector((state: any) => state.common);
|
|
|
const [isFast, setIsFast] = useState(true);
|
|
|
const [fastValues, setFastValues] = useState<number[]>([0, 0]);
|
|
|
const [sleepValues, setSleepValues] = useState<number[]>([0, 0]);
|
|
|
@@ -28,6 +28,7 @@ export default function Component() {
|
|
|
const [showModal, setShowModal] = useState(false);
|
|
|
const [fastPickerValue, setFastPickerValue] = useState([0,0])
|
|
|
const [sleepPickerValue, setSleepPickerValue] = useState([0,0])
|
|
|
+ const [isOpenDurationPicker, setIsOpenDurationPicker] = useState(false)
|
|
|
|
|
|
// const [pickerValue, setPickerValue] = useState([0,0])
|
|
|
|
|
|
@@ -93,7 +94,7 @@ export default function Component() {
|
|
|
setFastStr(fastTime);
|
|
|
var fastCount = current_record.fast.target_end_time - current_record.fast.target_start_time
|
|
|
setFastDuration(fastCount)
|
|
|
- // setFastPickerValue(durationIndex(current_record.fast.target_start_time, current_record.fast.target_end_time, common))
|
|
|
+ setFastPickerValue(durationIndex(current_record.fast.target_start_time, current_record.fast.target_end_time, common))
|
|
|
// setFastPickerValue([fastCount / 60000 / 5 - 12])
|
|
|
}
|
|
|
|
|
|
@@ -109,7 +110,7 @@ export default function Component() {
|
|
|
var sleepCount = current_record.sleep.target_end_time - current_record.sleep.target_start_time
|
|
|
|
|
|
setSleepDuration(sleepCount)
|
|
|
- // setSleepPickerValue(durationIndex(current_record.sleep.target_start_time, current_record.sleep.target_end_time, common))
|
|
|
+ setSleepPickerValue(durationIndex(current_record.sleep.target_start_time, current_record.sleep.target_end_time, common))
|
|
|
// setSleepPickerValue([sleepCount / 60000 / 5 - 12])
|
|
|
}
|
|
|
}
|
|
|
@@ -205,9 +206,11 @@ export default function Component() {
|
|
|
};
|
|
|
|
|
|
function durationChange(e) {
|
|
|
- var count = e[0] * 5 + 60;
|
|
|
+ var count = (e[0]+common.duration.min)*60+e[1]*common.duration.step
|
|
|
isFast ? setFastDuration(count * 60000) : setSleepDuration(count * 60000);
|
|
|
- isFast ? setFastPickerValue(e[0]) : setSleepPickerValue(e[0]);
|
|
|
+ isFast?setFastPickerValue(e):setSleepPickerValue(e)
|
|
|
+
|
|
|
+ setIsOpenDurationPicker(false)
|
|
|
}
|
|
|
|
|
|
function login() {
|
|
|
@@ -233,7 +236,7 @@ export default function Component() {
|
|
|
}
|
|
|
|
|
|
function showDurationPicker() {
|
|
|
-
|
|
|
+ setIsOpenDurationPicker(true)
|
|
|
}
|
|
|
|
|
|
if (!user.isLogin) {
|
|
|
@@ -245,10 +248,10 @@ export default function Component() {
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
- const [isOpenDurationPicker, setIsOpenDurationPicker] = useState(false)
|
|
|
+
|
|
|
function durationPickerContent() {
|
|
|
return <View style={{ color: '#000' }}>
|
|
|
- {/* <PickerViews onChange={durationChange} items={durationDatas(common)} value={isFast?fastPickerValue:sleepPickerValue} height={200} showBtns={true} onCancel={() => { setIsOpenDurationPicker(false) }} /> */}
|
|
|
+ <PickerViews onChange={durationChange} items={durationDatas(common)} value={isFast?fastPickerValue:sleepPickerValue} height={200} showBtns={true} onCancel={() => { setIsOpenDurationPicker(false) }} />
|
|
|
</View>
|
|
|
}
|
|
|
return (
|
|
|
@@ -268,7 +271,7 @@ export default function Component() {
|
|
|
}
|
|
|
{
|
|
|
(value == 'ONGOING1' || value == 'WAIT_FOR_START') &&
|
|
|
- <Text onClick={showDurationPicker}>{durationFormate()}</Text>
|
|
|
+ <Text style={{marginBottom:10}} onClick={showDurationPicker}>时长:{durationFormate()}</Text>
|
|
|
// <PickerViews onChange={durationChange} items={[pickerDurations()]} value={isFast ? [fastPickerValue] : [sleepPickerValue]} />
|
|
|
// <TimePickers time={isFast ? fastStr : sleepStr} content="" change={handlePickerChange} isPickerView={true} />
|
|
|
}
|