leon 1 year ago
parent
commit
d2c711c697

+ 56 - 5
src/features/trackTimeDuration/components/CircadianDetailPopup.tsx

@@ -216,6 +216,9 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
                 end = props.record.sleep.real_end_time
                 break;
         }
+        if (start > end) {
+            return '-' + TimeFormatter.durationFormate2(start, end)
+        }
         return TimeFormatter.durationFormate2(start, end)
     }
 
@@ -328,6 +331,20 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
 
             setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
 
+            if (props.record.status == 'WAIT_FOR_START' && props.schedule) {
+                var start = props.schedule.fast.start_time
+                var startCount = (parseInt(start.split(':')[0]) * 60 + parseInt(start.split(':')[1])) * 60 * 1000
+                var endCount = startCount + count
+                if (endCount >= 24 * 3600 * 1000) {
+                    endCount -= 24 * 3600 * 1000
+                }
+                endCount = endCount / 60000
+                var endHour = Math.floor(endCount / 60)
+                var endMinute = endCount % 60
+                var endTime = TimeFormatter.padZero(endHour) + ':' + TimeFormatter.padZero(endMinute)
+                console.log(endTime)
+            }
+
         }
         else {
             if (props.record.status == 'WAIT_FOR_START' && props.record.scenario == 'FAST_SLEEP') {
@@ -371,6 +388,20 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
             detail.fast.target_end_time = detail.fast.target_start_time + count;
 
             setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
+
+            if (props.record.status == 'WAIT_FOR_START' && props.schedule) {
+                var start = props.schedule.fast.start_time
+                var startCount = (parseInt(start.split(':')[0]) * 60 + parseInt(start.split(':')[1])) * 60 * 1000
+                var endCount = startCount + count
+                if (endCount >= 24 * 3600 * 1000) {
+                    endCount -= 24 * 3600 * 1000
+                }
+                endCount = endCount / 60000
+                var endHour = Math.floor(endCount / 60)
+                var endMinute = endCount % 60
+                var endTime = TimeFormatter.padZero(endHour) + ':' + TimeFormatter.padZero(endMinute)
+                console.log(endTime)
+            }
         }
         else {
             if (props.record.status == 'WAIT_FOR_START' && props.record.scenario == 'FAST_SLEEP') {
@@ -408,8 +439,18 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
                 <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
                 <View onClick={() => tapDuration(true)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
                     <Text className='pop_duration_txt' style={{ color: ColorType.fast }}>{TimeFormatter.durationFormate(detail.fast.target_start_time, detail.fast.target_end_time)}</Text>
-                    <View onClick={() => tapMinus(true)} className='minus' style={{ backgroundColor: ColorType.fast, opacity: 0.6 }}><IconMinus color='#090909' /></View>
-                    <View onClick={() => tapPlus(true)} className='plus' style={{ backgroundColor: ColorType.fast }}><IconPlus color='#090909' /></View>
+                    <View onClick={(e) => {
+                        if (process.env.TARO_ENV == 'weapp') {
+                            e.stopPropagation()
+                        }
+                        tapMinus(true)
+                    }} className='minus' style={{ backgroundColor: ColorType.fast, opacity: 0.6 }}><IconMinus color='#090909' /></View>
+                    <View onClick={(e) => {
+                        if (process.env.TARO_ENV == 'weapp') {
+                            e.stopPropagation()
+                        }
+                        tapPlus(true)
+                    }} className='plus' style={{ backgroundColor: ColorType.fast }}><IconPlus color='#090909' /></View>
                 </View>
             </View>
         }
@@ -449,8 +490,18 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
                 <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
                 <View onClick={() => tapDuration(false)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
                     <Text className='pop_duration_txt' style={{ color: ColorType.sleep }}>{TimeFormatter.durationFormate(detail.sleep.target_start_time, detail.sleep.target_end_time)}</Text>
-                    <View onClick={() => tapMinus(false)} className='minus' style={{ backgroundColor: ColorType.sleep, opacity: 0.6 }}><IconMinus color='#090909' /></View>
-                    <View onClick={() => tapPlus(false)} className='plus' style={{ backgroundColor: ColorType.sleep }}><IconPlus color='#090909' /></View>
+                    <View onClick={(e) => {
+                        if (process.env.TARO_ENV == 'weapp') {
+                            e.stopPropagation()
+                        }
+                        tapMinus(false)
+                    }} className='minus' style={{ backgroundColor: ColorType.sleep, opacity: 0.6 }}><IconMinus color='#090909' /></View>
+                    <View onClick={(e) => {
+                        if (process.env.TARO_ENV == 'weapp') {
+                            e.stopPropagation()
+                        }
+                        tapPlus(false)
+                    }} className='plus' style={{ backgroundColor: ColorType.sleep }}><IconPlus color='#090909' /></View>
                 </View>
             </View>
         }
@@ -886,7 +937,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
 
         return <View className='detail_container'>
             <Text className='detail_popup_title'>{getTitle()}<Text className='detail_popup_subttitle'> {getSubTitle()}</Text></Text>
-            <View style={{marginTop:rpxToPx(40)}}>
+            <View style={{ marginTop: rpxToPx(40) }}>
                 {
                     props.stageIndex == 0 && <View className='pop_ring_bg'>
                         <Rings common={common} bgRing={bgRing} canvasId={'pre_sleep_ring'} realRing={preRing} />

+ 0 - 1
src/features/trackTimeDuration/components/DayNightCard.tsx

@@ -479,7 +479,6 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
     }
 
     function getLocation() {
-        console.log((authInfo as any).address)
         var city = ''
         if ((authInfo as any).address){
             if ((authInfo as any).address.city.length > 0) {