Leon před 1 rokem
rodič
revize
a769536928

+ 1 - 0
src/app.tsx

@@ -28,6 +28,7 @@ const App: React.FC<PropsWithChildren> = ({ children }) => {
     // alert(Intl.DateTimeFormat().resolvedOptions().timeZone)
   }
   if (process.env.TARO_ENV == 'weapp') {
+    console.log(Taro.getSystemInfoSync())
     global.isDebug = Taro.getStorageSync('isDebug')
 
     const updateManager = Taro.getUpdateManager()

+ 2 - 2
src/components/basic/Icons.scss

@@ -18,13 +18,13 @@
     justify-content: center;
 }
 
-.minus {
+.minus2 {
     width: 24px;
     height: 4px;
     border-radius: 2px;
 }
 
-.plus {
+.plus2 {
     height: 24px;
     width: 4px;
     border-radius: 2px;

+ 3 - 3
src/components/basic/Icons.tsx

@@ -8,15 +8,15 @@ if (process.env.TARO_ENV == 'rn') {
 
 export const IconMinus = (props: { color: string, disable?: boolean }) => {
     return <View className='icon_bg'>
-        <View className='minus' style={{ backgroundColor: props.disable ? '#FFFFFF66' : props.color }}></View>
+        <View className='minus2' style={{ backgroundColor: props.disable ? '#FFFFFF66' : props.color }}></View>
     </View>
 }
 
 export const IconPlus = (props: { color: string, disable?: boolean }) => {
     return <View className='icon_bg'>
-        <View className='minus' style={{ backgroundColor: props.disable ? '#FFFFFF66' : props.color }}></View>
+        <View className='minus2' style={{ backgroundColor: props.disable ? '#FFFFFF66' : props.color }}></View>
         <View className='plus_bg'>
-            <View className='plus' style={{ backgroundColor: props.disable ? '#FFFFFF66' : props.color }} />
+            <View className='plus2' style={{ backgroundColor: props.disable ? '#FFFFFF66' : props.color }} />
         </View>
     </View>
 }

+ 1 - 1
src/context/themes/color.tsx

@@ -1,7 +1,7 @@
 export enum ColorType {
     fast = '#00ffff',//'#aaff00',
     sleep = '#8961F5',//'#00ffff'
-    box = '#121212',
+    box = '#1c1c1c',
     ring = '#76767625',//'#1c1c1c',
     food = '#FF7B00',
     activity = '#EEC01F',

+ 180 - 0
src/features/trackTimeDuration/components/CircadianDetailPopup.scss

@@ -0,0 +1,180 @@
+.detail_container {
+    padding-left: 46px;
+    padding-right: 46px;
+    padding-top: 40px;
+    padding-bottom: 80px;
+}
+
+.detail_popup_title {
+    color: #fff;
+    font-weight: bold;
+    font-size: 48px;
+    line-height: 48px;
+}
+
+.detail_popup_subttitle {
+    font-size: 24px;
+    line-height: 24px;
+    color: #fff;
+    opacity: 0.4;
+}
+
+.detail_tabbar {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    margin-top: 32px;
+    margin-bottom: 32px;
+}
+
+.detail_tabitem_nor {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    height: 56px;
+    border-radius: 28px;
+    padding-left: 22px;
+    padding-right: 22px;
+    box-sizing: border-box;
+    color: #ffffff66;
+    font-size: 32px;
+    font-weight: bold;
+    border-style: solid;
+    border-color: #d8d8d8;
+    border-width: 2px;
+    margin-right: 40px;
+}
+
+.detail_tabitem_sel {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    height: 56px;
+    border-radius: 28px;
+    padding-left: 22px;
+    padding-right: 22px;
+    box-sizing: border-box;
+    color: #1c1c1c;
+    font-size: 32px;
+    font-weight: bold;
+    background-color: #D8D8D8;
+    border-style: solid;
+    border-color: #d8d8d8;
+    border-width: 2px;
+    margin-right: 40px;
+}
+
+.detail_bottom {
+    display: flex;
+    margin-top: 28px;
+    align-items: center;
+    justify-content: center;
+}
+
+.detail_bottom_btn {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    width: 578px;
+    height: 84px;
+    border-radius: 42px;
+    color: #090909;
+    font-size: 32px;
+    font-weight: bold;
+    background: linear-gradient(90deg, #00FFFF 0%, #8961F5 100%);
+}
+
+.pop_ring_bg {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    border-top-style: solid;
+    border-top-width: 2px;
+    border-top-color: #ffffff25;
+    padding-top: 20px;
+    padding-bottom: 20px;
+}
+
+.pop_overview_bg {
+    flex-direction: column;
+    padding-top: 40px;
+    padding-bottom: 40px;
+    align-items: flex-start;
+}
+
+.pop_duration_bg {
+    margin-left: 50px;
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+}
+
+.pop_duration_title {
+    font-size: 32px;
+    line-height: 32px;
+    color: #fff;
+    opacity: 0.6;
+    font-weight: 400;
+}
+
+.pop_duration_value {
+    margin-top: 2px;
+    font-size: 36px;
+    line-height: 36px;
+    font-weight: 500;
+    margin-bottom: 12px;
+}
+
+.pop_duration_txt{
+    font-size: 48px;
+    line-height: 48px;
+    font-weight: bold;
+    flex: 1;
+    display: flex;
+    color: #fff;
+}
+
+.minus{
+    width: 72px;
+    height: 72px;
+    border-top-left-radius: 12px;
+    border-bottom-left-radius: 12px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.plus{
+    width: 72px;
+    height: 72px;
+    border-top-right-radius: 12px;
+    border-bottom-right-radius: 12px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.arrow2 {
+    width: 40px;
+    height: 40px;
+    opacity: 0.2;
+}
+
+.countdown_time_bg{
+    width: 200px;
+    display: flex;
+    flex-direction: column;
+}
+
+.countdown_time_bg .title{
+    font-size: 24px;
+    line-height: 32px;
+    color: #fff;
+    opacity: 0.6;
+}
+
+.countdown_time_bg .value{
+    font-size: 36px;
+    line-height: 48px;
+    font-weight: bold;
+}

+ 636 - 0
src/features/trackTimeDuration/components/CircadianDetailPopup.tsx

@@ -0,0 +1,636 @@
+import { View, Text, PageContainer, Image } from '@tarojs/components'
+import './CircadianDetailPopup.scss'
+import { useEffect, useRef, useState } from 'react'
+import TimelineFastSleep from './TimelineFastSleep'
+import { RealRing } from "@/features/trackTimeDuration/components/Rings";
+import Rings from "./Rings";
+import { getBgRing, getCommon } from '../hooks/RingData';
+import { ColorType } from '@/context/themes/color';
+import { useTranslation } from 'react-i18next';
+import { TimeFormatter } from '@/utils/time_format';
+import { rpxToPx } from '@/utils/tools';
+import { useSelector } from 'react-redux';
+import { durationDatas, durationIndex, getColor, getDurationTitle } from '../hooks/Console';
+import Modal from '@/components/layout/Modal.weapp';
+import { updateRecord } from '@/services/trackTimeDuration';
+import PickerViews from '@/components/input/PickerViews';
+import Taro from '@tarojs/taro';
+import { IconMinus, IconPlus } from '@/components/basic/Icons';
+
+export default function CircadianDetailPopup(props: { record: any, schedule?: any, onClose: Function }) {
+    const [tabIndex, setTabIndex] = useState(0)
+    const [diffTimeZone, setDiffTimeZone] = useState(false)
+    const [multiTimeZone, setMultiTimeZone] = useState(false)
+    const [detail, setDetail] = useState(JSON.parse(JSON.stringify(props.record)))
+    const [showDurationPicker, setShowDurationPicker] = useState(false)
+    const [fastPickerValue, setFastPickerValue] = useState([0, 0])
+    const [sleepPickerValue, setSleepPickerValue] = useState([0, 0])
+    const [showEditPicker, setShowEditPicker] = useState(false)
+    const [isFast, setIsFast] = useState(true)
+    const durationPickerRef = useRef(null)
+    const common = useSelector((state: any) => state.common);
+    const { t } = useTranslation()
+
+    useEffect(() => {
+        checkTimezone()
+        // var current_record = props.record
+        if (detail.fast)
+            setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
+        if (detail.sleep)
+            setSleepPickerValue(durationIndex(detail.sleep.target_start_time, detail.sleep.target_end_time, common))
+
+    }, [detail])
+
+    useEffect(() => {
+        setDetail(JSON.parse(JSON.stringify(props.record)))
+    }, [props.record])
+
+
+
+    function checkTimezone() {
+        var split = new Date().toString().split(' ');
+        var currentTZ = split[split.length - 2];
+        var isDiff = false;
+        var isMulti = false;
+        var tempTZ = '';
+        if (props.record.fast) {
+            if (props.record.fast.real_start_time_zone) {
+                tempTZ = props.record.fast.real_start_time_zone
+                if (props.record.fast.real_start_time_zone != currentTZ) {
+                    isDiff = true
+                }
+            }
+
+            if (props.record.fast.real_end_time_zone) {
+                if (tempTZ != props.record.fast.real_end_time_zone) {
+                    isMulti = true
+                }
+                if (props.record.fast.real_end_time_zone != currentTZ) {
+                    isDiff = true
+                }
+            }
+
+        }
+
+        if (props.record.sleep) {
+            if (props.record.sleep.real_start_time_zone) {
+                if (tempTZ == '') {
+                    tempTZ = props.record.sleep.real_start_time_zone
+                }
+                else if (tempTZ != props.record.sleep.real_start_time_zone) {
+                    isMulti = true
+                }
+                if (props.record.sleep.real_start_time_zone != currentTZ) {
+                    isDiff = true
+                }
+            }
+
+            if (props.record.sleep.real_end_time_zone) {
+                if (tempTZ != props.record.sleep.real_end_time_zone) {
+                    isMulti = true
+                }
+                if (props.record.sleep.real_end_time_zone != currentTZ) {
+                    isDiff = true
+                }
+            }
+
+
+        }
+        setDiffTimeZone(isDiff)
+        setMultiTimeZone(isMulti)
+    }
+
+    function getTitle() {
+        if (props.record.status == 'COMPLETED') {
+            return 'Thursday'
+        }
+        return 'Schedule'
+    }
+
+    function getBottomText() {
+        if (props.record.status == 'WAIT_FOR_START') {
+            return 'I\'m ready'
+        }
+        if (props.record.status == 'COMPLETED') {
+            return 'Got it'
+        }
+        return 'Okay'
+    }
+    const startArc = (time: number) => {
+        var date = new Date(time);
+        var hour = date.getHours();
+        var minute = date.getMinutes();
+        var second = date.getSeconds();
+        return (hour * 3600 + minute * 60 + second) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
+    }
+
+    function durationArc(start_time: number, end_time: number) {
+        var duration = (end_time - start_time) / 1000;
+        return duration / (24 * 3600) * 2 * Math.PI;
+    }
+
+    function getStageDuration(index) {
+        var start, end;
+        switch (index) {
+            case 0:
+                start = props.record.fast.real_start_time
+                end = props.record.sleep.real_start_time
+                break
+            case 1:
+                start = props.record.sleep.real_start_time
+                end = props.record.sleep.real_end_time
+                break
+            case 2:
+                start = props.record.sleep.real_end_time
+                end = props.record.fast.real_end_time
+                break
+            case 3:
+                start = props.record.fast.real_start_time
+                end = props.record.fast.real_end_time
+                break
+            case 4:
+                if (props.record.sleep.status == 'NOT_STARTED') {
+                    return t('feature.track_time_duration.stage.not_started')
+                }
+                else if (props.record.sleep.status == 'NOT_COMPLETED') {
+                    return t('feature.track_time_duration.stage.not_completed')
+                }
+                start = props.record.sleep.real_start_time
+                end = props.record.sleep.real_end_time
+                break;
+        }
+        return TimeFormatter.durationFormate(start, end)
+    }
+
+    function completedOverView() {
+        var bgRing = getBgRing()
+        var common = getCommon(null, false)
+        common.radius = 42;
+        common.lineWidth = 9;
+
+        var fastRing: RealRing = null
+        if (props.record.fast) {
+            fastRing = {
+                color: global.fastColor ? global.fastColor : ColorType.fast,
+                startArc: startArc(props.record.fast.real_start_time),
+                durationArc: durationArc(props.record.fast.real_start_time, props.record.fast.real_end_time)
+            }
+        }
+
+        var sleepRing: RealRing = null
+        if (props.record.sleep && props.record.sleep.status == 'COMPLETED') {
+            sleepRing = {
+                color: global.sleepColor ? global.sleepColor : ColorType.sleep,
+                startArc: startArc(props.record.sleep.real_start_time),
+                durationArc: durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
+            }
+        }
+
+        return <View>
+            {
+                props.record.fast && <View className='pop_ring_bg'>
+                    <Rings common={common} bgRing={bgRing} canvasId={'pop_fast_ring'} realRing={fastRing} />
+                    <View className="pop_duration_bg">
+                        <Text className="pop_duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
+                        <Text className="pop_duration_value" style={{ color: ColorType.fast }}>{getStageDuration(3)}</Text>
+                    </View>
+                </View>
+            }
+            {
+                props.record.sleep && <View className='pop_ring_bg'>
+                    <Rings common={common} bgRing={bgRing} canvasId={'pop_sleep_ring'} realRing={sleepRing} />
+                    <View className="pop_duration_bg">
+                        <Text className="pop_duration_title">{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
+                        <Text className="pop_duration_value" style={{ color: ColorType.sleep }}>{getStageDuration(4)}</Text>
+                    </View>
+                </View>
+            }
+
+        </View>
+    }
+
+    function tapDuration(isFast: boolean) {
+        if (isFast) {
+            setIsFast(true)
+            if (props.record.status == 'WAIT_FOR_START') {
+                setShowDurationPicker(true)
+            }
+            else {
+                setShowEditPicker(true)
+            }
+        }
+        else {
+            setIsFast(false)
+            if (props.record.status == 'WAIT_FOR_START') {
+                Taro.showToast({
+                    title: t('feature.track_time_duration.common.start_fasting_first'),
+                    icon: 'none'
+                })
+                return;
+            }
+            if (props.record.status == 'WAIT_FOR_START' || props.record.status == 'ONGOING1') {
+                setShowDurationPicker(true)
+            }
+            else {
+                setShowEditPicker(true)
+            }
+        }
+    }
+
+    function tapMinus(isFast: boolean) {
+        if (isFast) {
+            var fastDuration = detail.fast.target_end_time - detail.fast.target_start_time
+            if (fastDuration == 3600000) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: 'feature.common.toast.min_value'
+                })
+                return
+            }
+            var count = fastDuration - common.duration.step * 60 * 1000
+            count = count < 3600000 ? 3600000 : count
+
+            detail.fast.target_end_time = detail.fast.target_start_time + count;
+
+            setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
+
+        }
+        else {
+            if (props.record.status == 'WAIT_FOR_START') {
+                Taro.showToast({
+                    title: t('feature.track_time_duration.common.start_fasting_first'),
+                    icon: 'none'
+                })
+                return;
+            }
+
+            var sleepDuration = detail.sleep.target_end_time - detail.sleep.target_start_time
+            if (sleepDuration == 3600000) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: 'feature.common.toast.min_value'
+                })
+                return
+            }
+            var count = sleepDuration - common.duration.step * 60 * 1000
+            count = count < 3600000 ? 3600000 : count
+
+            detail.sleep.target_end_time = detail.sleep.target_start_time + count;
+            setSleepPickerValue(durationIndex(detail.sleep.target_start_time, detail.sleep.target_end_time, common))
+        }
+        setDetail(JSON.parse(JSON.stringify(detail)))
+    }
+
+    function tapPlus(isFast: boolean) {
+        if (isFast) {
+            var fastDuration = detail.fast.target_end_time - detail.fast.target_start_time
+            if (fastDuration == 23 * 3600000) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: 'feature.common.toast.max_value'
+                })
+                return
+            }
+            var count = fastDuration + common.duration.step * 60 * 1000
+            count = count > 23 * 3600000 ? 23 * 3600000 : count
+
+            detail.fast.target_end_time = detail.fast.target_start_time + count;
+
+            setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
+        }
+        else {
+            if (props.record.status == 'WAIT_FOR_START') {
+                Taro.showToast({
+                    title: t('feature.track_time_duration.common.start_fasting_first'),
+                    icon: 'none'
+                })
+                return;
+            }
+            var sleepDuration = detail.sleep.target_end_time - detail.sleep.target_start_time
+            if (sleepDuration == 23 * 3600000) {
+                Taro.showToast({
+                    icon: 'none',
+                    title: 'feature.common.toast.max_value'
+                })
+                return
+            }
+            var count = sleepDuration + common.duration.step * 60 * 1000
+
+            count = count > 23 * 3600000 ? 23 * 3600000 : count
+
+            detail.sleep.target_end_time = detail.sleep.target_start_time + count;
+            setSleepPickerValue(durationIndex(detail.sleep.target_start_time, detail.sleep.target_end_time, common))
+        }
+        setDetail(JSON.parse(JSON.stringify(detail)))
+    }
+
+    function sleepRealDuration() {
+        return getStageDuration(4)
+    }
+
+    function fastOverview() {
+        if (props.record.fast.status == 'WAIT_FOR_START') {
+            return <View className='pop_ring_bg pop_overview_bg'>
+                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
+                <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
+                    <Text onClick={() => tapDuration(true)} 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>
+            </View>
+        }
+        else if (props.record.status != 'COMPLETED') {
+            return <View className='pop_ring_bg pop_overview_bg'>
+                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
+                <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
+                    <Text onClick={() => tapDuration(true)} className='pop_duration_txt'>{TimeFormatter.durationFormate(detail.fast.target_start_time, detail.fast.target_end_time)}</Text>
+                    <Image onClick={() => tapDuration(true)} className="arrow2" src={require('@/assets/images/arrow3.png')} />
+                </View>
+                <View style={{ marginTop: rpxToPx(20), display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+                    <View className='countdown_time_bg'>
+                        <Text className='title'>{t('feature.track_time_duration.console.countup')}</Text>
+                        <Text className='value' style={{ color: ColorType.fast }}>{TimeFormatter.formateTimeNow(props.record.fast.real_start_time)}</Text>
+                    </View>
+                    <View className='countdown_time_bg'>
+                        {
+                            props.record.fast.target_end_time < new Date().getTime() ? <Text className='title'>{t('feature.track_time_duration.console.timeout')}</Text> :
+                                <Text className='title'>{t('feature.track_time_duration.console.countdown_not_due')}</Text>
+                        }
+
+                        {
+                            props.record.fast.target_end_time < new Date().getTime() ?
+                                <Text className='value' style={{ color: ColorType.alert }}>{TimeFormatter.countdown(props.record.fast.target_end_time)}</Text> :
+                                <Text className='value' style={{ color: ColorType.fast, opacity: 0.6 }}>{TimeFormatter.countdown(props.record.fast.target_end_time)}</Text>
+                        }
+
+                    </View>
+                </View>
+            </View>
+        }
+    }
+
+    function sleepOverview() {
+        if (props.record.sleep.status == 'WAIT_FOR_START') {
+            return <View className='pop_ring_bg pop_overview_bg'>
+                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
+                <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
+                    <Text onClick={() => tapDuration(false)} 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>
+            </View>
+        }
+        else if (props.record.sleep.status == 'WAIT_FOR_END') {
+            return <View className='pop_ring_bg pop_overview_bg'>
+                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
+                <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
+                    <Text onClick={() => tapDuration(false)} className='pop_duration_txt'>{TimeFormatter.durationFormate(detail.sleep.target_start_time, detail.sleep.target_end_time)}</Text>
+                    <Image onClick={() => tapDuration(false)} className="arrow2" src={require('@/assets/images/arrow3.png')} />
+                </View>
+                <View style={{ marginTop: rpxToPx(20), display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+                    <View className='countdown_time_bg'>
+                        <Text className='title'>{t('feature.track_time_duration.console.countup')}</Text>
+                        <Text className='value' style={{ color: ColorType.sleep }}>{TimeFormatter.formateTimeNow(props.record.sleep.real_start_time)}</Text>
+                    </View>
+                    <View className='countdown_time_bg'>
+                        {
+                            props.record.sleep.target_end_time < new Date().getTime() ? <Text className='title'>{t('feature.track_time_duration.console.timeout')}</Text> :
+                                <Text className='title'>{t('feature.track_time_duration.console.countdown_not_due')}</Text>
+                        }
+                        {
+                            props.record.sleep.target_end_time < new Date().getTime() ?
+                                <Text className='value' style={{ color: ColorType.alert }}>{TimeFormatter.countdown(props.record.sleep.target_end_time)}</Text> :
+                                <Text className='value' style={{ color: ColorType.sleep, opacity: 0.6 }}>{TimeFormatter.countdown(props.record.sleep.target_end_time)}</Text>
+                        }
+
+                    </View>
+                </View>
+            </View>
+        }
+        else {
+            return <View className='pop_ring_bg pop_overview_bg'>
+                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
+                <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
+                    <Text className='pop_duration_txt' style={{ color: ColorType.sleep }}>{sleepRealDuration()}</Text>
+                </View>
+            </View>
+        }
+    }
+
+    function overview() {
+        if (props.record.status == 'COMPLETED') {
+            return completedOverView()
+        }
+        return <View>
+            {
+                props.record.fast && fastOverview()
+            }
+            {
+                props.record.sleep && sleepOverview()
+            }
+        </View>
+    }
+
+    function stage() {
+        var bgRing = getBgRing()
+        var common = getCommon(null, false)
+        common.radius = 42;
+        common.lineWidth = 9;
+
+        const preRing: RealRing = {
+            color: global.fastColor ? global.fastColor : ColorType.fast,
+            startArc: startArc(props.record.fast.real_start_time),
+            durationArc: durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
+        }
+        const sleepRing: RealRing = {
+            color: global.sleepColor ? global.sleepColor : ColorType.sleep,
+            startArc: startArc(props.record.sleep.real_start_time),
+            durationArc: durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
+        }
+        const wakeRing: RealRing = {
+            color: global.fastColor ? global.fastColor : ColorType.fast,
+            startArc: startArc(props.record.sleep.real_end_time),
+            durationArc: durationArc(props.record.sleep.real_end_time, props.record.fast.real_end_time)
+        }
+        return <View>
+            <View className='pop_ring_bg'>
+                <Rings common={common} bgRing={bgRing} canvasId={'pre_sleep_ring'} realRing={preRing} />
+                <View className="pop_duration_bg">
+                    <Text className="pop_duration_title">{t('feature.track_time_duration.stage.a')}</Text>
+                    <Text className="pop_duration_value" style={{ color: ColorType.fast }}>{getStageDuration(0)}</Text>
+                </View>
+            </View>
+            <View className='pop_ring_bg'>
+                <Rings common={common} bgRing={bgRing} canvasId={'sleeping_ring'} realRing={sleepRing} />
+                <View className="pop_duration_bg">
+                    <Text className="pop_duration_title">{t('feature.track_time_duration.stage.b')}</Text>
+                    <Text className="pop_duration_value" style={{ color: ColorType.sleep }}>{getStageDuration(1)}</Text>
+                </View>
+            </View>
+            <View className='pop_ring_bg'>
+                <Rings common={common} bgRing={bgRing} canvasId={'later_sleep_ring'} realRing={wakeRing} />
+                <View className="pop_duration_bg">
+                    <Text className="pop_duration_title">{t('feature.track_time_duration.stage.c')}</Text>
+                    <Text className="pop_duration_value" style={{ color: ColorType.fast }}>{getStageDuration(2)}</Text>
+                </View>
+            </View>
+        </View>
+    }
+
+    function events() {
+        return <TimelineFastSleep
+            data={props.record}
+            first_real_check_time={props.record.first_real_check_time ? props.record.first_real_check_time : 0}
+            diffTimeZone={diffTimeZone} multiTimeZone={multiTimeZone} />
+    }
+
+    function durationPickerContent() {
+        var color = getColor(props.record)
+        var title = getDurationTitle(props.record, t)
+        return <View style={{ color: '#fff', backgroundColor: 'transparent' }}>
+
+
+            <PickerViews ref={durationPickerRef}
+                onChange={durationChange}
+                items={durationDatas(common)}
+                value={isFast ? fastPickerValue : sleepPickerValue}
+                themeColor={color}
+                title={title}
+                showBtns={true}
+                onCancel={() => {
+                    setShowDurationPicker(false)
+                }} />
+        </View>
+    }
+
+    function editPickerContent() {
+        return <View style={{ color: '#fff', backgroundColor: 'transparent' }}>
+            <PickerViews ref={durationPickerRef}
+                onChange={durationChange}
+                items={durationDatas(common)}
+                value={isFast ? fastPickerValue : sleepPickerValue}
+                themeColor={isFast ? ColorType.fast : ColorType.sleep}
+                title={isFast ? t('feature.track_time_duration.action_sheet.edit_fasting_goal') :
+                    t('feature.track_time_duration.action_sheet.edit_sleeping_goal')}
+                showBtns={true}
+                onCancel={() => {
+                    setShowEditPicker(false)
+                }} />
+        </View>
+    }
+
+    function durationChange(e) {
+        // debugger
+        var count = (e[0] + common.duration.min) * 60 + e[1] * common.duration.step
+        // var count = (e[0] + 1) * 60 + e[1] * 5
+        if (showDurationPicker) {
+            // global.changeTargetDuration(count, isFast)
+            if (isFast) {
+                detail.fast.target_end_time = detail.fast.target_start_time + count * 60 * 1000
+            }
+            else {
+                detail.sleep.target_end_time = detail.sleep.target_start_time + count * 60 * 1000
+            }
+            setDetail(JSON.parse(JSON.stringify(detail)))
+        }
+        else {
+            var params: any = {}
+            if (isFast) {
+                params = {
+                    fast: {
+                        target_duration: count * 60 * 1000
+                    }
+                }
+            }
+            else {
+                params = {
+                    sleep: {
+                        target_duration: count * 60 * 1000
+                    }
+                }
+            }
+            updateRecord({
+                ...params
+            }, props.record.id).then(res => {
+                global.indexPageRefresh()
+            }).catch(e => {
+
+            })
+        }
+        setShowDurationPicker(false)
+        setShowEditPicker(false)
+    }
+
+    function modalContent() {
+        if (showDurationPicker || showEditPicker) {
+            if (process.env.TARO_ENV == 'weapp') {
+                return <Modal
+                    testInfo={null}
+                    dismiss={() => {
+                        setShowDurationPicker(false)
+                        setShowEditPicker(false)
+                    }}
+                    confirm={() => { }}>
+                    {
+                        showDurationPicker ? durationPickerContent() : editPickerContent()
+                    }
+                </Modal>
+            }
+            else if (process.env.TARO_ENV == 'rn') {
+                return <PageContainer style={{ backgroundColor: '#1c1c1c' }}
+                    // overlayStyle='background-color:rgba(0,0,0,0.9)'
+                    // custom-style='background-color:#1c1c1c'
+                    overlayStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
+                    customStyle={{ backgroundColor: '#1c1c1c' }}
+                    closeOnSlideDown={false}
+                    onBeforeEnter={() => {
+
+                    }}
+                    onBeforeLeave={() => {
+                    }}
+                    onClick={() => { alert('b') }}
+                    onClickOverlay={() => { alert('a') }}
+                    onAfterLeave={() => { setShowDurationPicker(false); setShowEditPicker(false) }}
+                    show={showDurationPicker} round={true} overlay={true} position='bottom'
+                >
+                    {
+                        showDurationPicker ? durationPickerContent() : editPickerContent()
+                    }
+                </PageContainer>
+            }
+        }
+        return <View />
+    }
+
+
+    return <View className='detail_container'>
+        <Text className='detail_popup_title'>{getTitle()}<Text className='detail_popup_subttitle'> dddd</Text></Text>
+        <View className='detail_tabbar'>
+            <View onClick={() => { setTabIndex(0) }} className={tabIndex == 0 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>Overview</View>
+            {
+                props.record.status == 'COMPLETED' &&
+                (props.record.sleep && props.record.sleep.status == 'COMPLETED') &&
+                props.record.scenario == 'FAST_SLEEP' &&
+                <View onClick={() => { setTabIndex(1) }} className={tabIndex == 1 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>Stage</View>
+            }
+            <View onClick={() => { setTabIndex(2) }} className={tabIndex == 2 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>Events</View>
+        </View>
+        <View className='detail_content'>
+            {
+                tabIndex == 0 ? overview() : tabIndex == 1 ? stage() : events()
+            }
+        </View>
+        <View className='detail_bottom'>
+            <View className='detail_bottom_btn' onClick={(e) => {
+                if (process.env.TARO_ENV == 'weapp') {
+                    e.stopPropagation()
+                }
+                global.updateFastSleepData(detail)
+                props.onClose();
+            }}>{getBottomText()}</View>
+        </View>
+        {
+            modalContent()
+        }
+    </View>
+}

+ 57 - 4
src/features/trackTimeDuration/components/ClockHeader.tsx

@@ -24,6 +24,7 @@ if (process.env.TARO_ENV == 'rn') {
 
 export default function ClockHeader(props: { homeData: any }) {
     const user = useSelector((state: any) => state.user);
+    const time = useSelector((state: any) => state.time);
     const [fastPickerValue, setFastPickerValue] = useState([0, 0])
     const [sleepPickerValue, setSleepPickerValue] = useState([0, 0])
     const [fastDuration, setFastDuration] = useState<number>(0);
@@ -34,6 +35,7 @@ export default function ClockHeader(props: { homeData: any }) {
     const [isFast, setIsFast] = useState(true)
     const common = useSelector((state: any) => state.common);
     const durationPickerRef = useRef(null)
+    const isFastFirst = true;
 
 
     const dispatch = useDispatch();
@@ -62,8 +64,52 @@ export default function ClockHeader(props: { homeData: any }) {
         setSleepPickerValue(durationIndex(current_record.sleep.target_start_time, current_record.sleep.target_end_time, common))
     }
 
-
     function tapAddBtn() {
+        Taro.showActionSheet({
+            itemList: [
+                t('feature.track_time_duration.action_sheet.switch_scenario'),
+                t('feature.track_time_duration.action_sheet.change_schedule')
+            ]
+        }).then(res => {
+            switch (res.tapIndex) {
+                case 1:
+                    if (time.status != 'WAIT_FOR_START') {
+                        Taro.showToast({
+                            title: t('feature.common.toast.ongoing'),
+                            icon: 'none'
+                        })
+                        return;
+                    }
+                    if (time.scenario == 'FAST_SLEEP') {
+                        dispatch(setStep(isFastFirst ? 'fast' : 'sleep'))
+                    }
+                    else if (time.scenario == 'SLEEP') {
+                        dispatch(setStep('sleep'))
+                    }
+                    else {
+                        dispatch(setStep('fast'))
+                    }
+                    jumpPage('/pages/clock/SetSchedule', 'SetSchedule', navigation)
+                    break;
+                case 0:
+                    if (time.status != 'WAIT_FOR_START') {
+                        Taro.showToast({
+                            title: t('feature.common.toast.ongoing'),
+                            icon: 'none'
+                        })
+                        return;
+                    }
+                    jumpPage('/pages/clock/ChooseScenario', 'ChooseScenario', navigation)
+                    break;
+            }
+        })
+            .catch(err => {
+                console.log(err.errMsg)
+            })
+    }
+
+
+    function tapAddBtn2() {
         var data = props.homeData.fast_sleep
         var status = data.current_record.status
         var itemList: any = []
@@ -256,11 +302,18 @@ export default function ClockHeader(props: { homeData: any }) {
         return <View />
     }
 
+    /*function headerView() {
+        return <TitleView title={t('page.metric.title')} showAddBtn={loaded && !showErrorPage ? true : false} onClick={addBtnClick}>
+        </TitleView>
+    }*/
+
+
+    return <View>
+        <TitleView title={t('page.clock.title')} onClick={tapAddBtn} showAddBtn={user.isLogin ? true : false}>
 
-    return <TitleView title={t('page.clock.title')} onClick={tapAddBtn} showAddBtn={user.isLogin ? true : false}>
-        {/* <StatusIndicator /> */}
+        </TitleView>
         {
             modalContent()
         }
-    </TitleView>
+    </View>
 }

+ 2 - 2
src/features/trackTimeDuration/components/Discovery.scss

@@ -1,6 +1,6 @@
 .food_btn1{
-    margin-left: 46px;
-    margin-right: 46px;
+    // margin-left: 46px;
+    // margin-right: 46px;
     height: 84px;
     border-radius: 42px;
     display: flex;

+ 64 - 41
src/features/trackTimeDuration/components/Discovery.tsx

@@ -12,6 +12,7 @@ import './Discovery.scss'
 import { useTranslation } from "react-i18next";
 import { TimeFormatter } from "@/utils/time_format";
 import { getPerm, uploadPerm } from "@/services/user";
+import Box from "@/components/layout/Box";
 
 
 let useNavigation;
@@ -278,39 +279,44 @@ export default function Discovery() {
         </View>
     }
     return <View style={{ display: 'flex', flexDirection: 'column' }}>
-        <View style={{ display: 'flex', flexDirection: 'row', marginLeft: 50, marginBottom: 50, alignItems: 'center' }}>
-            {
-                schedule && rings()
-            }
-            {schedule && <View className="duration_bg">
-                {
-                    showRing && <Text className="duration_title">{t('feature.common.day')}</Text>
-                }
-                {
-                    showRing &&
-                    <Text className="duration_value" style={{ color: ColorType.day }}>{dayDuration()}</Text>
-                }
-                {
-                    <Text className="duration_title">{t('feature.common.eat')}</Text>
-                }
-                {
-                    <Text className="duration_value" style={{ color: ColorType.food }}>{eatDuration()}</Text>
-                }
-                {
-                    <Text className="duration_title">{t('feature.common.move')}</Text>
-                }
-                {
-                    <Text className="duration_value" style={{ color: ColorType.activity }}>{activityDuration()}</Text>
-                }
+        <Box>
+            <View>
+                <View style={{ display: 'flex', flexDirection: 'row',  marginBottom: rpxToPx(60), alignItems: 'center' }}>
+                    {
+                        schedule && rings()
+                    }
+                    {schedule && <View className="duration_bg">
+                        {
+                            showRing && <Text className="duration_title">{t('feature.common.day')}</Text>
+                        }
+                        {
+                            showRing &&
+                            <Text className="duration_value" style={{ color: ColorType.day }}>{dayDuration()}</Text>
+                        }
+                        {
+                            <Text className="duration_title">{t('feature.common.eat')}</Text>
+                        }
+                        {
+                            <Text className="duration_value" style={{ color: ColorType.food }}>{eatDuration()}</Text>
+                        }
+                        {
+                            <Text className="duration_title">{t('feature.common.move')}</Text>
+                        }
+                        {
+                            <Text className="duration_value" style={{ color: ColorType.activity }}>{activityDuration()}</Text>
+                        }
+                    </View>
+                    }
+                </View>
+                <View className="food_btn1" style={{ backgroundColor: ColorType.food }} onClick={goFood}>
+                    <Text style={{ fontWeight: 'bold' }}>食物日记</Text>
+                </View>
+                <View className="food_btn1" style={{ backgroundColor: ColorType.activity,marginBottom:0 }} onClick={goAcitivity}>
+                    <Text style={{ fontWeight: 'bold' }}>运动训练</Text>
+                </View>
             </View>
-            }
-        </View>
-        <View className="food_btn1" style={{ backgroundColor: ColorType.food }} onClick={goFood}>
-            <Text style={{ fontWeight: 'bold' }}>食物日记</Text>
-        </View>
-        <View className="food_btn1" style={{ backgroundColor: ColorType.activity }} onClick={goAcitivity}>
-            <Text style={{ fontWeight: 'bold' }}>运动训练</Text>
-        </View>
+        </Box>
+
 
         <View className="cell_bg" style={{ marginTop: 20 }}>
             <View className="cell_full">
@@ -327,20 +333,37 @@ export default function Discovery() {
                     }}
                 />
             </View>
-            <View className="cell_line" style={{ height: 1 }} />
-            <View className="cell_full">
-                <Text className="cell_title">{t('feature.track_time_duration.third_ring.sunrise_today')}</Text>
-                <Text className="cell_value" style={{ color: '#fff' }}>{
-                    dayNight.isMember && dayNight.gpsInfo ? dayNight.gpsInfo.daylights[0].sunrise : '06:00'
-                }</Text>
-            </View>
-            <View className="cell_line" style={{ height: 1 }} />
+            {
+                showRing && <View className="cell_line" style={{ height: 1 }} />
+            }
+            {
+                showRing && <View className="cell_full">
+                    <Text className="cell_title">{t('feature.track_time_duration.third_ring.sunrise_today')}</Text>
+                    <Text className="cell_value" style={{ color: '#fff' }}>{
+                        dayNight.isMember && dayNight.gpsInfo ? dayNight.gpsInfo.daylights[0].sunrise : '06:00'
+                    }</Text>
+                </View>
+            }
+            {
+                showRing && <View className="cell_line" style={{ height: 1 }} />
+            }
+            {
+                showRing && <View className="cell_full">
+                    <Text className="cell_title">{t('feature.track_time_duration.third_ring.sunset_today')}</Text>
+                    <Text className="cell_value" style={{ color: '#fff' }}>{
+                        dayNight.isMember && dayNight.gpsInfo ? dayNight.gpsInfo.daylights[0].sunset : '18:00'
+                    }</Text>
+                </View>
+            }
+
+
+            {/* <View className="cell_line" style={{ height: 1 }} />
             <View className="cell_full">
                 <Text className="cell_title">{t('feature.track_time_duration.third_ring.sunset_today')}</Text>
                 <Text className="cell_value" style={{ color: '#fff' }}>{
                     dayNight.isMember && dayNight.gpsInfo ? dayNight.gpsInfo.daylights[0].sunset : '18:00'
                 }</Text>
-            </View>
+            </View> */}
         </View>
 
     </View>

+ 5 - 5
src/features/trackTimeDuration/components/IndexConsole.scss

@@ -5,8 +5,8 @@
     border-radius: 42px;
     position: relative;
     background-color: $fastColor;
-    margin-left: 46px;
-    margin-right: 46px;
+    // margin-left: 46px;
+    // margin-right: 46px;
     // margin-bottom: 36px;
     align-items: center;
     justify-content: center;
@@ -19,7 +19,7 @@
     width: 1px;
     background-color: #fff;
     opacity: 0.4;
-    margin-left: 114px;
+    margin-left: 68px;
     flex-shrink: 0;
 }
 
@@ -27,8 +27,8 @@
     height: 84px;
     border-radius: 42px;
     position: relative;
-    margin-left: 46px;
-    margin-right: 46px;
+    // margin-left: 46px;
+    // margin-right: 46px;
     // margin-bottom: 36px;
     align-items: center;
     justify-content: center;

+ 3 - 3
src/features/trackTimeDuration/components/IndexConsole.tsx

@@ -7,7 +7,7 @@ import { jumpPage } from '../hooks/Common';
 import { useEffect, useRef, useState } from 'react';
 import LimitPickers from '@/components/input/LimitPickers';
 import { getColor, getTimePickerTitle } from '../hooks/Console';
-import { vibrate } from '@/utils/tools';
+import { rpxToPx, vibrate } from '@/utils/tools';
 import { TimeFormatter } from '@/utils/time_format';
 
 let useNavigation;
@@ -22,7 +22,7 @@ export default function IndexConsole(props: { record: any }) {
     const { t } = useTranslation()
     const [fastDuration, setFastDuration] = useState<number>(0);
     const [sleepDuration, setSleepDuration] = useState<number>(0);
-    const [expand, setExpand] = useState(true);
+    const [expand, setExpand] = useState(false);
 
     // const [fastPickerValue, setFastPickerValue] = useState([0, 0])
     // const [sleepPickerValue, setSleepPickerValue] = useState([0, 0])
@@ -184,7 +184,7 @@ export default function IndexConsole(props: { record: any }) {
         }
     }
 
-    return <View>
+    return <View style={{marginTop:rpxToPx(40)}}>
         {
             status == 'WAIT_FOR_START' ?
                 <View onClick={tapStartFast} className='console_btn'>

+ 6 - 6
src/features/trackTimeDuration/components/IndexItem.scss

@@ -1,16 +1,16 @@
 @import '@/utils/common.scss';
-.time_operate_item{
-    padding-top: 40px;
+.time_operate_item1{
+    // padding-top: 40px;
     padding-bottom: 40px;
-    margin-left: 46px;
-    margin-right: 46px;
+    // margin-left: 46px;
+    // margin-right: 46px;
     display: flex;
     flex-direction: row;
     align-items: center;
     background-color: $boxColor;
     border-radius: $boxBorderRadius;
-    padding-left: 40px;
-    padding-right: 40px;
+    // padding-left: 40px;
+    // padding-right: 40px;
     // margin-bottom: 16px;
 }
 

+ 66 - 8
src/features/trackTimeDuration/components/IndexItem.tsx

@@ -1,4 +1,4 @@
-import { View, Text, Image } from "@tarojs/components";
+import { View, Text, Image, PageContainer } from "@tarojs/components";
 import { dotIsOuterRange, getBgRing, getCommon, getDot, getReal, getSchedule, getTarget, timeTotimestamp } from "../hooks/RingData";
 import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
 import Rings from "./Rings";
@@ -13,6 +13,7 @@ import Taro from "@tarojs/taro";
 import Modal from "@/components/layout/Modal.weapp";
 import { ModalType } from "@/utils/types";
 import TimelineStage from "./TimelineStage";
+import CircadianDetailPopup from "@/features/trackTimeDuration/components/CircadianDetailPopup";
 
 let useNavigation;
 if (process.env.TARO_ENV == 'rn') {
@@ -26,6 +27,7 @@ export default function Component(props: { type: string, data: any, time: any, s
     const dayNight = useSelector((state: any) => state.dayNight);
     const [stageList, setStageList] = useState([true, false, false])
     const [isStageMode, setIsStageMode] = useState(false)
+    const [showDetailModal, setShowDetailModal] = useState(false)
     let navigation;
     if (useNavigation) {
         navigation = useNavigation()
@@ -156,7 +158,8 @@ export default function Component(props: { type: string, data: any, time: any, s
             }
             else if (record.sleep.status == 'COMPLETED') {
                 realRing = getReal(record, false, true)
-                return <Rings common={common} bgRing={bgRing} canvasId={props.type + props.time + 'small'} realRing={realRing} />
+                var currentDot = getDot(record, false)
+                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={props.type + props.time + 'small'} realRing={realRing} />
             }
             else if (record.sleep.status == 'ONGOING2') {
                 var currentDot = getDot(record, false)
@@ -335,7 +338,59 @@ export default function Component(props: { type: string, data: any, time: any, s
         global.showSleepPicker()
     }
 
-    return <View className="time_operate_item">
+
+    function goDetail() {
+        if (!user.isLogin) {
+            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            return
+        }
+        setShowDetailModal(true)
+    }
+
+    function modalContent() {
+        if (process.env.TARO_ENV == 'weapp') {
+            return <Modal
+                testInfo={null}
+                dismiss={() => {
+                    setShowDetailModal(false)
+                }}
+                confirm={() => { }}>
+                {
+                    <CircadianDetailPopup
+                        record={record}
+                        schedule={props.data.scenario.schedule}
+                        onClose={() => { setShowDetailModal(false); }} />
+                }
+            </Modal>
+        }
+        else if (process.env.TARO_ENV == 'rn') {
+            return <PageContainer style={{ backgroundColor: '#1c1c1c' }}
+                // overlayStyle='background-color:rgba(0,0,0,0.9)'
+                // custom-style='background-color:#1c1c1c'
+                overlayStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
+                customStyle={{ backgroundColor: '#1c1c1c' }}
+                closeOnSlideDown={false}
+                onBeforeEnter={() => {
+
+                }}
+                onBeforeLeave={() => {
+                }}
+                onClick={() => { alert('b') }}
+                onClickOverlay={() => { alert('a') }}
+                onAfterLeave={() => { setShowDetailModal(false) }}
+                show={showDetailModal} round={true} overlay={true} position='bottom'
+            >
+                {
+                    <CircadianDetailPopup
+                        record={record}
+                        schedule={props.data.scenario.schedule}
+                        onClose={() => { setShowDetailModal(false) }} />
+                }
+            </PageContainer>
+        }
+    }
+
+    return <View className="time_operate_item1" onClick={goDetail}>
         <View className="fast_sleep_item">
             {
                 rings()
@@ -350,25 +405,28 @@ export default function Component(props: { type: string, data: any, time: any, s
                     <Text className="duration_value" style={{ color: ColorType.night }}>{nightDuration()}</Text>
                 }
                 {
-                    (props.type == 'FAST' || props.type == 'FAST_SLEEP') && <Text className="duration_title" onClick={fastPicker}>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
+                    (props.type == 'FAST' || props.type == 'FAST_SLEEP') && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
                 }
                 {
-                    (props.type == 'FAST' || props.type == 'FAST_SLEEP') && <Text className="duration_value" onClick={fastPicker} style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration()}</Text>
+                    (props.type == 'FAST' || props.type == 'FAST_SLEEP') && <Text className="duration_value" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration()}</Text>
                 }
                 {
-                    (props.type == 'SLEEP' || props.type == 'FAST_SLEEP') && <Text className="duration_title" onClick={sleepPicker}>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
+                    (props.type == 'SLEEP' || props.type == 'FAST_SLEEP') && <Text className="duration_title" >{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
                 }
                 {
-                    (props.type == 'SLEEP' || props.type == 'FAST_SLEEP') && <Text className="duration_value" onClick={sleepPicker} style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{sleepDuration()}</Text>
+                    (props.type == 'SLEEP' || props.type == 'FAST_SLEEP') && <Text className="duration_value" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{sleepDuration()}</Text>
                 }
             </View>
             {
-                !props.showStage && <View className="record_arrow_bg" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }} onClick={goClock}>
+                !props.showStage && <View className="record_arrow_bg" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
                     <View style={{ flex: 1 }} />
                     <Image className="arrow2" src={require('@/assets/images/arrow3.png')} />
                 </View>}
 
 
         </View>
+        {
+            showDetailModal && modalContent()
+        }
     </View>
 }

+ 50 - 8
src/features/trackTimeDuration/components/RecordFastSleep.tsx

@@ -4,7 +4,7 @@ import Modal from "@/components/layout/Modal";
 import RecordItem from "@/features/common/RecordItem";
 import { delRecord } from "@/services/trackTimeDuration";
 import { ModalType } from "@/utils/types";
-import { View, Text, Image } from "@tarojs/components";
+import { View, Text, Image, PageContainer } from "@tarojs/components";
 import Taro from "@tarojs/taro";
 import { useEffect, useState, memo } from "react";
 import TimelineFastSleep from "./TimelineFastSleep";
@@ -23,6 +23,7 @@ import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Ri
 import { rpxToPx } from "@/utils/tools";
 import { useDispatch, useSelector } from "react-redux";
 import { setSelID } from "@/store/common";
+import CircadianDetailPopup from "./CircadianDetailPopup";
 // import { sqrt } from 'mathjs'
 
 let AppState;
@@ -564,6 +565,47 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number })
         startX = 0
     }
 
+    function modalContent() {
+        if (process.env.TARO_ENV == 'weapp') {
+            return <Modal
+                testInfo={null}
+                dismiss={() => {
+                    setShowDetailModal(false)
+                }}
+                confirm={() => { }}>
+                {
+                    <CircadianDetailPopup
+                        record={record}
+                        onClose={() => setShowDetailModal(false)} />
+                }
+            </Modal>
+        }
+        else if (process.env.TARO_ENV == 'rn') {
+            return <PageContainer style={{ backgroundColor: '#1c1c1c' }}
+                // overlayStyle='background-color:rgba(0,0,0,0.9)'
+                // custom-style='background-color:#1c1c1c'
+                overlayStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
+                customStyle={{ backgroundColor: '#1c1c1c' }}
+                closeOnSlideDown={false}
+                onBeforeEnter={() => {
+
+                }}
+                onBeforeLeave={() => {
+                }}
+                onClick={() => { alert('b') }}
+                onClickOverlay={() => { alert('a') }}
+                onAfterLeave={() => { setShowDetailModal(false) }}
+                show={showDetailModal} round={true} overlay={true} position='bottom'
+            >
+                {
+                    <CircadianDetailPopup
+                        record={record}
+                        onClose={() => setShowDetailModal(false)} />
+                }
+            </PageContainer>
+        }
+    }
+
     return <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
         <View style={{ position: 'absolute', left: 0, top: 0, width: 0, height: 0, opacity: 0 }}>{count}</View>
         <View className='time_operate_item'
@@ -578,23 +620,23 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number })
             <View className={showDel ? 'btnDelete btnDeleteAni' : 'btnDelete'} onClick={del}>{t('feature.track_time_duration.record_fast_sleep.delete')}</View>
 
         </View>
-        {
+        {/* {
             (props.type == 'record' || props.type == 'latest') &&
             record.scenario == 'FAST_SLEEP' &&
             record.sleep.status == 'COMPLETED' &&
             <View className="more_stage" onClick={(e) => {
                 e.stopPropagation()
                 setShowMoreModal(true)
-                // setShowMore(!showMore)
             }}>
                 <Text className="more_stage_text">{showMore ? '隐藏更多' : '显示更多'}</Text>
             </View>
-        }
+        } */}
         {
-            showDetailModal && <Modal children={schedules()}
-                modalType={ModalType.center}
-                dismiss={() => setShowDetailModal(false)}
-                confirm={() => { }} />
+            showDetailModal && modalContent()
+            // showDetailModal && <Modal children={schedules()}
+            //     modalType={ModalType.center}
+            //     dismiss={() => setShowDetailModal(false)}
+            //     confirm={() => { }} />
         }
         {
             showMoreModal && <Modal children={moreStage()}

+ 1 - 0
src/pages/clock/Index.scss

@@ -16,6 +16,7 @@
 
 .count{
     opacity: 0;
+    height: 0;
 }
 
 .single_check_nor{

+ 21 - 99
src/pages/clock/Index.tsx

@@ -32,6 +32,7 @@ import TitleView from "@/features/trackTimeDuration/components/TitleView";
 import ClockHeader from "@/features/trackTimeDuration/components/ClockHeader";
 import DurationPicker from "@/features/trackTimeDuration/components/DurationPicker";
 import SegmentPop from "@/features/trackTimeDuration/components/SegmentPop";
+import Box from "@/components/layout/Box";
 
 let GradientText
 let useNavigation;
@@ -155,7 +156,8 @@ export default function Page() {
             getClockRecords({
                 page: 1,
                 limit: 1,
-                completed: true
+                part_completed: true
+                // completed: true
             }).then(res => {
                 setRecords((res as any).data)
             })
@@ -285,6 +287,15 @@ export default function Page() {
         setHomeData(obj)
     }
 
+    global.updateFastSleepData = (data: any) => {
+        if (data.id == (homeData as any).id) {
+            var obj = JSON.parse(JSON.stringify(homeData))
+            obj.fast_sleep.current_record = data
+            setHomeData(obj)
+        }
+
+    }
+
     function modalContent() {
         if (showModal || showModal2) {
             if (process.env.TARO_ENV == 'weapp') {
@@ -297,7 +308,7 @@ export default function Page() {
                     }}
                     confirm={() => { }}>
                     {
-                        showModal ? modalDetail :  modalDetail2 
+                        showModal ? modalDetail : modalDetail2
                     }
                 </Modal>
             }
@@ -320,7 +331,7 @@ export default function Page() {
                     show={showModal || showModal2} round={true} overlay={true} position='bottom'
                 >
                     {
-                        showModal ? modalDetail :  modalDetail2
+                        showModal ? modalDetail : modalDetail2
                     }
                 </PageContainer>
             }
@@ -363,102 +374,13 @@ export default function Page() {
             <View className="index_container">
                 <Text className="count">{count}</Text>
 
-                {
-                    (homeData as any).fast_sleep.current_record.status != 'WAIT_FOR_START' ?
-                        <View>
-                            <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} showStage={false} />
-                            <IndexConsole record={(homeData as any).fast_sleep} />
-                        </View> :
-
-                        <Swiper className='swiper1' indicatorColor='#333'
-                            indicatorActiveColor='#999'
-                            current={0}
-                            autoplay={false}
-                            duration={300}
-                            interval={300}
-
-                            indicator-offset={[0, -30]}
-                            indicator-height={30}
-                            indicatorDots={(homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START'}
-                            onChange={(e) => {
-                                var pageIndex = e.detail.current
-                                global.changeMixIndex(pageIndex)
-                            }}
-                        >
-                            <SwiperItem className='swiperItem'>
-                                <View>
-                                    <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} showStage={false} />
-                                    <View style={{height:20}}/>
-                                    <IndexConsole record={(homeData as any).fast_sleep} />
-                                </View>
-
-                            </SwiperItem>
-
-                            {
-                                (homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START' &&
-                                <SwiperItem className='swiperItem'>
-                                    <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp + 2000} showStage={true} />
-                                    <View style={{marginTop:20}}>
-                                        {
-                                            isMulti ? <View>
-                                                {
-                                                    multiData.map((item, index) => {
-                                                        return <View className={item.checked ? "single_check_sel" : "single_check_nor"} onClick={() => {
-                                                            item.checked = !item.checked
-                                                            global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
-                                                            setMultiData(JSON.parse(JSON.stringify(multiData)))
-                                                            setCount((prevCounter) => prevCounter + 1)
-                                                        }}>
-                                                            <Text className={item.checked ? "single_check_text_sel" : "single_check_text_nor"}>{item.title}</Text>
-                                                            {
-                                                                item.checked ? <Image src={require('@assets/images/check_black.png')} className="single_checked" /> :
-                                                                    <IconPlus color={ColorType.fast} />
-                                                            }
-                                                        </View>
-                                                    })
-                                                }
-                                            </View> : <View>
-
-                                                <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(0); global.updateMixItem([true, false, false]); setCount((prevCounter) => prevCounter + 1) }}>
-                                                    <Text className={selIndex == 0 ? "single_check_text_sel" : "single_check_text_nor"}>睡前断食</Text>
-                                                    {
-                                                        selIndex == 0 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                                                    }
-                                                </View>
-                                                <View className={selIndex == 1 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(1); global.updateMixItem([false, true, false]); setCount((prevCounter) => prevCounter + 1) }}>
-                                                    <Text className={selIndex == 1 ? "single_check_text_sel" : "single_check_text_nor"}>睡眠中断食</Text>
-                                                    {
-                                                        selIndex == 1 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                                                    }
-                                                </View>
-                                                <View className={selIndex == 2 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(2); global.updateMixItem([false, false, true]); setCount((prevCounter) => prevCounter + 1) }}>
-                                                    <Text className={selIndex == 2 ? "single_check_text_sel" : "single_check_text_nor"}>起床后断食</Text>
-                                                    {
-                                                        selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                                                    }
-                                                </View>
-                                            </View>
-                                        }
-                                        <View style={{ display: 'flex', alignItems: 'center', flexDirection: 'row', paddingRight: rpxToPx(46), width: rpxToPx(750), boxSizing: 'border-box' }}>
-                                            <View style={{ flex: 1 }} />
-                                            <Text style={{ marginRight: 10 }}>多选</Text>
-                                            <Switch color={ColorType.fast} onChange={(e) => {
-                                                setIsMulti(e.detail.value)
-                                                if (e.detail.value) {
-                                                    global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
-                                                }
-                                                else {
-                                                    global.updateMixItem([selIndex == 0, selIndex == 1, selIndex == 2])
-                                                }
-                                                setCount((prevCounter) => prevCounter + 1)
-                                            }} />
-                                        </View>
-                                    </View>
-                                </SwiperItem>
-                            }
-
-                        </Swiper>
-                }
+                <Box>
+                    <View>
+                        <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} showStage={false} />
+                        <IndexConsole record={(homeData as any).fast_sleep} />
+                    </View>
+                </Box>
+
                 {
                     user.isLogin && <DayLight />
                 }

+ 179 - 129
src/pages/clock/Index的副本.tsx

@@ -10,7 +10,7 @@ import { getInfoSuccess } from "@/store/user";
 import { clockHome, clockSummaryRecords, clockSummaryStats, getClockRecords, getClocks } from "@/services/trackTimeDuration";
 import { updateScenario } from "@/store/time";
 import { setConfigs } from "@/store/common";
-import { setScenario } from "@/store/scenario";
+import { setScenario, setStep } from "@/store/scenario";
 import { useEffect, useState } from "react";
 import { IconPlus, IconRadioCheck, IconRadioCross } from "@/components/basic/Icons";
 import { ColorType } from "@/context/themes/color";
@@ -26,9 +26,16 @@ import { TimeFormatter } from "@/utils/time_format";
 import WeekCalendar from "@/features/trackTimeDuration/components/WeekCalendar";
 import { useTranslation } from "react-i18next";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
+import Layout from "@/components/layout/layout";
+import { ModalType, NaviBarTitleShowType, TemplateType } from "@/utils/types";
+import TitleView from "@/features/trackTimeDuration/components/TitleView";
+import ClockHeader from "@/features/trackTimeDuration/components/ClockHeader";
+import DurationPicker from "@/features/trackTimeDuration/components/DurationPicker";
+import SegmentPop from "@/features/trackTimeDuration/components/SegmentPop";
 
 let GradientText
 let useNavigation;
+let isPause = false;
 
 if (process.env.TARO_ENV == 'rn') {
     GradientText = require('@/components/basic/GradientText').default
@@ -46,27 +53,23 @@ export default function Page() {
     const { t } = useTranslation()
     const user = useSelector((state: any) => state.user);
     const time = useSelector((state: any) => state.time);
-    const [showErrorPage, setErrorPage] = useState(false)
-    const [data, setData] = useState(null)
     const [count, setCount] = useState(0)
     const [homeData, setHomeData] = useState(null)
 
     const [selIndex, setSelIndex] = useState(0)
+
+
     const [showModal, setShowModal] = useState(false)
     const [modalDetail, setModalDetail] = useState<any>(null)
 
     const [showModal2, setShowModal2] = useState(false)
     const [modalDetail2, setModalDetail2] = useState<any>(null)
 
-    const [isModal1, setIsModal1] = useState(false)
     const [debugInfo, setDebugInfo] = useState(null)
 
     const [isMulti, setIsMulti] = useState(false)
     const [records, setRecords] = useState([])
 
-    const [calendars, setCalendars] = useState([])
-
-
     const [multiData, setMultiData] = useState([
         {
             title: '睡前断食',
@@ -85,6 +88,9 @@ export default function Page() {
     useEffect(() => {
         global.showNightRing = false;
         setInterval(() => {
+            if (isPause) {
+                return
+            }
             setCount((prevCounter) => prevCounter + 1)
         }, 1000)
     }, [])
@@ -130,12 +136,19 @@ export default function Page() {
         clockHome().then(res => {
             setHomeData(res as any)
             global.homeData = res
+
+            if (user.isLogin) {
+                isPause = (res as any).fast_sleep.current_record.status == 'WAIT_FOR_START'
+                dispatch(updateScenario((res as any).fast_sleep.current_record))
+                dispatch(setConfigs((res as any).time_input_schema));
+                dispatch(setScenario((res as any).fast_sleep.scenario));
+            }
         })
 
         getHistory()
     }
 
-    
+
 
     function getHistory() {
         if (user.isLogin)
@@ -248,7 +261,6 @@ export default function Page() {
 
     global.showIndexModal = (isShow: boolean, detail: any, debugNode?: any) => {
         global.showModal = isShow
-        setIsModal1(true)
         setDebugInfo(debugNode)
         setShowModal(isShow)
         setModalDetail(detail)
@@ -257,11 +269,22 @@ export default function Page() {
     global.showIndexModal2 = (isShow: boolean, detail: any) => {
         setDebugInfo(null)
         global.showModal = isShow
-        setIsModal1(false)
         setShowModal2(isShow)
         setModalDetail2(detail)
     }
 
+    global.changeTargetDuration = (duration: number, isFast: boolean) => {
+        var obj = JSON.parse(JSON.stringify(homeData))
+        var record = obj.fast_sleep.current_record
+        if (isFast) {
+            record.fast.target_end_time = record.fast.target_start_time + duration * 60 * 1000
+        }
+        else {
+            record.sleep.target_end_time = record.sleep.target_start_time + duration * 60 * 1000
+        }
+        setHomeData(obj)
+    }
+
     function modalContent() {
         if (showModal || showModal2) {
             if (process.env.TARO_ENV == 'weapp') {
@@ -269,11 +292,12 @@ export default function Page() {
                     testInfo={debugInfo}
                     dismiss={() => {
                         setDebugInfo(null)
-                        setShowModal(false); setShowModal2(false)
+                        setShowModal(false);
+                        setShowModal2(false);
                     }}
                     confirm={() => { }}>
                     {
-                        isModal1 ? modalDetail : modalDetail2
+                        showModal ? modalDetail :  modalDetail2 
                     }
                 </Modal>
             }
@@ -296,7 +320,7 @@ export default function Page() {
                     show={showModal || showModal2} round={true} overlay={true} position='bottom'
                 >
                     {
-                        isModal1 ? modalDetail : modalDetail2
+                        showModal ? modalDetail :  modalDetail2
                     }
                 </PageContainer>
             }
@@ -325,141 +349,167 @@ export default function Page() {
         })
     }
 
+
+
+    function headerView() {
+        return <ClockHeader homeData={homeData} />
+    }
+
     var timestamp = new Date().getTime()
 
     function render() {
-        return <View className="index_container">
-            <Text className="count">{count}</Text>
-            <IndexItem type="FAST" data={(homeData as any).fast} time={timestamp} />
-            <IndexItem type='SLEEP' data={(homeData as any).sleep} time={timestamp} />
-            <Text className="discovery">探索</Text>
-            <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} />
-            <Swiper className='swiper1' indicatorColor='#333'
-                indicatorActiveColor='#999'
-                current={0}
-                autoplay={false}
-                duration={300}
-                interval={300}
-                indicator-offset={[0, -30]}
-                indicator-height={30}
-                indicatorDots={(homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START'}
-                onChange={(e) => {
-                    var pageIndex = e.detail.current
-                    global.changeMixIndex(pageIndex)
-                }}
-            >
-                <SwiperItem className='swiperItem'>
-                    <IndexConsole record={(homeData as any).fast_sleep} />
-
-                </SwiperItem>
+        return <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
+
+            <View className="index_container">
+                <Text className="count">{count}</Text>
 
                 {
-                    (homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START' &&
-                    <SwiperItem className='swiperItem'>
+                    (homeData as any).fast_sleep.current_record.status != 'WAIT_FOR_START' ?
                         <View>
+                            <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} showStage={false} />
+                            <IndexConsole record={(homeData as any).fast_sleep} />
+                        </View> :
+
+                        <Swiper className='swiper1' indicatorColor='#333'
+                            indicatorActiveColor='#999'
+                            current={0}
+                            autoplay={false}
+                            duration={300}
+                            interval={300}
+                            // style={{backgroundColor:'red'}}
+                            indicator-offset={[0, -30]}
+                            indicator-height={30}
+                            indicatorDots={(homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START'}
+                            onChange={(e) => {
+                                var pageIndex = e.detail.current
+                                global.changeMixIndex(pageIndex)
+                            }}
+                        >
+                            <SwiperItem className='swiperItem'>
+                                <View>
+                                    <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} showStage={false} />
+                                    <IndexConsole record={(homeData as any).fast_sleep} />
+                                </View>
+
+                            </SwiperItem>
+
                             {
-                                isMulti ? <View>
-                                    {
-                                        multiData.map((item, index) => {
-                                            return <View className={item.checked ? "single_check_sel" : "single_check_nor"} onClick={() => {
-                                                item.checked = !item.checked
-                                                global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
-                                                setMultiData(JSON.parse(JSON.stringify(multiData)))
-                                                setCount((prevCounter) => prevCounter + 1)
-                                            }}>
-                                                <Text className={item.checked ? "single_check_text_sel" : "single_check_text_nor"}>{item.title}</Text>
+                                (homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START' &&
+                                <SwiperItem className='swiperItem'>
+                                    <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp + 2000} showStage={true} />
+                                    <View style={{marginTop:20}}>
+                                        {
+                                            isMulti ? <View>
                                                 {
-                                                    item.checked ? <Image src={require('@assets/images/check_black.png')} className="single_checked" /> :
-                                                        <IconPlus color={ColorType.fast} />
+                                                    multiData.map((item, index) => {
+                                                        return <View className={item.checked ? "single_check_sel" : "single_check_nor"} onClick={() => {
+                                                            item.checked = !item.checked
+                                                            global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
+                                                            setMultiData(JSON.parse(JSON.stringify(multiData)))
+                                                            setCount((prevCounter) => prevCounter + 1)
+                                                        }}>
+                                                            <Text className={item.checked ? "single_check_text_sel" : "single_check_text_nor"}>{item.title}</Text>
+                                                            {
+                                                                item.checked ? <Image src={require('@assets/images/check_black.png')} className="single_checked" /> :
+                                                                    <IconPlus color={ColorType.fast} />
+                                                            }
+                                                        </View>
+                                                    })
                                                 }
+                                            </View> : <View>
+
+                                                <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(0); global.updateMixItem([true, false, false]); setCount((prevCounter) => prevCounter + 1) }}>
+                                                    <Text className={selIndex == 0 ? "single_check_text_sel" : "single_check_text_nor"}>睡前断食</Text>
+                                                    {
+                                                        selIndex == 0 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
+                                                    }
+                                                </View>
+                                                <View className={selIndex == 1 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(1); global.updateMixItem([false, true, false]); setCount((prevCounter) => prevCounter + 1) }}>
+                                                    <Text className={selIndex == 1 ? "single_check_text_sel" : "single_check_text_nor"}>睡眠中断食</Text>
+                                                    {
+                                                        selIndex == 1 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
+                                                    }
+                                                </View>
+                                                <View className={selIndex == 2 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(2); global.updateMixItem([false, false, true]); setCount((prevCounter) => prevCounter + 1) }}>
+                                                    <Text className={selIndex == 2 ? "single_check_text_sel" : "single_check_text_nor"}>起床后断食</Text>
+                                                    {
+                                                        selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
+                                                    }
+                                                </View>
                                             </View>
-                                        })
-                                    }
-                                </View> : <View>
-
-                                    <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(0); global.updateMixItem([true, false, false]); setCount((prevCounter) => prevCounter + 1) }}>
-                                        <Text className={selIndex == 0 ? "single_check_text_sel" : "single_check_text_nor"}>睡前断食</Text>
-                                        {
-                                            selIndex == 0 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                                        }
-                                    </View>
-                                    <View className={selIndex == 1 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(1); global.updateMixItem([false, true, false]); setCount((prevCounter) => prevCounter + 1) }}>
-                                        <Text className={selIndex == 1 ? "single_check_text_sel" : "single_check_text_nor"}>睡眠中断食</Text>
-                                        {
-                                            selIndex == 1 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                                        }
-                                    </View>
-                                    <View className={selIndex == 2 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(2); global.updateMixItem([false, false, true]); setCount((prevCounter) => prevCounter + 1) }}>
-                                        <Text className={selIndex == 2 ? "single_check_text_sel" : "single_check_text_nor"}>起床后断食</Text>
-                                        {
-                                            selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
                                         }
+                                        <View style={{ display: 'flex', alignItems: 'center', flexDirection: 'row', paddingRight: rpxToPx(46), width: rpxToPx(750), boxSizing: 'border-box' }}>
+                                            <View style={{ flex: 1 }} />
+                                            <Text style={{ marginRight: 10 }}>多选</Text>
+                                            <Switch color={ColorType.fast} onChange={(e) => {
+                                                setIsMulti(e.detail.value)
+                                                if (e.detail.value) {
+                                                    global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
+                                                }
+                                                else {
+                                                    global.updateMixItem([selIndex == 0, selIndex == 1, selIndex == 2])
+                                                }
+                                                setCount((prevCounter) => prevCounter + 1)
+                                            }} />
+                                        </View>
                                     </View>
-                                </View>
+                                </SwiperItem>
                             }
-                            <View style={{ display: 'flex', alignItems: 'center', flexDirection: 'row', paddingRight: rpxToPx(46), width: rpxToPx(750), boxSizing: 'border-box' }}>
-                                <View style={{ flex: 1 }} />
-                                <Text style={{ marginRight: 10 }}>多选</Text>
-                                <Switch color={ColorType.fast} onChange={(e) => {
-                                    setIsMulti(e.detail.value)
-                                    if (e.detail.value) {
-                                        global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
-                                    }
-                                    else {
-                                        global.updateMixItem([selIndex == 0, selIndex == 1, selIndex == 2])
-                                    }
-                                    setCount((prevCounter) => prevCounter + 1)
-                                }} />
-                            </View>
-                        </View>
-                    </SwiperItem>
+
+                        </Swiper>
+                }
+                {
+                    user.isLogin && <DayLight />
+                }
+                {
+                    user.isLogin && records.length > 0 && <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
+                        {
+                            <Text className="discovery">{t('feature.track_time_duration.record_fast_sleep.header.latest_record')}</Text>
+                        }
+                        {
+                            process.env.TARO_ENV == 'weapp' && <Text className="fast_sleep_more index_more" onClick={more}>{t('feature.track_time_duration.record_fast_sleep.header.btn_show_all')}</Text>
+                        }
+                        {
+                            process.env.TARO_ENV == 'rn' && <GradientText onClick={more} style={{ fontSize: rpxToPx(32), fontWeight: 'bold' }}>{t('feature.track_time_duration.record_fast_sleep.header.btn_show_all')}</GradientText>
+                        }
+                    </View>
                 }
 
-            </Swiper>
-            {
-                user.isLogin && <DayLight />
-            }
-            {
-                user.isLogin && records.length > 0 && <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
-                    {
-                        <Text className="discovery">最近</Text>
-                    }
-                    {
-                        process.env.TARO_ENV == 'weapp' && <Text className="fast_sleep_more index_more" onClick={more}>{t('feature.track_time_duration.record_fast_sleep.header.btn_show_all')}</Text>
-                    }
-                    {
-                        process.env.TARO_ENV == 'rn' && <GradientText onClick={more} style={{ fontSize: rpxToPx(32), fontWeight: 'bold' }}>{t('feature.track_time_duration.record_fast_sleep.header.btn_show_all')}</GradientText>
-                    }
-                </View>
-            }
+                {
+                    records.length > 0 && <View className="fast_sleep_item_bg">
+                        <RecordFastSleep data={records[0]} type='record' index={-20000} />
+                    </View>
+                }
 
-            {
-                records.length > 0 && <View className="fast_sleep_item_bg">
-                    <RecordFastSleep data={records[0]} type='record' delSuccess={() => { }} index={-20000}/>
-                </View>
-            }
+                {
+                    user.isLogin && <View>
+                        <Text className="discovery">周统计</Text>
+                        <WeekCalendar />
+                    </View>
+                }
 
-            {
-                user.isLogin && <View>
-                    <Text className="discovery">周统计</Text>
-                    <WeekCalendar />
-                </View>
-            } 
+                <View style={{ height: 100 }} />
+                {
+                    modalContent()
+                }
 
-            <View style={{ height: 100 }} />
-            {
-                modalContent()
-            }
-            <Tabbar index={0} />
-        </View>
+                {
+                    homeData && <SegmentPop data={(homeData as any).fast_sleep} />
+                }
+                {
+                    homeData && <DurationPicker record={(homeData as any).fast_sleep.current_record} />
+                }
+                <Tabbar index={0} />
+            </View>
+        </Layout>
     }
 
-    if (process.env.TARO_ENV == 'rn') {
-        return <ScrollView>
-            {
-                render()
-            }
-        </ScrollView>
-    }
+    // if (process.env.TARO_ENV == 'rn') {
+    //     return <ScrollView>
+    //         {
+    //             render()
+    //         }
+    //     </ScrollView>
+    // }
     return render()
 }