Jelajahi Sumber

clear some files

Leon 1 tahun lalu
induk
melakukan
e0c7fa13e2

+ 0 - 205
src/components/input/SlidngScale_backup.tsx

@@ -1,205 +0,0 @@
-import { ScrollView, View, Text, Image } from "@tarojs/components";
-import VirtualList from '@tarojs/components/virtual-list';
-import './SlidngScale.scss'
-import { useEffect, useRef, useState } from "react";
-import Taro from "@tarojs/taro";
-import { rpxToPx } from "@/utils/tools";
-import { throttle } from 'lodash';
-
-var timerA = null
-var lastValue = 0
-export default function Component(props: {
-    step: number, min: number,
-    max: number, default_value: number, changed: Function, unit: string
-    themeColor: string,
-    updateStatus: Function
-}) {
-    const scrollViewRef = useRef<any>();
-    const minNum: number = props.min;//props.step < 1 ?props.default_value-2:props.default_value-20//
-    const maxNum: number = props.max;//props.step < 1 ?props.default_value+2:props.default_value+20//
-
-    const stepNum: number = props.step * 10;
-    const jingdu: number = props.step < 1 ? 10 : 1;
-    const list: any[] = [];
-
-    const slidngWidth = 10
-
-    const [current, setCurrent] = useState(props.default_value)
-    const [left, setLeft] = useState((props.default_value - minNum) * slidngWidth / props.step);
-    const [isDraging, setIsDraging] = useState(false)
-    const [isEnd, setIsEnd] = useState(true)
-    const [enableText, setEnableText] = useState(true)
-
-    // const [showScrollView, setShowScrollView] = useState(false)
-
-    for (var i: number = minNum; i <= maxNum; i += props.step) {
-        var value: number = parseFloat(i.toFixed(1));
-        var isBig: boolean = Math.round((value - minNum) * jingdu) % Math.round(stepNum * jingdu) == 0;
-        var isMiddle: boolean = (Math.round((value - minNum) * jingdu) * 2) % Math.round(stepNum * jingdu) == 0;
-
-        list.push({
-            value: props.step < 1 ? value : Math.round(value),
-            showBig: isBig && i >= minNum && i <= maxNum,
-            showMiddle: isMiddle && !isBig && i >= minNum && i <= maxNum
-        })
-
-    }
-
-    useEffect(() => {
-        if (isEnd && !isDraging) {
-            props.updateStatus(true)
-            setEnableText(true)
-        }
-        else {
-            props.updateStatus(false)
-            setEnableText(false)
-        }
-
-    }, [isEnd, isDraging])
-
-    function scrollContent(e) {
-        lastValue = e.detail.scrollLeft;
-        if (timerA)
-            clearTimeout(timerA);
-
-        timerA = setTimeout(() => {
-
-            update(e)
-            setIsDraging(false)
-        }, 250) as any
-    }
-
-    const handleScroll = throttle((e) => {
-        update(e)
-    }, 500);
-
-    function touchEnd() {
-        setIsEnd(true)
-        var temp = lastValue
-        setTimeout(() => {
-            if (temp == lastValue) {
-                setIsDraging(false)
-            }
-        }, 250)
-    }
-
-    function touchStart() {
-        props.updateStatus(false)
-        setEnableText(false)
-    }
-
-    function dragStart(e) {
-        lastValue = e.detail.scrollLeft;
-        setIsEnd(false)
-        setIsDraging(true)
-    }
-
-    function dragEnd(e) {
-        setIsEnd(true)
-    }
-
-    function update(e) {
-        const { scrollLeft } = e.detail;
-
-        var count = scrollLeft / slidngWidth;
-        var strValue = (minNum + Math.round(count) * props.step).toFixed(1);
-        if ((strValue as any) < minNum) {
-            strValue = minNum as any;
-        }
-
-        if ((strValue as any) > maxNum) {
-            strValue = maxNum as any;
-        }
-
-        if (parseFloat(strValue) != current) {
-            var data = strValue as any;
-            if (props.step < 1) {
-                data = parseFloat(strValue).toFixed(1);
-                if (data.indexOf('.') > 0) {
-                    const regexp = /(?:\.0*|(\.\d+?)0+)$/
-                    data = data.replace(regexp, '$1')
-                }
-            }
-            else {
-                data = Math.round(data);
-            }
-
-
-
-            setCurrent(data);
-            props.changed(data);
-        }
-    }
-
-    const scrollEnd = (e) => {
-    }
-
-    function itemContent(data) {
-        var item = list[data.index]
-        var index = data.index
-        return <View className={item.showBig ? 'slidng_item_big' : item.showMiddle ? 'slidng_item_middle' : 'slidng_item'} style={{ width: 2, marginRight: 8, backgroundColor: props.themeColor, zIndex: 0 }} key={index}>
-            {
-                item.showBig ? <Text className="slidng_text">{item.value}</Text> : null
-            }
-        </View>
-    }
-    return <View className="slidng">
-        <View className="number_bg" style={{ opacity: enableText ? 1 : 0.4 }}>
-            <Text className="number">{current}</Text>
-            <Text className="unit">{props.unit}</Text>
-        </View>
-
-        <View className="scroll_bg">
-            <View className="shadow_top" />
-            <View className="shadow_left" />
-            <View className="shadow_right" />
-            <View className="top_line" style={{ backgroundColor: props.themeColor }} />
-            <ScrollView
-                style={{ zIndex: 0, position: 'relative' }} ref={scrollViewRef}
-                scrollX scrollLeft={left} className="scroll"
-                enablePassive={true}
-                fastDeceleration={true}
-                onScrollEnd={scrollEnd}
-                onDragEnd={dragEnd}
-                onTouchStart={touchStart}
-                onTouchEnd={touchEnd}
-                onDragStart={dragStart}
-                onScroll={scrollContent}
-                enhanced
-            >
-                <View className="scrollContent">
-                    <View className="scrollPadding" style={{width:rpxToPx(372)}}/>
-                    <View className="content">
-                        {
-                            list.map((item, index) => {
-                                return <View className={item.showBig ? 'slidng_item_big' : item.showMiddle ? 'slidng_item_middle' : 'slidng_item'}
-                                    style={{ width: 2, marginRight: list.length-1==index?0:8, backgroundColor: props.themeColor, zIndex: 0 }} key={index}>
-                                    {
-                                        item.showBig ? <Text className="slidng_text">{item.value}</Text> : null
-                                    }
-                                </View>
-                            })
-                        }
-                        {/* <View style={{position:'fixed',right:0,top:0,width:100,bottom:0,backgroundColor:'red',zIndex:10}}/> */}
-                    </View>
-                    <View className="scrollPadding" />
-
-                </View>
-
-            </ScrollView>
-
-            {/* <VirtualList height={rpxToPx(300)} width={rpxToPx(750)} onScroll={handleScroll} layout="horizontal"
-                initialScrollOffset={left}
-                itemCount={list.length}
-                item={itemContent}
-                itemSize={10}
-                itemData={list}
-            /> */}
-
-            <Image className="center_line" src={require('@assets/images/scale_center.png')} />
-            {/* <View className="center_line" /> */}
-        </View>
-
-
-    </View>
-}

+ 140 - 8
src/features/trackTimeDuration/components/CircadianDetailPopup.tsx

@@ -17,7 +17,7 @@ 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 }) {
+export default function CircadianDetailPopup(props: { record: any, schedule?: any, onClose: Function, stageIndex?: number, onlyStage?: boolean }) {
     const [tabIndex, setTabIndex] = useState(0)
     const [diffTimeZone, setDiffTimeZone] = useState(false)
     const [multiTimeZone, setMultiTimeZone] = useState(false)
@@ -45,7 +45,6 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
     }, [])
 
     useEffect(() => {
-        debugger
         checkTimezone()
         // var current_record = props.record
         if (detail.fast)
@@ -56,14 +55,12 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
     }, [detail])
 
     useEffect(() => {
-        debugger
         setDetail(JSON.parse(JSON.stringify(props.record)))
     }, [props.record])
 
 
 
     function checkTimezone() {
-        debugger
         var split = new Date().toString().split(' ');
         var currentTZ = split[split.length - 2];
         var isDiff = false;
@@ -193,7 +190,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
                     start = props.record.sleep.target_end_time
                     end = props.record.fast.target_end_time
                 }
-                else if (props.record.status == 'ONGOING3'){
+                else if (props.record.status == 'ONGOING3') {
                     return TimeFormatter.countdown(props.record.sleep.real_end_time)
                 }
                 else {
@@ -420,7 +417,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
             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 onClick={() => tapDuration(true)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                    <Text  className='pop_duration_txt'>{TimeFormatter.durationFormate(detail.fast.target_start_time, detail.fast.target_end_time)}</Text>
+                    <Text 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' }}>
@@ -461,7 +458,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
             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 onClick={() => tapDuration(false)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                    <Text  className='pop_duration_txt'>{TimeFormatter.durationFormate(detail.sleep.target_start_time, detail.sleep.target_end_time)}</Text>
+                    <Text 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' }}>
@@ -561,7 +558,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
             duration2 = durationArc(props.record.sleep.real_start_time, date.getTime())
             duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
         }
-        else if (props.record.status == 'ONGOING3'){
+        else if (props.record.status == 'ONGOING3') {
             var date = new Date()
             timestamp = props.record.fast.real_start_time
             timestamp2 = props.record.sleep.real_start_time
@@ -799,6 +796,141 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
         return <View />
     }
 
+    function onlyStageContent() {
+        var bgRing = getBgRing()
+        var common = getCommon(null, false)
+        common.radius = bigRingRadius;
+        common.lineWidth = ringWidth;
+
+        var timestamp, timestamp2, timestamp3
+        var duration, duration2, duration3;
+        if (props.record.status == 'WAIT_FOR_START') {
+            var date = new Date()
+            date.setSeconds(0)
+            date.setMilliseconds(0)
+            var fastStart = props.schedule.fast.start_time
+            var sleepStart = props.schedule.sleep.start_time
+            var sleepEnd = props.schedule.sleep.end_time
+            date.setHours(parseInt(fastStart.split(':')[0]))
+            date.setMinutes(parseInt(fastStart.split(':')[1]))
+
+            timestamp = date.getTime()
+            date.setHours(parseInt(sleepStart.split(':')[0]))
+            date.setMinutes(parseInt(sleepStart.split(':')[1]))
+            timestamp2 = date.getTime()
+            if (timestamp2 < timestamp) {
+                timestamp2 += 24 * 3600 * 1000
+            }
+            date.setHours(parseInt(sleepEnd.split(':')[0]))
+            date.setMinutes(parseInt(sleepEnd.split(':')[1]))
+            timestamp3 = date.getTime()
+            if (timestamp3 < timestamp2) {
+                timestamp3 += 24 * 3600 * 1000
+            }
+
+            duration = durationArc(props.record.fast.target_start_time, props.record.sleep.target_start_time)
+            duration2 = durationArc(props.record.sleep.target_start_time, props.record.sleep.target_end_time)
+            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
+        }
+        else if (props.record.status == 'ONGOING1') {
+            var date = new Date()
+            timestamp = props.record.fast.real_start_time
+            timestamp2 = props.record.sleep.target_start_time
+            timestamp3 = props.record.sleep.target_end_time
+            duration = durationArc(props.record.fast.real_start_time, date.getTime())
+            duration2 = durationArc(props.record.sleep.target_start_time, props.record.sleep.target_end_time)
+            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
+        }
+        else if (props.record.status == 'ONGOING2') {
+            var date = new Date()
+            timestamp = props.record.fast.real_start_time
+            timestamp2 = props.record.sleep.real_start_time
+            timestamp3 = props.record.sleep.target_end_time
+            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
+            duration2 = durationArc(props.record.sleep.real_start_time, date.getTime())
+            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
+        }
+        else if (props.record.status == 'ONGOING3') {
+            var date = new Date()
+            timestamp = props.record.fast.real_start_time
+            timestamp2 = props.record.sleep.real_start_time
+            timestamp3 = props.record.sleep.real_end_time
+            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
+            duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
+            duration3 = durationArc(props.record.sleep.real_end_time, date.getTime())
+        }
+        else {
+            timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_time_zone)
+            timestamp2 = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time, props.record.fast.real_end_time_zone)
+            timestamp3 = TimeFormatter.transferTimestamp(props.record.sleep.real_end_time, props.record.fast.real_end_time_zone)
+            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
+            duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
+            duration3 = durationArc(props.record.sleep.real_end_time, props.record.fast.real_end_time)
+        }
+
+        const preRing: RealRing = {
+            color: global.fastColor ? global.fastColor : ColorType.fast,
+            startArc: startArc(timestamp),
+            durationArc: duration
+        }
+        const sleepRing: RealRing = {
+            color: global.sleepColor ? global.sleepColor : ColorType.sleep,
+            startArc: startArc(timestamp2),
+            durationArc: duration2
+        }
+        const wakeRing: RealRing = {
+            color: global.fastColor ? global.fastColor : ColorType.fast,
+            startArc: startArc(timestamp3),
+            durationArc: duration3
+        }
+
+        return <View className='detail_container'>
+            <Text className='detail_popup_title'>{getTitle()}<Text className='detail_popup_subttitle'> {getSubTitle()}</Text></Text>
+            <View style={{marginTop:rpxToPx(40)}}>
+                {
+                    props.stageIndex == 0 && <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>
+                }
+                {
+                    props.stageIndex == 1 && <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>
+                }
+                {
+                    props.stageIndex == 2 && <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>
+            <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>
+        </View>
+    }
+
+    if (props.onlyStage) {
+        return onlyStageContent()
+    }
+
 
     return <View className='detail_container'>
 

+ 0 - 7
src/features/trackTimeDuration/components/Clock.scss

@@ -1,7 +0,0 @@
-
-
-.clock_text{
-    // font-size: 64px;
-    line-height: 72px;
-    font-weight: 500;
-}

+ 0 - 231
src/features/trackTimeDuration/components/Clock.tsx

@@ -1,231 +0,0 @@
-import trackTimeService, { machine } from "@/store/trackTimeMachine";
-import { View, Text, CoverView } from "@tarojs/components";
-import { useEffect, useState } from "react";
-import { TimeFormatter } from "@/utils/time_format";
-import Rings, { BgRing, CurrentDot, RealRing, RingCommon } from './Rings';
-import { getBgRing, getCommon, getDot, getReal, getTarget } from "../hooks/RingData";
-import './Clock.scss'
-import { ColorType } from "@/context/themes/color";
-import { useSelector } from "react-redux";
-import { jumpPage } from "../hooks/Common";
-import Taro from "@tarojs/taro";
-import { useTranslation } from "react-i18next";
-
-let GradientText
-if (process.env.TARO_ENV == 'rn') {
-    GradientText = require('@/components/basic/GradientText').default
-}
-export default function Component(props: { showCoverView: boolean }) {
-    const [checkData, setCheckData] = useState(null)
-    const time = useSelector((state: any) => state.time);
-    const user = useSelector((state: any) => state.user);
-    const [showCover, setShowCover] = useState(props.showCoverView)
-    const { t } = useTranslation()
-    const [smallCtx, setSmallCtx] = useState(null)
-    const [bigCtx, setBigCtx] = useState(null)
-
-    const [smallCanvas, setSmallCanvas] = useState(null)
-    const [bigCanvas, setBigCanvas] = useState(null)
-
-    useEffect(() => {
-        if (!user.isLogin) {
-            setCheckData(null)
-        }
-    }, [user.isLogin])
-
-    useEffect(() => {
-        if (time.status != '' && user.isLogin)
-            setCheckData(time)
-    }, [time.status, time.scenario, user.isLogin])
-
-    useEffect(() => {
-        setShowCover(props.showCoverView)
-    }, [props.showCoverView])
-
-    
-
-    
-
-    //外环
-    function bigRing() {
-        var common = getCommon(null, true)
-        common.radius = 126;
-        common.lineWidth = 28;
-        var bgRing = getBgRing()
-        var currentDot1;
-        var realRing1;
-        var targetBigRing1
-        if (!checkData) {
-            currentDot1 = getDot(null, true)
-        }
-        else {
-            currentDot1 = getDot(time, true)
-
-            targetBigRing1 = getTarget(time, true)
-            targetBigRing1.color = global.fastColor ? global.fastColor + '66' : ColorType.fast + '66'//'rgba(170,255,0,0.4)'
-            if (time.scenario == 'SLEEP') {
-                targetBigRing1.color = global.sleepColor ? global.sleepColor + '66' : ColorType.sleep + '66'//'rgba(170,255,0,0.4)'
-            }
-
-
-            if (time.status == 'ONGOING') {
-                realRing1 = getReal(time, true, false)
-            }
-            realRing1 = getReal(time, true, false)
-        }
-
-
-
-        return <Rings common={common} bgRing={bgRing} currentDot={currentDot1}
-            targetRing={(!checkData || time.status == 'WAIT_FOR_START') ? null : targetBigRing1}
-            realRing={(!checkData || time.status == 'WAIT_FOR_START') ? null : realRing1}
-            ctx={bigCtx} setCtx={setBigCtx}
-            canvas={bigCanvas} setCanvas={setBigCanvas}
-            canvasId='bigRing' />
-    }
-
-
-    //内环
-    // function smallRing() {
-    //     // if (!checkData) return null
-    //     if (time.scenario == 'FAST_SLEEP') {
-    //         var common = getCommon(null, false)
-    //         common.radius = 90;
-    //         common.lineWidth = 28;
-    //         var bgRing = getBgRing()
-    //         var realRing = getReal(time, false, false)
-    //         var currentDot = getDot(time, false)
-    //         var targetRing = getTarget(time, false)
-    //         targetRing.color = global.sleepColor ? global.sleepColor + '66' : ColorType.sleep + '66'//'rgba(0, 255, 255, 0.4)'
-    //         // if (current_record.status == 'ONGOING2') {
-    //         //     return <Rings common={common} bgRing={bgRing} realRing={realRing} currentDot={currentDot} targetRing={targetRing} canvasId='clock7' />
-    //         // }
-
-    //         //ongoing3时,睡眠点整理亮度降低
-    //         if (time.status == 'ONGOING3') {
-    //             currentDot.color = global.sleepColor ? global.sleepColor + '66' : ColorType.sleep + '66'
-    //         }
-    //         // return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId='clock8' />
-
-    //         return <Rings common={common} bgRing={bgRing} currentDot={currentDot}
-    //             realRing={time.status == 'ONGOING2' ? realRing : null}
-    //             targetRing={time.status == 'ONGOING2' ? targetRing : null}
-    //             canvasId='smallRing'
-    //             canvas={smallCanvas} setCanvas={setSmallCanvas}
-    //             ctx={smallCtx} setCtx={setSmallCtx}
-    //         />
-    //     }
-    //     // return null;
-    // }
-
-    function smallRing() {
-        // if (!checkData) return null
-        // if (time.scenario == 'FAST_SLEEP') {
-        var common = getCommon(null, false)
-        common.radius = 90;
-        common.lineWidth = 28;
-        var bgRing = getBgRing()
-        var realRing = time.scenario == 'FAST_SLEEP' ? getReal(time, false, false) : null
-        var currentDot = time.scenario == 'FAST_SLEEP' ? getDot(checkData ? time : null, false) : null
-        var targetRing = time.scenario == 'FAST_SLEEP' ? getTarget(time, false) : null
-        if (targetRing) {
-            targetRing.color = global.sleepColor ? global.sleepColor + '66' : ColorType.sleep + '66'//'rgba(0, 255, 255, 0.4)'
-        }
-
-        //ongoing3时,睡眠点整理亮度降低
-        if (time.status == 'ONGOING3') {
-            currentDot.color = global.sleepColor ? global.sleepColor + '66' : ColorType.sleep + '66'
-        }
-
-        return <Rings common={common} bgRing={bgRing} currentDot={currentDot}
-            targetRing={time.status == 'ONGOING2' ? targetRing : null}
-            realRing={time.status == 'ONGOING2' ? realRing : null}
-            ctx={smallCtx} setCtx={setSmallCtx}
-            canvas={smallCanvas} setCanvas={setSmallCanvas}
-            canvasId='smallRing' />
-        // }
-        // return null;
-    }
-
-    function tapCover() {
-        if (user.isLogin) {
-
-        }
-        else {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', null)
-        }
-    }
-
-    return (
-        <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%' }}>
-            <View style={{ position: 'relative', zIndex: 1 }}>
-                {
-                    bigRing()
-                }
-                <View style={{
-                    display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0,
-                    opacity: (time.scenario == 'FAST_SLEEP' && user.isLogin) ? 1 : 0,
-                    alignItems: 'center', justifyContent: 'center',
-                }}>
-                    {
-                        smallRing()
-                    }
-                </View>
-                <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                    {
-                        !checkData && <Text className="clock_text" style={{ fontSize: 24, color: ColorType.fast }}>{TimeFormatter.getCurrentHourAndMinute()}</Text>
-                    }
-                    {
-                        checkData && process.env.TARO_ENV == 'weapp' && time.status == 'WAIT_FOR_START' && time.scenario == 'FAST_SLEEP' &&
-                        <Text className="clock_text fast_sleep_text" style={{ fontSize: 24 }}>{TimeFormatter.getCurrentHourAndMinute()}</Text>
-                    }
-                    {
-                        checkData && process.env.TARO_ENV == 'rn' && time.status == 'WAIT_FOR_START' && time.scenario == 'FAST_SLEEP' &&
-                        <GradientText style={{ fontSize: 24 }}>{TimeFormatter.getCurrentHourAndMinute()}</GradientText>
-                        // <Text className="clock_text fast_sleep_text" style={{ fontSize: 24 }}>{TimeFormatter.getCurrentHourAndMinute()}</Text>
-                    }
-                    {
-                        checkData && time.status == 'WAIT_FOR_START' && time.scenario != 'FAST_SLEEP' &&
-                        <Text className="clock_text" style={{ color: time.scenario == 'FAST' ? ColorType.fast : ColorType.sleep, fontSize: 24 }}>{TimeFormatter.getCurrentHourAndMinute()}</Text>
-                    }
-                    {
-                        checkData && time.status == 'ONGOING' && <Text className="clock_text" style={{ color: time.scenario == 'FAST' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep, fontSize: 32 }}>
-                            {TimeFormatter.formateTimeNow(time.fast ?
-                                time.fast.real_start_time :
-                                time.sleep.real_start_time)}
-                        </Text>
-                    }
-                    {
-                        checkData && time.status == 'ONGOING1' && <Text className="clock_text" style={{ color: global.fastColor ? global.fastColor : ColorType.fast, fontSize: 32 }}>
-                            {TimeFormatter.formateTimeNow(time.fast.real_start_time)}
-                        </Text>
-                    }
-                    {
-                        checkData && time.status == 'ONGOING2' && <View style={{ flexDirection: 'column', display: 'flex' }}>
-                            <Text className="clock_text" style={{ color: global.fastColor ? global.fastColor : global.fastColor ? global.fastColor : ColorType.fast, fontSize: 32 }}>
-                                {TimeFormatter.formateTimeNow(time.fast.real_start_time)}
-                            </Text>
-                            <Text className="clock_text" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep, fontSize: 32 }}>
-                                {TimeFormatter.formateTimeNow(time.sleep.real_start_time)}
-                            </Text>
-                        </View>
-                    }
-                    {
-                        checkData && time.status == 'ONGOING3' && <Text>
-                            <Text className="clock_text" style={{ color: global.fastColor ? global.fastColor : ColorType.fast, fontSize: 32 }}>
-                                {TimeFormatter.formateTimeNow(time.fast.real_start_time)}
-                            </Text>
-                        </Text>
-                    }
-                </View>
-                {
-                    showCover && <CoverView style={{
-                        display: 'flex', position: 'absolute',
-                        left: 0, right: 0, top: 0, bottom: 0, backgroundColor: 'transparent'
-                    }} />
-                }
-            </View>
-
-        </View>
-    )
-}

+ 0 - 118
src/features/trackTimeDuration/components/Console.scss

@@ -1,118 +0,0 @@
-@import '@/utils/common.scss';
-
-
-
-.counter_text {
-    font-size: 48px;
-    font-weight: 500;
-    text-align: center;
-    margin-top: 20px;
-    height: 72px;
-    line-height: 72px;
-    display: flex;
-    flex-shrink: 0;
-}
-
-.target_view {
-    height: 46px;
-    padding-left: 24px;
-    padding-right: 24px;
-    border-radius: 12px;
-    margin-bottom: 50px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-
-.target_text {
-    height: 46px;
-    line-height: 46px;
-    font-size: 20px;
-}
-
-.btn_bg {
-    margin-bottom: 12px;
-    display: flex;
-}
-
-.console_time_bg {
-    width: 578px;
-    background-color: transparent;
-    height: 128px;
-    border-radius: 36px;
-    display: flex;
-    flex-direction: column;
-    box-sizing: border-box;
-    align-items: center;
-    margin-bottom: 40px;
-}
-
-.console_time_item {
-    flex: 1;
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-}
-
-.console_time_value {
-    font-weight: 500;
-    font-size: 64px;
-    line-height: 64px;
-
-}
-
-.console_time_duration {
-    margin-top: 24px;
-    font-weight: 500;
-    font-size: 32px;
-    line-height: 32px;
-    opacity: 0.4;
-}
-
-.console_time_desc {
-    margin-top: 10px;
-    color: #fff;
-    opacity: 0.4;
-    font-size: 20px;
-    line-height: 20px;
-}
-
-.normal_fast_color {
-    color: $fastColor;
-}
-
-.normal_sleep_color {
-    color: $sleepColor;
-}
-
-/* #ifdef weapp */
-.timeout_fast_linear_color {
-    background: linear-gradient(90deg, $alertFastColor 0%, $alertColor 100%);
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-}
-
-.timeout_sleep_linear_color {
-    background: linear-gradient(90deg, $alertSleepColor 0%, $alertColor 100%);
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-}
-
-/* #endif */
-
-/* #ifdef rn */
-.timeout_fast_linear_color {
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-}
-
-.timeout_sleep_linear_color {
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-}
-
-/* #endif */

+ 0 - 617
src/features/trackTimeDuration/components/Console.tsx

@@ -1,617 +0,0 @@
-
-import { View, Text, PickerView, ScrollView } from "@tarojs/components";
-import { useEffect, useRef, useState } from "react";
-import { TimeFormatter } from "@/utils/time_format";
-import { useDispatch, useSelector } from "react-redux";
-import Taro from "@tarojs/taro";
-import LimitPickers from '@/components/input/LimitPickers';
-import { endFast, endSleep, startFast, startSleep } from "../actions/TrackTimeActions";
-import { durationDatas, durationIndex, getColor, getDurationTitle, getTimePickerTitle, getTitle, textAlpha, textNextStepAlpha } from "../hooks/Console";
-import PickerViews from "@/components/input/PickerViews";
-import Modal from "@/components/layout/Modal";
-import Stepper from "@/components/input/Stepper";
-import { EndFastBtn, EndSleepBtn, StartFastBtn, StartSleepBtn } from "@/features/common/SpecBtns";
-import Box from "@/components/layout/Box";
-import './Console.scss'
-import { ConsoleType, changeConsoleStatus } from "@/store/console";
-import { updateScenario } from "@/store/time";
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import { jumpPage } from "../hooks/Common";
-import { setFoodTabBadge } from "@/store/common";
-import { rpxToPx, vibrate } from "@/utils/tools";
-
-let useNavigation;
-let GradientText
-if (process.env.TARO_ENV == 'rn') {
-    GradientText = require('@/components/basic/GradientText').default
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-export default function Component(props: { isNextStep?: boolean }) {
-    const scenario = useSelector((state: any) => state.scenario);
-    const time = useSelector((state: any) => state.time);
-    const user = useSelector((state: any) => state.user);
-    const common = useSelector((state: any) => state.common);
-    const [isFast, setIsFast] = useState(true);
-    const [fastDuration, setFastDuration] = useState<number>(0);
-    const [sleepDuration, setSleepDuration] = useState<number>(0);
-
-    const [fastPickerValue, setFastPickerValue] = useState([0, 0])
-    const [sleepPickerValue, setSleepPickerValue] = useState([0, 0])
-    const [isLoaded, setIsLoaded] = useState(false)
-    const [showPageContainer, setShowPageContainer] = useState(false)
-    const limitPickerRef = useRef(null)
-    const durationPickerRef = useRef(null)
-    const { t } = useTranslation()
-    const dispatch = useDispatch();
-
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useEffect(() => {
-        getStateDetail();
-    }, [time.fast, time.sleep, time.status, time.scenario]);
-
-    function getStateDetail() {
-        if (time.fast) {
-            var fastCount = time.fast.target_end_time - time.fast.target_start_time
-            setFastDuration(fastCount)
-            setFastPickerValue(durationIndex(time.fast.target_start_time, time.fast.target_end_time, common))
-        }
-
-        if (time.sleep) {
-            var sleepCount = time.sleep.target_end_time - time.sleep.target_start_time
-            setSleepDuration(sleepCount)
-            setSleepPickerValue(durationIndex(time.sleep.target_start_time, time.sleep.target_end_time, common))
-        }
-        checkFastStatus()
-
-    }
-
-    function checkFastStatus() {
-        if (time.scenario == 'FAST') {
-            setIsFast(true)
-        }
-        else if (time.scenario == 'SLEEP') {
-            setIsFast(false)
-        }
-        else {
-            if (time.status == 'WAIT_FOR_START' || time.status == 'ONGOING3') {
-                setIsFast(true)
-            }
-            else {
-                setIsFast(false)
-            }
-        }
-        setIsLoaded(true)
-    }
-
-
-    function showPicker() {
-        // setShowPageContainer(true)
-        // return
-        if (global.testInfotimer) {
-            return
-        }
-        global.set_time = new Date().getTime()
-        updateNodeInfo()
-        if (!global.isDebug) {
-            return
-        }
-        global.testInfotimer = setInterval(() => {
-            updateNodeInfo()
-
-        }, 1000)
-
-    }
-
-    function pageContainerDetail() {
-        return layoutContent()
-    }
-
-    function updateNodeInfo() {
-        // var node = (<Modal testInfo={testLayout()} children={layoutContent()} dismiss={() => {
-        //     global.showClockModal(false, null);
-        //     hidePicker()
-        // }} confirm={() => {
-        //     hidePicker()
-        //     var picker = limitPickerRef.current;
-        //     pickerConfirm((picker as any).getConfirmData());
-        //     global.showClockModal(false, null);
-        // }} />);
-        // global.showClockModal(true, node);
-        var node = layoutContent()
-        global.showClockModal(true, node, testLayout());
-    }
-
-    function hidePicker() {
-        var node = layoutContent()
-        global.showClockModal(false, node, null);
-        if (global.testInfotimer) {
-            clearInterval(global.testInfotimer)
-            global.testInfotimer = null
-        }
-        else {
-            console.log('global test info timer')
-        }
-    }
-
-    function testLayout() {
-        if (!user.test_user) {
-            return <View />
-        }
-        if (!global.isDebug) {
-            return <View />
-        }
-        var isStart = false;
-        if (time.status == 'WAIT_FOR_START' || time.status == 'ONGOING1') {
-            isStart = true
-        }
-        var isFast = false;
-        switch (time.status) {
-            case 'WAIT_FOR_START':
-            case 'ONGOING':
-                {
-                    isFast = (scenario.name == 'FAST' || scenario.name == 'FAST_SLEEP')
-                }
-                break;
-            case 'ONGOING1':
-            case 'ONGOING2':
-                {
-                    isFast = false;
-                }
-                break
-            case 'ONGOING3':
-                {
-                    isFast = true;
-                }
-                break;
-        }
-
-        if (props.isNextStep) {
-            isFast = true
-            isStart = false
-        }
-
-        return <ScrollView scrollY>
-            <View style={{ color: '#fff', paddingLeft: 30, display: 'flex', flexDirection: 'column' }}>
-                <Text>check scenario:{isFast ? 'fast' : 'sleep'}</Text>
-                <Text>check type:{isStart ? 'start' : 'end'}</Text>
-                <Text style={{ marginTop: 10 }}>picker restriction</Text>
-                <Text style={{ marginLeft: 50 }}>min:{TimeFormatter.formatTimestamp(global.limit)}</Text>
-                <Text style={{ marginLeft: 50 }}>pick:{TimeFormatter.formatTimestamp(global.picker_time)}</Text>
-                <Text style={{ marginLeft: 50 }}>max{TimeFormatter.formatTimestamp(global.set_time)}</Text>
-                <Text style={{ marginTop: 10 }}>now:{TimeFormatter.formatTimestamp(new Date().getTime())}</Text>
-                <Text>elapsed:{TimeFormatter.calculateTimeDifference(global.picker_time, new Date().getTime())}</Text>
-                <Text style={{ marginTop: 10 }}>real start:{isStart ? '-' : TimeFormatter.formatTimestamp(isFast ? time.fast.real_start_time : time.sleep.real_start_time)}</Text>
-                <Text>real duration:{isStart ? '-' : TimeFormatter.calculateTimeDifference(isFast ? time.fast.real_start_time : time.sleep.real_start_time, new Date().getTime())}</Text>
-            </View>
-        </ScrollView>
-    }
-
-
-    function layoutContent() {
-        var limit = global.set_time - 7 * 3600 * 1000 * 24;
-        global.limit = limit
-
-        if (time.last_real_check_time) {
-            limit = time.last_real_check_time
-            global.limit = limit
-            //当set_time秒数<=latest_record_time秒数时,最小限制时间戳需+1分钟
-            if (new Date(global.set_time).getSeconds() <= new Date(time.last_real_check_time).getSeconds() && global.set_time - time.last_real_check_time > 60000) {
-                limit = limit + 60 * 1000
-            }
-        }
-
-        var title = getTimePickerTitle(time, t)
-        var color = getColor(time)
-        if (props.isNextStep) {
-            title = t('feature.track_time_duration.console.fast_end')
-            color = global.fastColor ? global.fastColor : ColorType.fast
-        }
-
-
-        return <View className="modal_content">
-            <LimitPickers ref={limitPickerRef} limit={limit} limitDay={8}
-                themeColor={color}
-                title={title}
-                onCancel={hidePicker} onChange={(e) => {
-                    pickerConfirm(e)
-                    hidePicker()
-                }} />
-        </View>
-    }
-
-    function showFoodGuide() {
-        dispatch(setFoodTabBadge(true))
-        if (process.env.TARO_ENV == 'weapp')
-            Taro.showModal({
-                title: '断食已结束',
-                content: '推荐使用『饮食日记』感知模式,记录你的餐前饥饿感',
-                showCancel: false,
-                confirmText: '我知道了'
-            })
-    }
-
-    function pickerConfirm(t: number) {
-        var date = new Date(t)
-        var setDate = new Date(global.set_time);
-        date.setMilliseconds(setDate.getMilliseconds());
-        date.setSeconds(setDate.getSeconds());
-
-        t = date.getTime();
-
-        if (props.isNextStep) {
-            endFast(t).then(res => {
-                showFoodGuide()
-            })
-            return;
-        }
-
-        global.postBtnUpdateStatus('normal');
-
-        if (isFast) {
-            if (time.status == 'WAIT_FOR_START') {
-                startFast(t, fastDuration).then(res => {
-
-                    if ((res as any).current_record.scenario == 'FAST_SLEEP' &&
-                        (res as any).current_record.status == 'ONGOING1') {
-                        global.consoleType = 'going'
-                        global.showSingleFastEnd()
-                        dispatch(changeConsoleStatus({ status: ConsoleType.going }));
-                    }
-                    dispatch(updateScenario((res as any).current_record));
-                    global.postBtnUpdateStatus('idle');
-                    dispatch(setFoodTabBadge(false))
-                });
-            }
-            else {
-                endFast(t).then(res => {
-                    dispatch(updateScenario((res as any).current_record));
-                    global.postBtnUpdateStatus('idle');
-                    showFoodGuide()
-                })
-            }
-        }
-        else {
-            if (time.status == 'WAIT_FOR_START' || time.status == 'ONGOING1') {
-                startSleep(t, sleepDuration).then(res => {
-                    dispatch(updateScenario((res as any).current_record));
-                    global.postBtnUpdateStatus('idle');
-                });
-            }
-            else {
-                endSleep(t).then(res => {
-                    dispatch(updateScenario((res as any).current_record));
-                    global.postBtnUpdateStatus('idle');
-                })
-            }
-        }
-    }
-
-    function mixedBtns() {
-        return <View className="btn_bg">
-            {
-                (time.status == 'WAIT_FOR_START' || time.status == 'DONE') &&
-                <StartFastBtn onClick={showPicker} />
-            }
-            {
-                (time.status == 'ONGOING' || time.status == 'ONGOING3') &&
-                <EndFastBtn onClick={showPicker} lowLight={time.fast.target_end_time > new Date().getTime()} />
-            }
-            {
-                time.status == 'ONGOING1' && <StartSleepBtn onClick={showPicker} />
-            }
-            {
-                time.status == 'ONGOING2' && <EndSleepBtn onClick={showPicker} lowLight={time.sleep.target_end_time > new Date().getTime()} />
-
-            }
-        </View>
-    }
-
-    function nextStepBtns() {
-        return <View className="btn_bg">
-            {
-                (time.status == 'WAIT_FOR_START') &&
-                <StartSleepBtn onClick={() => { vibrate() }} />
-            }
-            {
-                time.status == 'ONGOING1' && <EndFastBtn onClick={showPicker} lowLight={time.fast.target_end_time > new Date().getTime()} />
-            }
-            {
-                time.status == 'ONGOING2' && <EndFastBtn onClick={showPicker} lowLight={time.fast.target_end_time > new Date().getTime()} />
-
-            }
-        </View>
-    }
-
-
-    function fastBtns() {
-        return <View className="btn_bg">
-            {
-                time.status == 'ONGOING' ? <EndFastBtn onClick={showPicker} lowLight={textAlpha(time) != 1} /> : <StartFastBtn onClick={showPicker} />
-            }
-        </View>
-    }
-
-    function sleepBtns() {
-        return <View className="btn_bg">
-            {
-                time.status == 'ONGOING' ? <EndSleepBtn onClick={showPicker} lowLight={textAlpha(time) != 1} /> : <StartSleepBtn onClick={showPicker} />
-            }
-        </View>
-    }
-
-    function durationChange(e) {
-        var count = (e[0] + common.duration.min) * 60 + e[1] * common.duration.step
-        isFast ? setFastDuration(count * 60000) : setSleepDuration(count * 60000);
-        isFast ? setFastPickerValue(e) : setSleepPickerValue(e)
-        var node = durationPickerContent()
-        global.showClockModal2(false, node)
-    }
-
-    function login() {
-        jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-    }
-
-    function durationFormate() {
-        var t = isFast ? fastDuration / 60000 : sleepDuration / 60000
-        if (props.isNextStep) t = sleepDuration / 60000
-        var hour = Math.floor(t / 60)
-        var minute = Math.floor(t % 60)
-        var hourUnit = TimeFormatter.getHoursUnit(hour)
-        var minuteUnit = TimeFormatter.getMinutesUnit(minute)
-        return `${hour > 0 ? hour + hourUnit : ''}${minute > 0 ? minute + minuteUnit : ''}`
-    }
-
-    function showDurationPicker(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        // var node = <Modal children={durationPickerContent()} dismiss={() => global.showClockModal2(false, null)} confirm={() => {
-        //     var picker = durationPickerRef.current;
-        //     durationChange((picker as any).getConfirmData());
-        //     global.showClockModal2(false, null);
-        // }} />
-        var node = durationPickerContent()
-        global.showClockModal2(true, node);
-    }
-
-
-
-
-    function durationPickerContent() {
-        var color = getColor(time)
-        var title = getDurationTitle(time, 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={() => {
-                    global.showClockModal2(false, durationPickerContent());
-                }} />
-        </View>
-    }
-
-    function minus() {
-        if (isFast) {
-            var count = fastDuration - common.duration.step * 60 * 1000
-            count = count < 3600000 ? 3600000 : count
-
-            setFastDuration(count)
-            var hour = count / 60000 / 60
-            var minute = count / 60000 % 60
-
-            setFastPickerValue(durationIndex('00:00', `${hour > 10 ? hour : '0' + hour}:${minute > 10 ? minute : '0' + minute}`, common))
-        }
-        else {
-            var count = sleepDuration - common.duration.step * 60 * 1000
-            count = count < 3600000 ? 3600000 : count
-
-            setSleepDuration(count)
-            var hour = count / 60000 / 60
-            var minute = count / 60000 % 60
-
-            setSleepPickerValue(durationIndex('00:00', `${hour > 10 ? hour : '0' + hour}:${minute > 10 ? minute : '0' + minute}`, common))
-        }
-    }
-
-    function plus() {
-        if (isFast) {
-            var count = fastDuration + common.duration.step * 60 * 1000
-            count = count > 23 * 3600000 ? 23 * 3600000 : count
-
-            setFastDuration(count)
-            var hour = count / 60000 / 60
-            var minute = count / 60000 % 60
-
-            setFastPickerValue(durationIndex('00:00', `${hour > 10 ? hour : '0' + hour}:${minute > 10 ? minute : '0' + minute}`, common))
-        }
-        else {
-            var count = sleepDuration + common.duration.step * 60 * 1000
-
-            count = count > 23 * 3600000 ? 23 * 3600000 : count
-
-            setSleepDuration(count)
-            var hour = count / 60000 / 60
-            var minute = count / 60000 % 60
-
-            setSleepPickerValue(durationIndex('00:00', `${hour > 10 ? hour : '0' + hour}:${minute > 10 ? minute : '0' + minute}`, common))
-        }
-    }
-
-    function disableMinus() {
-        if (isFast) {
-            if (fastDuration <= 60 * 60 * 1000) {
-                return true;
-            }
-        }
-        else {
-            if (sleepDuration <= 60 * 60 * 1000) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    function disablePlus() {
-        if (isFast) {
-            if (fastDuration >= 23 * 60 * 60 * 1000) {
-                return true;
-            }
-        }
-        else {
-            if (sleepDuration >= 23 * 60 * 60 * 1000) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    function consoleTimeText(time) {
-        if (process.env.TARO_ENV == 'rn' && textNextStepAlpha(time) == 1) {
-            return <GradientText style={{ fontSize: rpxToPx(64), fontWeight: 'bold' }} end={ColorType.alert}>{TimeFormatter.countdown(time.fast.target_end_time)}</GradientText>
-        }
-        return <Text className={textNextStepAlpha(time) == 1 ?
-            'console_time_value  timeout_fast_linear_color' :
-            'console_time_value normal_fast_color'}
-            style={{
-                opacity: textNextStepAlpha(time) == 1 ? 1 : 0.8
-            }}>
-            {TimeFormatter.countdown(time.fast.target_end_time)}</Text>
-    }
-
-    var textColor = getColor(time)
-    if (time.status != 'ONGOING1' && time.status != 'WAIT_FOR_START') {
-        if (textAlpha(time) == 1) {
-            textColor = '#FA5151';
-        }
-    }
-
-    if (!user.isLogin) {
-        return <View style={{ display: 'flex', flexDirection: 'column', width: '100%', alignItems: 'center' }}>
-            <Text>16:00</Text>
-            <Text style={{ color: global.fastColor ? global.fastColor : ColorType.fast }} onClick={login}>Start Fast</Text>
-        </View>
-    }
-
-    if (props.isNextStep) {
-        return <Box style={{ marginBottom: 0 }}>
-            <View style={{
-                display: 'flex', flexDirection: 'column', alignItems: 'center', flexShrink: 0,
-                opacity: time.status == 'WAIT_FOR_START' ? 0.4 : 1,
-                pointerEvents: time.status == 'WAIT_FOR_START' ? 'none' : 'all'
-            }}>
-                {
-                    (time.status == 'WAIT_FOR_START') && <Stepper children={
-                        <Text className="stepper_text" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep, opacity: textAlpha(time) }} onClick={() => { vibrate() }}>{durationFormate()}</Text>
-                    } minus={minus} plus={plus}
-                        themeColor={global.sleepColor ? global.sleepColor : ColorType.sleep} disableMinus={disableMinus()} disablePlus={disablePlus()} />
-                }
-                {
-                    (time.status == 'ONGOING1' || time.status == 'ONGOING2') &&
-                    <View className="console_time_bg">
-                        {consoleTimeText(time)}
-                        <Text className="console_time_duration" style={{ color: global.fastColor ? global.fastColor : ColorType.fast, opacity: 0.4 }}>{
-                            TimeFormatter.calculateTimeDifference(time.fast.target_start_time,
-                                time.fast.target_end_time, true)}</Text>
-
-
-
-                    </View>
-                }
-
-                <View>
-                    {
-                        nextStepBtns()
-                    }
-                </View>
-            </View>
-        </Box>
-    }
-
-    function getClassName(isFast) {
-        if (isFast) {
-            if (textAlpha(time) == 1) {
-                return 'console_time_value  timeout_fast_linear_color'
-            }
-            else {
-                return 'console_time_value normal_fast_color'
-            }
-
-        }
-        else {
-            if (textAlpha(time) == 1) {
-                return 'console_time_value timeout_sleep_linear_color'
-            }
-            else {
-                return 'console_time_value normal_sleep_color'
-            }
-        }
-    }
-
-    function onGoingText(isFastData) {
-        var className = getClassName(isFastData)
-        if (process.env.TARO_ENV == 'rn' && className.indexOf('linear') != -1) {
-            return <GradientText style={{ fontSize: rpxToPx(64), fontWeight: 'bold' }} start={isFastData ? ColorType.fast : ColorType.sleep} end={ColorType.alert}>{isFastData ?
-                TimeFormatter.countdown(time.fast.target_end_time) :
-                TimeFormatter.countdown(time.sleep.target_end_time)}</GradientText>
-        }
-        return <Text className={className} style={{ opacity: textAlpha(time) == 1 ? 1 : 0.8 }}>{isFastData ?
-            TimeFormatter.countdown(time.fast.target_end_time) :
-            TimeFormatter.countdown(time.sleep.target_end_time)}</Text>
-    }
-
-    function ongoing() {
-        if (time.status == 'ONGOING' || time.status == 'ONGOING2' || time.status == 'ONGOING3') {
-            var isFastData = time.scenario == 'FAST' || time.status == 'ONGOING3'
-            var duration = TimeFormatter.calculateTimeDifference(isFastData ? time.fast.target_start_time : time.sleep.target_start_time,
-                isFast ? time.fast.target_end_time : time.sleep.target_end_time, true);
-            return <View className="console_time_bg">
-                {
-                    onGoingText(isFastData)
-                }
-                <Text className="console_time_duration" style={{ color: isFastData ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep, opacity: 0.4 }}>{duration}</Text>
-            </View>
-        }
-        return <View />
-    }
-    return (
-        <Box style={{ marginBottom: 0 }}>
-            <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', flexShrink: 0, }}>
-                {
-                    isLoaded && ongoing()
-                }
-                {
-                    (time.status == 'ONGOING1' || time.status == 'WAIT_FOR_START') && <Stepper children={
-                        <Text className="stepper_text" style={{ color: textColor, opacity: textAlpha(time) }}
-                            onClick={showDurationPicker}
-                        >{durationFormate()}</Text>
-                    } minus={minus} plus={plus}
-                        themeColor={isFast ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep} disableMinus={disableMinus()} disablePlus={disablePlus()} />
-                }
-
-                <View>
-                    {
-                        time.scenario === 'FAST_SLEEP' && mixedBtns()
-                    }
-                    {
-                        time.scenario === 'FAST' && fastBtns()
-                    }
-                    {
-                        time.scenario === 'SLEEP' && sleepBtns()
-                    }
-                </View>
-            </View>
-        </Box>
-    )
-}

+ 0 - 57
src/features/trackTimeDuration/components/DayLight.scss

@@ -1,57 +0,0 @@
-.daylight_row {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    justify-content: space-between;
-    box-sizing: border-box;
-    margin-left: 46px;
-    margin-right: 46px;
-}
-
-.daylight_note {
-    display: flex;
-    flex-direction: column;
-    color: #fff;
-    opacity: 0.4;
-    margin-top: 10px;
-    margin-left: 46px;
-    margin-right: 46px;
-    font-size: 24px;
-}
-
-.become_vip {
-    margin-left: 46px;
-    margin-right: 46px;
-    background: linear-gradient(90deg, #2F66E5 0%, #8961F5 100%);
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    border-radius: 42px;
-    height: 84px;
-    margin-top: 40px;
-}
-
-.daylight_item {
-    display: flex;
-    flex-direction: row;
-    margin-left: 46px;
-    margin-right: 46px;
-    box-sizing: border-box;
-    align-items: center;
-}
-
-.daylight_arrow {
-    width: 60px;
-    height: 60px;
-}
-
-.address {
-    display: -webkit-box;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    -webkit-box-orient: vertical;
-    -webkit-line-clamp: 1;
-    white-space: normal;
-    width: 240px;
-    text-align: right;
-}

+ 0 - 334
src/features/trackTimeDuration/components/DayLight.tsx

@@ -1,334 +0,0 @@
-import { useEffect, useState } from 'react'
-import './DayLight.scss'
-import { View, Text, Switch, Image } from '@tarojs/components'
-import Taro from '@tarojs/taro'
-import { useDispatch, useSelector } from 'react-redux'
-import { updateMember } from '@/store/day'
-import { systemLocation } from '@/services/common'
-import { clearLocation, getPerm, latestLocation, uploadPerm } from '@/services/user'
-import { TimeFormatter } from '@/utils/time_format'
-import { ColorType } from '@/context/themes/color'
-import { rpxToPx } from '@/utils/tools'
-import { useTranslation } from 'react-i18next'
-export default function DayLight() {
-    const [showRing, setShowRing] = useState(false)
-    const [isTomorrow, setIsTomorrow] = useState(false)
-    const [isMember, setIsMember] = useState(false)
-    const [isNight, setIsNight] = useState(false)
-    const [authInfo, setAuthInfo] = useState(null)
-    const [sunriseTime, setSunriseTime] = useState('06:00')
-    const [sunsetTime, setSunsetTime] = useState('18:00')
-    const [showLocatin, setShowLocation] = useState(true)
-    const dayNight = useSelector((state: any) => state.dayNight);
-    const user = useSelector((state: any) => state.user);
-    const {t} = useTranslation()
-    const dispatch = useDispatch();
-
-    useEffect(() => { getContent() }, [])
-
-    useEffect(() => {
-        setIsMember(user.test_user)
-        if (authInfo)
-            dispatch(updateMember({ isMember: user.test_user, gpsInfo: authInfo }))
-        if (user.test_user && authInfo) {
-            if ((authInfo as any).daylights.length == 1) {
-                setSunriseTime((authInfo as any).daylights[0].sunrise)
-            }
-            else {
-                setSunriseTime((authInfo as any).daylights[1].sunrise)
-            }
-
-            setSunsetTime((authInfo as any).daylights[0].sunset)
-        }
-        else {
-            setSunriseTime('06:00')
-            setSunsetTime('18:00')
-        }
-    }, [user.test_user, authInfo])
-
-    useEffect(() => {
-        latestLocation().then(data => {
-            if ((data as any).lat) {
-                (data as any).latitude = (data as any).lat;
-                (data as any).longitude = (data as any).lng;
-                setAuthInfo(data as any)
-
-                if ((data as any).daylights.length == 1) {
-                    setSunriseTime((data as any).daylights[0].sunrise)
-                }
-                else {
-                    setSunriseTime((data as any).daylights[1].sunrise)
-                }
-                setSunsetTime((data as any).daylights[0].sunset)
-                Taro.setStorage({
-                    key: 'gps',
-                    data: JSON.stringify(data as any)
-                })
-                dispatch(updateMember({ isMember: user.test_user, gpsInfo: (data as any) }))
-            }
-        })
-
-        if (user.isLogin) {
-            getPerm({}).then(res => {
-                setShowRing((res as any).show_night_ring)
-            })
-        }
-    }, [user.isLogin])
-
-    async function getStorage(key: string) {
-        try {
-            const res = await Taro.getStorage({ key });
-            return res.data;
-        } catch {
-            return '';
-        }
-    }
-
-    async function getContent() {
-        const isShow = await getStorage('showLightRing') || false
-        setShowRing(isShow)
-
-        const hideLocation = await getStorage('hideLocation') || false
-        setShowLocation(!hideLocation)
-
-        global.showNightRing = isShow
-        global.refreshIndex()
-        setTimeout(()=>{
-            global.refreshIndex()
-        },200)
-
-        const gpsInfo = await getStorage('gps') || null
-        if (gpsInfo) {
-            setAuthInfo(JSON.parse(gpsInfo))
-            dispatch(updateMember({ isMember: user.test_user, gpsInfo: JSON.parse(gpsInfo) }))
-        }
-        else {
-            setAuthInfo(null)
-        }
-
-
-        checkData()
-    }
-
-
-    function checkData() {
-        var date = new Date()
-        var minutes = date.getHours() * 60 + date.getMinutes()
-        var riseMinutes = parseInt(sunriseTime.split(':')[0]) * 60 + parseInt(sunriseTime.split(':')[1])
-        var setMinutes = parseInt(sunsetTime.split(':')[0]) * 60 + parseInt(sunsetTime.split(':')[1])
-        if (minutes >= riseMinutes && minutes < setMinutes) {
-            setIsNight(false)
-        }
-        else {
-            setIsNight(true)
-        }
-        if (minutes >= setMinutes) {
-            setIsTomorrow(true)
-        }
-        else {
-            setIsTomorrow(false)
-        }
-    }
-
-    function buy() {
-        Taro.navigateTo({
-            url: '/pages/account/Member'
-        })
-    }
-
-    function auth() {
-        Taro.chooseLocation({
-            success: function (res) {
-                console.log(res)
-                var today = new Date()
-                var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000)
-                var strToday = `${today.getFullYear()}-${TimeFormatter.padZero(today.getMonth() + 1)}-${TimeFormatter.padZero(today.getDate())}`
-                var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-
-                systemLocation({ lat: res.latitude, lng: res.longitude, date_start: strToday, date_end: strTomorrow }).then(data => {
-                    console.log(data);
-                    (data as any).latitude = res.latitude;
-                    (data as any).longitude = res.longitude;
-                    setAuthInfo(data as any)
-                    setSunriseTime((data as any).daylights[1].sunrise)
-                    setSunsetTime((data as any).daylights[0].sunset)
-                    Taro.setStorage({
-                        key: 'gps',
-                        data: JSON.stringify(data as any)
-                    })
-                    dispatch(updateMember({ isMember: user.test_user, gpsInfo: (data as any) }))
-                })
-
-            },
-            fail(res) {
-                Taro.showToast({
-                    title: '位置修改失败!\n请重新选择就近位置',
-                    icon: 'none'
-                })
-            },
-        })
-
-    }
-
-    function getLocation(){
-        if ((authInfo as any).address.city.length>0){
-            return (authInfo as any).address.city
-        }
-        if ((authInfo as any).address.province.length>0){
-            return (authInfo as any).address.province
-        }
-        if ((authInfo as any).address.country.length>0){
-            return (authInfo as any).address.country
-        }
-        return t('feature.track_time_duration.third_ring.unknown')
-
-    }
-
-    function clearData() {
-        Taro.showModal({
-            title: '提示',
-            content: '确认清除位置数据?',
-            success: function (res) {
-                if (res.confirm) {
-                    clearLocation().then(res => {
-                        Taro.removeStorage({ key: 'gps' })
-                        setAuthInfo(null)
-                        dispatch(updateMember({ isMember: user.test_user, gpsInfo: null }))
-                    })
-                } else if (res.cancel) {
-                    console.log('用户点击取消')
-                }
-            }
-        })
-    }
-
-
-    var split = new Date().toString().split(' ');
-    var timezone = split[split.length - 2];
-
-
-
-    return <View>
-        <View className='cell_bg'>
-            <View className='cell_full'>
-                <Text className="cell_title">{t('feature.track_time_duration.third_ring.night_ring')}</Text>
-                <Switch checked={showRing}
-                    color={ColorType.night}
-                    onChange={(e) => {
-                        setShowRing(e.detail.value)
-                        global.showNightRing = e.detail.value
-                        global.refreshIndex()
-                        Taro.setStorage({
-                            key: 'showLightRing',
-                            data: e.detail.value
-                        })
-
-                        uploadPerm({ show_night_ring: e.detail.value })
-                    }}
-                />
-            </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">{sunsetTime}</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.sunrise_tomorrow')}</Text>
-                    <Text className="cell_value">{sunriseTime}</Text>
-                </View>
-            }
-        </View>
-        {
-            showRing && <Text className='cell_footer' >{
-                !isMember ? t('feature.track_time_duration.third_ring.member_desc'):
-                    authInfo ? t('feature.track_time_duration.third_ring.base_location_desc'):
-                    t('feature.track_time_duration.third_ring.enter_location_desc')
-            }</Text>
-        }
- 
-        {
-            showRing && <View style={{marginTop:rpxToPx(40)}}>
-
-
-
-                {/* <Text className='daylight_note'>{isMember && authInfo ? 'Calculated based on your location.' : 'Sunset and sunrise times are global average. For actual times at your location, join our Pro program.'}</Text> */}
-                {
-                    isMember ? <View className="cell_bg">
-                        {
-                            showLocatin && <View className="cell_full" onClick={auth}>
-                                <Text className="cell_title">{t('feature.track_time_duration.third_ring.location')}</Text>
-                                <Text className="cell_value">{authInfo ? getLocation() : t('feature.track_time_duration.third_ring.enter')}</Text>
-                                <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-                            </View>
-                        }
-                        {
-                            authInfo && showLocatin && <View className="cell_line" style={{ height: 1 }} />
-                        }
-
-                        {
-                            authInfo && showLocatin && <View className="cell_full" >
-                                <Text className="cell_title">{t('feature.track_time_duration.third_ring.latitude')}</Text>
-
-                                <Text className="cell_value">{(authInfo as any).latitude}</Text>
-
-
-                            </View>
-                        }
-                        {
-                            authInfo && showLocatin && <View className="cell_line" style={{ height: 1 }} />
-                        }
-                        {
-                            authInfo && showLocatin && <View className="cell_full">
-                                <Text className="cell_title" >{t('feature.track_time_duration.third_ring.longitude')}</Text>
-
-                                <Text className="cell_value">{(authInfo as any).longitude}</Text>
-
-                            </View>
-                        }
-                        {
-                            authInfo && showLocatin && <View className="cell_line" style={{ height: 1 }} />
-                        }
-                        {
-                            authInfo && showLocatin && <View className="cell_full">
-                                <Text className="cell_title">{t('feature.track_time_duration.third_ring.timezone')}</Text>
-
-                                <Text className="cell_value">{timezone}</Text>
-
-                            </View>
-                        }
-
-
-                    </View> :
-                        <View className='become_vip' onClick={buy}>
-                            <Text style={{ color: '#000' }}>{t('feature.common.become_pro')}</Text>
-                        </View>
-                }
-
-                {
-                    authInfo && <Text className='cell_footer' onClick={() => {
-                        var enable = !showLocatin
-                        setShowLocation(enable)
-                        Taro.setStorage({
-                            key: 'hideLocation',
-                            data: !enable
-                        })
-                    }}>{showLocatin ? 'Hide my location' : 'Show my location'}</Text>
-                }
-                {
-                    authInfo && showLocatin && user.test_user && <Text className='cell_footer' onClick={clearData}>清除位置数据</Text>
-                }
-
-            </View>
-        }
-
-    </View>
-
-}

+ 0 - 1118
src/features/trackTimeDuration/components/DayNightCard的副本.tsx

@@ -1,1118 +0,0 @@
-import { PageContainer, Switch, Text, View } from '@tarojs/components'
-import './DayNightCard.scss'
-import { ColorType } from '@/context/themes/color'
-import { useEffect, useState } from 'react'
-import Box from '@/components/layout/Box'
-import Taro, { useDidShow } from '@tarojs/taro'
-import { clearLocation, getPerm, latestLocation, uploadPerm } from '@/services/user'
-import { useDispatch, useSelector } from 'react-redux'
-import { useTranslation } from 'react-i18next'
-import { TimeFormatter } from '@/utils/time_format'
-import { systemLocation } from '@/services/common'
-import { setDayRingData, showDay } from '@/store/day'
-import { setNightRingData, showNight, updateMember } from '@/store/night'
-import Modal from '@/components/layout/Modal.weapp'
-import { rpxToPx } from '@/utils/tools'
-import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
-import DayNightDetailPopup from './DayNightDetailPopup'
-import { IconDay, IconInfo, IconNight } from '@/components/basic/Icons'
-
-let useNavigation;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-let locationDetail;
-
-let sunriseA = new Date()
-sunriseA.setHours(6)
-sunriseA.setMinutes(0)
-sunriseA.setSeconds(0)
-sunriseA.setMilliseconds(0)
-const sunsetA = new Date()
-sunsetA.setHours(18)
-sunsetA.setMinutes(0)
-sunsetA.setSeconds(0)
-sunsetA.setMilliseconds(0)
-
-const sunriseB = new Date()
-sunriseB.setHours(6)
-sunriseB.setMinutes(0)
-sunriseB.setSeconds(0)
-sunriseB.setMilliseconds(0)
-
-let lastDayInfo: any = null;
-let lastNightInfo: any = null;
-let joingMember = false
-export default function DayNightCard(props: { isNight: boolean, count: number }) {
-    const user = useSelector((state: any) => state.user);
-    const dayStore = useSelector((state: any) => state.day);
-    const nightStore = useSelector((state: any) => state.night);
-    const [authInfo, setAuthInfo] = useState(global.locationDetail ? global.locationDetail : null)
-    const [sunriseTime, setSunriseTime] = useState('06:00')
-    const [sunriseTmrTime, setSunriseTmrTime] = useState('06:00')
-    const [sunsetTime, setSunsetTime] = useState('18:00')
-
-    const [sunriseDate, setSunriseDate] = useState<any>(sunriseA)
-    const [sunriseTmrDate, setSunriseTmrDate] = useState<any>(new Date(sunriseB.getTime() + 24 * 3600 * 1000))
-    const [sunsetDate, setSunsetDate] = useState<any>(sunsetA)
-
-
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [showDetailPopup, setShowDetailPopup] = useState(false)
-    // const [locationDetail, setLocationDetail] = useState(null)
-
-    const [nightDate, setNightDate] = useState(new Date())
-    const [dayDate, setDayDate] = useState(new Date())
-    const dispatch = useDispatch();
-    const { t } = useTranslation()
-    const isMember = true;
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useEffect(() => {
-
-
-        if (user.isLogin) {
-            if (global.locationDetail) {
-                locationDetail = global.locationDetail
-                setAuthInfo(locationDetail)
-            }
-
-            var today = new Date()
-            var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-            var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 3)
-            var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-            var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-            latestLocation({
-                date_start: strYesterday, date_end: strTomorrow
-            }).then(data => {
-                setAuthInfo(data as any)
-                updateDate(data)
-                locationDetail = data
-                global.locationDetail = locationDetail
-                Taro.setStorage({
-                    key: 'gps',
-                    data: JSON.stringify(data as any)
-                })
-            })
-
-        } else {
-            setSunriseTime('06:00');
-            setSunriseTmrTime('06:00')
-            setSunsetTime('18:00')
-            setSunriseDate(sunriseA)
-            setSunriseTmrDate(new Date(sunriseB.getTime() + 24 * 3600 * 1000))
-            setSunsetDate(sunsetA)
-        }
-    }, [user.isLogin])
-
-    useEffect(() => {
-        locationDetail = global.locationDetail
-        setAuthInfo(locationDetail)
-    }, [global.locationDetail])
-
-    useEffect(() => {
-        if (locationDetail)
-            updateDate(locationDetail)
-        if (props.isNight) {
-            global.clearNightLocation = () => {
-                clearCacheData()
-            }
-        }
-        else {
-            global.clearDayLocation = () => {
-                clearCacheData()
-            }
-        }
-    }, [])
-
-    useEffect(() => {
-        if (locationDetail) {
-            var detail: any = locationDetail
-            var now = new Date()
-            if (now.getHours() == 0 && now.getMinutes() == 0 && now.getSeconds() == 0) {
-                detail.daylights.splice(0, 1)
-            }
-            locationDetail = detail
-
-            // setLocationDetail(detail)
-            updateDate(detail)
-        }
-    }, [props.count])
-
-    useEffect(() => {
-        // if (user.test_user && joingMember) {
-        //     auth()
-        // }
-        if (!isMember) {
-            lastNightInfo = null
-            lastDayInfo = null
-            locationDetail = null
-            setAuthInfo(null)
-            setSunriseTime('06:00')
-            setSunriseTmrTime('06:00')
-            setSunsetTime('18:00')
-            dispatch(updateMember({ isMember: isMember, gpsInfo: null }))
-
-
-            dispatch(setDayRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            dispatch(setNightRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-        }
-        else {
-            var gps = Taro.getStorageSync('gps')
-            if (gps) {
-                locationDetail = JSON.parse(gps)
-                global.locationDetail = JSON.parse(gps)
-            }
-        }
-    }, [user.test_user])
-
-    function updateDate(data) {
-
-        var today = new Date()
-        // var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-        var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000)
-        // var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-        // var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-        if (isMember && data && data.daylights && data.daylights.length > 0) {
-            var yesterdayDate = new Date(data.daylights[0].date + 'T' + data.daylights[0].sunset)
-            var todaySunriseDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunrise)
-            var todaySunsetDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunset)
-            var tomorrowSunriseDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunrise)
-            var tomorrowSunsetDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunset)
-
-            // var tomorrowSunsetDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunset)
-            //今天凌晨日出前
-            if (yesterdayDate.getTime() < today.getTime() && today.getTime() < todaySunriseDate.getTime()) {
-                setNightDate(yesterdayDate)
-                setDayDate(today)
-                if (props.isNight) {
-                    setSunsetTime(data.daylights[0].sunset)
-                    setSunriseTmrTime(data.daylights[1].sunrise)
-                    setSunsetDate(yesterdayDate)
-                    setSunriseTmrDate(todaySunriseDate)
-
-                }
-                else {
-                    setSunriseTime(data.daylights[1].sunrise)
-                    setSunsetTime(data.daylights[1].sunset)
-                    setSunriseDate(todaySunriseDate)
-                    setSunsetDate(todaySunsetDate)
-                }
-                updateNightStore(yesterdayDate, data.daylights[1].sunrise, data.daylights[0].sunset)
-                updateDayStore(today, data.daylights[1].sunrise, data.daylights[1].sunset)
-            }
-            //今天白天(今天出日后-日落前)
-            else if (todaySunriseDate.getTime() < today.getTime() && today.getTime() < todaySunsetDate.getTime()) {
-                setNightDate(todaySunsetDate)
-                setDayDate(todaySunriseDate)
-                if (props.isNight) {
-                    setSunsetTime(data.daylights[1].sunset)
-                    setSunriseTmrTime(data.daylights[2].sunrise)
-                    setSunsetDate(todaySunsetDate)
-                    setSunriseTmrDate(tomorrowSunriseDate)
-                }
-                else {
-                    setSunriseTime(data.daylights[1].sunrise)
-                    setSunsetTime(data.daylights[1].sunset)
-                    setSunsetDate(todaySunsetDate)
-                    setSunriseDate(todaySunriseDate)
-                }
-                updateNightStore(today, data.daylights[2].sunrise, data.daylights[1].sunset)
-                updateDayStore(today, data.daylights[1].sunrise, data.daylights[1].sunset)
-            }
-            //今天夜晚
-            else if (today.getTime() > todaySunsetDate.getTime() && today.getTime() < tomorrowSunriseDate.getTime()) {
-                setNightDate(todaySunsetDate)
-                setDayDate(tomorrowSunriseDate)
-                if (props.isNight) {
-                    setSunsetTime(data.daylights[1].sunset)
-                    setSunriseTmrTime(data.daylights[2].sunrise)
-                    setSunsetDate(todaySunsetDate)
-                    setSunriseTmrDate(tomorrowSunriseDate)
-                }
-                else {
-                    setSunriseTime(data.daylights[2].sunrise)
-                    setSunsetTime(data.daylights[2].sunset)
-                    setSunriseDate(tomorrowSunriseDate)
-                    setSunsetDate(tomorrowSunsetDate)
-                }
-                updateNightStore(today, data.daylights[2].sunrise, data.daylights[1].sunset)
-                updateDayStore(tomorrowSunriseDate, data.daylights[2].sunrise, data.daylights[2].sunset)
-            }
-        }
-        else {
-            locationDetail = null
-            setAuthInfo(null)
-            setSunriseTime('06:00')
-            setSunriseTmrTime('06:00')
-            setSunsetTime('18:00')
-            dispatch(updateMember({ isMember: isMember, gpsInfo: null }))
-
-
-            dispatch(setDayRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            dispatch(setNightRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-        }
-
-    }
-
-    function updateNightStore(date, sunrise, sunset) {
-        if (lastNightInfo && lastNightInfo.date.getDate() == new Date(date).getDate() &&
-            lastNightInfo.sunrise == sunrise &&
-            lastNightInfo.sunset == sunset
-        ) {
-            return
-        }
-        debugger
-        lastNightInfo = {
-            date,
-            sunrise,
-            sunset
-        }
-        dispatch(setNightRingData({
-            date: date.getTime(),
-            sunrise: sunrise,
-            sunset: sunset
-        }))
-    }
-
-    function updateDayStore(date, sunrise, sunset) {
-        if (lastDayInfo && lastDayInfo.date.getDate() == new Date(date).getDate() &&
-            lastDayInfo.sunrise == sunrise &&
-            lastDayInfo.sunset == sunset
-        ) {
-            return
-        }
-        lastDayInfo = {
-            date,
-            sunrise,
-            sunset
-        }
-        dispatch(setDayRingData({
-            date: date.getTime(),
-            sunrise: sunrise,
-            sunset: sunset
-        }))
-    }
-
-    async function getStorage(key: string) {
-        try {
-            const res = await Taro.getStorage({ key });
-            return res.data;
-        } catch {
-            return '';
-        }
-    }
-
-    function footer(e) {
-        return <View className='day_night_card_footer' onClick={tapFooter}>
-            <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }}>{
-                // !isMember ? t('feature.track_time_duration.third_ring.member_desc') :
-                authInfo && (authInfo as any).lat ? t('feature.track_time_duration.third_ring.base_location_desc') :
-                    t('feature.track_time_duration.third_ring.enter_location_desc')
-            }</Text>
-            {
-                authInfo && (authInfo as any).lat && <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }} onClick={(e) => {
-                    e.stopPropagation()
-                    auth(e)
-                }}>Edit Location</Text>
-            }
-        </View>
-    }
-
-    function tapFooter(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        if (props.isNight && !nightStore.showNightRing || !props.isNight && !dayStore.showDayRing) {
-            return
-        }
-        var list = ['Current location Info',
-            'Choose a new location']
-        if (isMember) {
-            list.push('clear location data')
-        }
-        Taro.showActionSheet({
-            itemList: list
-        }).then(res => {
-            switch (res.tapIndex) {
-                case 0:
-                    setShowDetailModal(true)
-                    break
-                case 1:
-                    auth()
-                    break;
-                case 2:
-                    clearData()
-                    break;
-            }
-        })
-    }
-
-    function tapCard(e) {
-        // if (process.env.TARO_ENV == 'weapp') {
-        //     e.stopPropagation()
-        // }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        if (!dayStore.showDayRing) {
-            return
-        }
-        setShowDetailPopup(true)
-    }
-
-    function auth(e?: any) {
-        if (e && process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        joingMember = false;
-        Taro.chooseLocation({
-            latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
-            longitude: authInfo && authInfo.lat ? authInfo.lng : undefined,
-            success: function (res) {
-                var today = new Date()
-                var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-                var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 3)
-                var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-                var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-                systemLocation({
-                    lat: res.latitude,
-                    lng: res.longitude,
-                    name: res.name,
-                    address: res.address,
-                    date_start: strYesterday,
-                    date_end: strTomorrow,
-                    coordinate_system_standard: 'GCJ-02'
-                }).then(data => {
-                    updateDate(data);
-                    locationDetail = data;
-                    global.locationDetail = locationDetail
-                    setAuthInfo(data as any)
-                    setSunriseTime((data as any).daylights[0].sunrise)
-                    setSunriseTmrTime((data as any).daylights[1].sunrise)
-                    setSunsetTime((data as any).daylights[0].sunset)
-                    Taro.setStorage({
-                        key: 'gps',
-                        data: JSON.stringify(data as any)
-                    })
-                    dispatch(updateMember({ isMember: isMember, gpsInfo: (data as any) }))
-                })
-
-            },
-            fail(res) {
-                Taro.showToast({
-                    title: '位置修改失败!\n请重新选择就近位置',
-                    icon: 'none'
-                })
-            },
-        })
-
-    }
-
-    function getLocation() {
-        var city = ''
-        if ((authInfo as any).address.city.length > 0) {
-            city = (authInfo as any).address.city
-        }
-        else if ((authInfo as any).address.province.length > 0) {
-            city = (authInfo as any).address.province
-        }
-        else if ((authInfo as any).address.country.length > 0) {
-            city = (authInfo as any).address.country
-        }
-        else {
-            city = t('feature.track_time_duration.third_ring.unknown')
-        }
-        // return city +' | '+parseInt(authInfo.lat)+'°'+ ' '+parseInt(authInfo.lng)
-        return `${city} | ${Math.abs(parseInt(authInfo.lat))}°${parseInt(authInfo.lat) < 0 ? 'S' : 'N'} ${Math.abs(parseInt(authInfo.lng))}°${parseInt(authInfo.lng) < 0 ? 'W' : 'E'}`
-    }
-
-    function lowTimeColor() {
-        var now = new Date()
-        if (props.isNight) {
-            if (now.getTime() < sunsetDate.getTime() && now.getTime() > sunriseDate.getTime()) {
-                return true
-            }
-            return false
-        } else {
-
-            if (now.getTime() > sunriseDate.getTime() && now.getTime() < sunsetDate.getTime()) {
-                return false
-            }
-            return true
-
-
-        }
-    }
-
-    function timeCount() {
-        var now = new Date()
-        if (props.isNight) {
-            if (now.getTime() < sunriseTmrDate.getTime()) {
-                return TimeFormatter.countdown(sunsetDate.getTime())
-            }
-            return TimeFormatter.countdown(sunsetDate.getTime())
-        } else {
-
-            if (now.getTime() < sunsetDate.getTime()) {
-                return TimeFormatter.countdown(sunriseDate.getTime())
-            }
-            return TimeFormatter.countdown(sunriseTmrDate.getTime())
-
-
-        }
-    }
-
-    function timeCount2() {
-        var now = new Date()
-        if (props.isNight) {
-
-            if (now.getTime() < sunsetDate.getTime()) {
-                return TimeFormatter.countdown(sunriseTmrDate.getTime())
-            }
-            return TimeFormatter.countdown(sunriseTmrDate.getTime())
-
-        } else {
-            return TimeFormatter.countdown(sunsetDate.getTime())
-        }
-    }
-
-    function showExtraData() {
-        var now = new Date()
-        if (props.isNight) {
-            if (sunsetDate.getTime() > now.getTime()) {
-                return false
-            }
-            return true
-        }
-        if (sunriseDate.getTime() < now.getTime() && now.getTime() < sunsetDate.getTime()) {
-            return true;
-        }
-        return false
-    }
-
-    function timeDesc() {
-        var now = new Date()
-        if (props.isNight) {
-            var list = sunsetTime.split(':')
-            var hour = parseInt(list[0])
-            var min = parseInt(list[1])
-            var second = list.length == 3 ? parseInt(list[2]) : 0
-            now.setHours(hour)
-            now.setMinutes(min)
-            now.setSeconds(second)
-
-            var sunriseDate = new Date()
-            var list2 = sunriseTmrTime.split(':')
-            var hour2 = parseInt(list2[0])
-            var min2 = parseInt(list2[1])
-            var second2 = list2.length == 3 ? parseInt(list2[2]) : 0
-            sunriseDate.setHours(hour2)
-            sunriseDate.setMinutes(min2)
-            sunriseDate.setSeconds(second2)
-            if (sunriseDate.getTime() > new Date().getTime()) {
-                return t('feature.day_night.time_past_sunset')//'Time past Sunset'
-            }
-
-            if (now.getTime() < new Date().getTime()) {
-                return t('feature.day_night.time_past_sunset')//'Time past Sunset'
-            }
-            return t('feature.day_night.time_to_sunset')//'Time to Sunset'
-        }
-        else {
-            var list = sunriseTime.split(':')
-            var hour = parseInt(list[0])
-            var min = parseInt(list[1])
-            var second = list.length == 3 ? parseInt(list[2]) : 0
-            now.setHours(hour)
-            now.setMinutes(min)
-            now.setSeconds(second)
-
-            var sunsetDate = new Date()
-            var list2 = sunsetTime.split(':')
-            var hour2 = parseInt(list2[0])
-            var min2 = parseInt(list2[1])
-            var second2 = list2.length == 3 ? parseInt(list2[2]) : 0
-            sunsetDate.setHours(hour2)
-            sunsetDate.setMinutes(min2)
-            sunsetDate.setSeconds(second2)
-
-            if (new Date().getTime() > sunsetDate.getTime()) {
-                return t('feature.day_night.time_to_sunrise')//'Time to Sunrise'
-            }
-            if (now.getTime() < new Date().getTime()) {
-                return t('feature.day_night.time_past_sunrise')//'Time past Sunrise'
-            }
-            return t('feature.day_night.time_to_sunrise')//'Time to Sunrise'
-        }
-    }
-
-    function timeDesc2() {
-        if (props.isNight) {
-            return t('feature.day_night.time_to_sunrise')//'Time to Sunrise'
-        }
-        return t('feature.day_night.time_to_sunset')//'Time to Sunset'
-    }
-
-    function clearData() {
-        Taro.showModal({
-            title: '提示',
-            content: '确认清除位置数据?',
-            success: function (res) {
-                if (res.confirm) {
-                    clearLocation().then(res => {
-                        if (global.clearNightLocation) {
-                            global.clearNightLocation()
-                        }
-                        if (global.clearDayLocation) {
-                            global.clearDayLocation()
-                        }
-                        lastNightInfo = null
-                        lastDayInfo = null
-                    })
-                } else if (res.cancel) {
-                    console.log('用户点击取消')
-                }
-            }
-        })
-    }
-
-
-
-
-
-    function clearCacheData() {
-        locationDetail = null
-        Taro.removeStorage({ key: 'gps' })
-        setAuthInfo(null)
-        setSunriseTime('06:00')
-        setSunriseTmrTime('06:00')
-        setSunsetTime('18:00')
-        dispatch(updateMember({ isMember: isMember, gpsInfo: null }))
-
-
-        dispatch(setDayRingData({
-            date: new Date().getTime(),
-            sunrise: '06:00',
-            sunset: '18:00'
-        }))
-        dispatch(setNightRingData({
-            date: new Date().getTime(),
-            sunrise: '06:00',
-            sunset: '18:00'
-        }))
-    }
-
-    function detailModalContent() {
-        var split = new Date().toString().split(' ');
-        var timezone = split[split.length - 2];
-        if (!authInfo || !(authInfo as any).lat) {
-            return <View style={{ height: 100, display: 'flex', alignItems: 'center', justifyContent: 'center', width: rpxToPx(750) }}>
-                <Text>暂无位置信息</Text>
-            </View>
-        }
-        return <View style={{ display: 'flex', flexDirection: 'column' }}>
-            {
-                <View className="cell_bg">
-                    {
-                        <View className="cell_full">
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.location')}</Text>
-                            <Text className="cell_value">{authInfo ? getLocation() : t('feature.track_time_duration.third_ring.enter')}</Text>
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-
-                    {
-                        <View className="cell_full" >
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.latitude')}</Text>
-
-                            <Text className="cell_value">{(authInfo as any).lat}</Text>
-
-
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-                    <View className="cell_full">
-                        <Text className="cell_title" >{t('feature.track_time_duration.third_ring.longitude')}</Text>
-
-                        <Text className="cell_value">{(authInfo as any).lng}</Text>
-
-                    </View>
-                    <View className="cell_line" style={{ height: 1 }} />
-                    <View className="cell_full">
-                        <Text className="cell_title">{t('feature.track_time_duration.third_ring.timezone')}</Text>
-
-                        <Text className="cell_value">{timezone}</Text>
-
-                    </View>
-
-
-
-                </View>
-
-            }
-
-            <Text onClick={() => {
-                clearData()
-                setShowDetailModal(false)
-            }} style={{ width: '100%', textAlign: 'center', marginBottom: 50, color: '#fff', marginTop: 20 }}>清除位置</Text>
-        </View>
-    }
-
-    function modalContent2() {
-        if (process.env.TARO_ENV == 'weapp') {
-            return <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowDetailModal(false)
-                }}
-                confirm={() => { }}>
-                {
-                    detailModalContent()
-                }
-            </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'
-            >
-                {
-                    detailModalContent()
-                }
-            </PageContainer>
-        }
-    }
-
-    function modalContent() {
-        if (process.env.TARO_ENV == 'weapp') {
-            return <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowDetailPopup(false)
-                }}
-                confirm={() => { }}>
-                <DayNightDetailPopup
-                    sunsetDate={sunsetDate}
-                    sunriseDate={sunriseDate}
-                    sunriseTmrDate={sunriseTmrDate}
-                    sunsetTime={sunsetTime}
-                    sunriseTime={sunriseTime}
-                    sunriseTmrTime={sunriseTmrTime}
-                    isNight={props.isNight}
-                    authInfo={authInfo}
-                    nightDate={nightDate}
-                    dayDate={dayDate}
-                    onClose={() => { setShowDetailPopup(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={() => { setShowDetailPopup(false) }}
-                show={showDetailModal} round={true} overlay={true} position='bottom'
-            >
-                <DayNightDetailPopup
-                    sunsetDate={sunsetDate}
-                    sunriseDate={sunriseDate}
-                    sunriseTmrDate={sunriseTmrDate}
-                    sunsetTime={sunsetTime}
-                    sunriseTime={sunriseTime}
-                    sunriseTmrTime={sunriseTmrTime}
-                    isNight={props.isNight}
-                    authInfo={authInfo}
-                    nightDate={nightDate}
-                    dayDate={dayDate}
-                    onClose={() => { setShowDetailPopup(false) }}
-                />
-            </PageContainer>
-        }
-    }
-
-
-    function nightDurationDesc() {
-        if (!authInfo || !(authInfo as any).lat) {
-            if (new Date().getHours() >= 6) {
-                return `${t('feature.day_night.tonight', { time: sunsetTime })} - ${t('feature.day_night.tomorrow_morning', { time: sunriseTmrTime })}`
-            }
-            return `${t('feature.day_night.last_night', { time: sunsetTime })} - ${t('feature.day_night.this_morning', { time: sunriseTmrTime })}`
-            // return `Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
-        }
-        if (nightDate.getDate() == new Date().getDate()) {
-            return `${t('feature.day_night.tonight', { time: sunsetTime })} - ${t('feature.day_night.tomorrow_morning', { time: sunriseTmrTime })}`
-        }
-        return `${t('feature.day_night.last_night', { time: sunsetTime })} - ${t('feature.day_night.this_morning', { time: sunriseTmrTime })}`
-        //`Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
-    }
-
-    function dayDurationDesc() {
-        if (!authInfo || !(authInfo as any).lat) {
-            if (new Date().getHours() >= 18) {
-                return `${t('feature.day_night.tomorrow', { time: sunriseTime })} - ${sunsetTime}`
-
-                // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
-            }
-            return `${t('feature.day_night.today', { time: sunriseTime })} - ${sunsetTime}`
-            // return `Today ${sunriseTime} - ${sunsetTime}`
-        }
-        if (dayDate.getDate() == new Date().getDate()) {
-            return `${t('feature.day_night.today', { time: sunriseTime })} - ${sunsetTime}`
-            // return `Today ${sunriseTime} - ${sunsetTime}`
-        }
-        return `${t('feature.day_night.tomorrow', { time: sunriseTime })} - ${sunsetTime}`
-        // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
-    }
-
-    function nightDuration() {
-        if (!authInfo || !(authInfo as any).lat) {
-            if (new Date().getHours() >= 6) {
-                return `${t('feature.day_night.tonight')} ${sunsetTime} - ${t('feature.day_night.tomorrow_morning')} ${sunriseTmrTime}`
-            }
-            return `${t('feature.day_night.last_night')} ${sunsetTime} - ${t('feature.day_night.this_morning')} ${sunriseTmrTime}`
-            // return `Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
-        }
-        if (nightDate.getDate() == new Date().getDate()) {
-            return `${t('feature.day_night.tonight')} ${sunsetTime.substring(0, 5)} - ${t('feature.day_night.tomorrow_morning')} ${sunriseTmrTime.substring(0, 5)}`
-        }
-        return `${t('feature.day_night.last_night')} ${sunsetTime.substring(0, 5)} - ${t('feature.day_night.this_morning')} ${sunriseTmrTime.substring(0, 5)}`
-        //`Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
-    }
-
-    function dayDuration() {
-        if (!authInfo || !(authInfo as any).lat) {
-            if (new Date().getHours() >= 18) {
-                return `${t('feature.day_night.tomorrow')} ${sunriseTime} - ${sunsetTime}`
-
-                // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
-            }
-            return `${t('feature.day_night.today')} ${sunriseTime} - ${sunsetTime}`
-            // return `Today ${sunriseTime} - ${sunsetTime}`
-        }
-        if (dayDate.getDate() == new Date().getDate()) {
-            return `${t('feature.day_night.today')} ${sunriseTime.substring(0, 5)} - ${sunsetTime.substring(0, 5)}`
-            // return `Today ${sunriseTime} - ${sunsetTime}`
-        }
-        return `${t('feature.day_night.tomorrow')} ${sunriseTime.substring(0, 5)} - ${sunsetTime.substring(0, 5)}`
-        // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
-    }
-
-    function nightDurationDesc1() {
-        if (authInfo && authInfo.lat) {
-            return t('feature.day_night.sunset_to_sunrise')
-        }
-        return t('feature.day_night.night_tip')
-
-        // if (!authInfo || !(authInfo as any).lat) {
-        //     if (new Date().getHours() >= 6) {
-        //         return `${t('feature.day_night.tonight')}${t('feature.day_night.to')}${t('feature.day_night.tomorrow_morning')}`
-        //     }
-        //     return `${t('feature.day_night.last_night')}${t('feature.day_night.to')}${t('feature.day_night.this_morning')}`
-        //     // return `Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
-        // }
-        // if (nightDate.getDate() == new Date().getDate()) {
-        //     return `${t('feature.day_night.tonight')}${t('feature.day_night.to')}${t('feature.day_night.tomorrow_morning')}`
-        // }
-        // return `${t('feature.day_night.last_night')}${t('feature.day_night.to')}${t('feature.day_night.this_morning')}`
-        // //`Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
-    }
-
-    function dayDurationDesc1() {
-        if (authInfo && authInfo.lat) {
-            return t('feature.day_night.sunrise_to_sunset')
-        }
-        return t('feature.day_night.day_tip')
-        // if (!authInfo || !(authInfo as any).lat) {
-        //     if (new Date().getHours() >= 18) {
-        //         return `${t('feature.day_night.tomorrow')}`
-
-        //         // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
-        //     }
-        //     return `${t('feature.day_night.today')}`
-        //     // return `Today ${sunriseTime} - ${sunsetTime}`
-        // }
-        // if (dayDate.getDate() == new Date().getDate()) {
-        //     return `${t('feature.day_night.today')}`
-        //     // return `Today ${sunriseTime} - ${sunsetTime}`
-        // }
-        // return `${t('feature.day_night.tomorrow')}`
-        // // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
-    }
-
-    function buy(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        joingMember = true
-        Taro.navigateTo({
-            url: '/pages/account/Member'
-        })
-    }
-
-    function longClick() {
-        if (user.isLogin && authInfo)
-            setShowDetailModal(true)
-    }
-
-    function showLocationAlert(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (isMember && authInfo && authInfo.lat) {
-            tapCard(e)
-            return
-        }
-        Taro.showModal({
-            title: t('feature.day_night.note'),
-            content: props.isNight ? t('feature.day_night.alert_night_content') : t('feature.day_night.alert_day_content'),
-            confirmText: t('feature.day_night.choose_location'),
-            cancelText: t('feature.day_night.view_more'),
-            success: function (res) {
-                if (res.confirm) {
-                    auth()
-                    // console.log('用户点击确定')
-                } else if (res.cancel) {
-                    setShowDetailPopup(true)
-                }
-            }
-        })
-    }
-
-    return <View style={{ color: '#fff' }} onLongPress={longClick}>
-        <Box onClick={tapCard}>
-            <View style={{ marginTop: -rpxToPx(14), marginBottom: -rpxToPx(14) }}>
-                <View className='day_night_top'>
-                    {
-                        user.isLogin ? <Text className='day_night_title'>{props.isNight ? t('feature.day_night.night_ring_login') : t('feature.day_night.day_ring_login')}</Text> :
-                            <Text className='day_night_title'>{props.isNight ? t('feature.day_night.night_ring') : t('feature.day_night.day_ring')}</Text>
-                    }
-
-                    {
-                        user.isLogin && <View className='free' style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#1C1C1C' }}>{t('feature.day_night.limited_free')}</View>
-                    }
-
-                    <View style={{ flex: 1 }} />
-                    <View style={{ height: rpxToPx(50),display:'flex',alignItems:'center',flexDirection:'row' }}>
-                        <Switch checked={props.isNight ? dayStore.showDayRing : dayStore.showDayRing}
-                            className='switch'
-                            color={props.isNight ? ColorType.night : ColorType.day}
-                            onClick={(e) => { e.stopPropagation() }}
-                            onChange={(e) => {
-                                e.stopPropagation()
-                                // setExpand(e.detail.value)
-                                // if (props.isNight) {
-                                dispatch(showNight(e.detail.value))
-                                // }
-                                // else {
-                                dispatch(showDay(e.detail.value))
-                                // }
-
-
-                                Taro.setStorage({
-                                    key: 'showNightRing',
-                                    data: e.detail.value
-                                })
-                                Taro.setStorage({
-                                    key: 'showDayRing',
-                                    data: e.detail.value
-                                })
-
-
-                                if (user.isLogin) {
-                                    uploadPerm({ show_ring: e.detail.value })
-                                }
-                                else {
-
-                                    if (e.detail.value) {
-                                        setTimeout(() => {
-                                            Taro.showModal({
-                                                title: props.isNight ?
-                                                    t('feature.day_night.night_alert_title') :
-                                                    t('feature.day_night.day_alert_title'),
-                                                content: props.isNight ?
-                                                    t('feature.day_night.night_alert_content') :
-                                                    t('feature.day_night.day_alert_content'),
-                                                showCancel: false,
-                                                confirmText: t('feature.day_night.got_it')
-                                            })
-                                        }, 500)
-                                    }
-
-                                }
-
-
-                            }}
-                        />
-                    </View>
-                </View>
-                {
-                    user.isLogin && dayStore.showDayRing && <View className='day_night_detail' onClick={showLocationAlert}>
-                        <View className='day_night_detail_icon'>
-                            {
-                                props.isNight ? <IconNight width={rpxToPx(48)} color={ColorType.night} /> : <IconDay width={rpxToPx(48)} color={ColorType.day} />
-                            }
-                        </View>
-                        <View style={{ display: 'flex', flexDirection: 'column', paddingTop: rpxToPx(8) }}>
-                            <Text className='day_night_value' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? nightDuration() : dayDuration()}</Text>
-                            <Text className='day_night_desc'>{props.isNight ? nightDurationDesc1() : dayDurationDesc1()}</Text>
-                            {
-                                authInfo && authInfo.lat ?
-                                    <View style={{ display: 'flex', flexDirection: 'row', marginTop: rpxToPx(18) }} onClick={auth}>
-                                        <View className={props.isNight ? 'night_location_btn' : 'day_location_btn'} onClick={auth}>{getLocation()}</View>
-                                    </View>
-                                    :
-                                    <View style={{ display: 'flex', flexDirection: 'row', marginTop: rpxToPx(18)}} onClick={auth}>
-                                        <View className={props.isNight ? 'night_location_btn' : 'day_location_btn'} onClick={auth}>
-                                            {props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}
-                                        </View>
-                                    </View>
-                            }
-                        </View>
-                    </View>
-                }
-
-            </View>
-        </Box >
-        {
-            showDetailPopup && modalContent()
-        }
-        {
-            showDetailModal && modalContent2()
-        }
-    </View >
-
-    /*
-    return <View style={{ color: '#fff' }}>
-        <Box onClick={tapCard}>
-            <View>
-                <View className='day_night_top'>
-                    {
-                        user.isLogin?<Text className='day_night_title'>{props.isNight ? t('feature.day_night.night_ring_login') : t('feature.day_night.day_ring_login')}</Text>:
-                        <Text className='day_night_title'>{props.isNight ? t('feature.day_night.night_ring') : t('feature.day_night.day_ring')}</Text>
-                    }
-                    
-                    {
-                        user.isLogin && <View className='free' style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#1C1C1C' }}>{t('feature.day_night.limited_free')}</View>
-                    }
-
-                    <View style={{ flex: 1 }} />
-                    <Switch checked={props.isNight ? nightStore.showNightRing : dayStore.showDayRing}
-                        color={props.isNight ? ColorType.night : ColorType.day}
-                        onClick={(e) => { e.stopPropagation() }}
-                        onChange={(e) => {
-                            e.stopPropagation()
-                            // setExpand(e.detail.value)
-                            // if (props.isNight) {
-                            dispatch(showNight(e.detail.value))
-                            // }
-                            // else {
-                            dispatch(showDay(e.detail.value))
-                            // }
-
-
-                            Taro.setStorage({
-                                key: 'showNightRing',
-                                data: e.detail.value
-                            })
-                            Taro.setStorage({
-                                key: 'showDayRing',
-                                data: e.detail.value
-                            })
-
-
-                            if (user.isLogin) {
-                                uploadPerm({ show_ring: e.detail.value })
-                                // if (props.isNight) {
-                                //     uploadPerm({ show_night_ring: e.detail.value })
-                                // }
-                                // else {
-                                //     uploadPerm({ show_day_ring: e.detail.value })
-                                // }
-                            }
-
-
-                        }}
-                    />
-                </View>
-                {
-                    user.isLogin && ((props.isNight && nightStore.showNightRing) || (!props.isNight && dayStore.showDayRing)) && <View>
-                        <View style={{ display: 'flex', flexDirection: 'column' }}>
-                            <Text className='day_night_value' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? nightDurationDesc() : dayDurationDesc()}</Text>
-                            <Text className='day_night_desc'>{props.isNight ? t('feature.day_night.sunset_to_sunrise') : t('feature.day_night.sunrise_to_sunset')}</Text>
-                            <View style={{ display: 'flex', flexDirection: 'row', marginTop: rpxToPx(32) }}>
-                                <View style={{ display: 'flex', flexDirection: 'column', width: rpxToPx(300) }}>
-                                    <Text className='day_night_value' style={{ color: lowTimeColor() ? ColorType.ring : props.isNight ? ColorType.night : ColorType.day, }}>{timeCount()}</Text>
-                                    <Text className='day_night_desc'>{timeDesc()}</Text>
-                                </View>
-                                {
-                                    showExtraData() && <View style={{ display: 'flex', flexDirection: 'column', width: rpxToPx(300) }}>
-                                        <Text className='day_night_value' style={{ color: props.isNight ? ColorType.night : ColorType.day, opacity: 0.6 }}>{timeCount2()}</Text>
-                                        <Text className='day_night_desc'>{timeDesc2()}</Text>
-                                    </View>
-                                }
-                            </View>
-
-                        </View>
-                        {
-                            footer()
-                        }
-                    </View>
-                }
-
-            </View>
-        </Box>
-        {
-            showDetailModal && modalContent()
-        }
-    </View>*/
-}

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

@@ -15,6 +15,7 @@ import Modal from '@/components/layout/Modal.weapp';
 import Taro, { useDidShow } from '@tarojs/taro';
 import { wxPubFollow } from '@/services/permission';
 import { setWXFollow } from '@/store/permission';
+import CircadianDetailPopup from './CircadianDetailPopup';
 
 let useNavigation;
 if (process.env.TARO_ENV == 'rn') {
@@ -25,6 +26,7 @@ let min = 0
 let max = 0
 let defaultTimestamp = 0
 let isTimeout = false
+let stageIndex = 0
 export default function IndexConsole(props: { record: any }) {
     const user = useSelector((state: any) => state.user);
     const { status } = props.record.current_record;
@@ -39,6 +41,7 @@ export default function IndexConsole(props: { record: any }) {
     const [showTimePicker, setShowTimePicker] = useState(false);
     const dayMilliSeconds = 24 * 3600 * 1000;
     const [btnDisable, setBtnDisable] = useState(false)
+    const [showStageModal, setShowStageModal] = useState(false)
     const dispatch = useDispatch();
 
 
@@ -627,6 +630,58 @@ export default function IndexConsole(props: { record: any }) {
     }
 
 
+    function stageContent() {
+        if (process.env.TARO_ENV == 'weapp') {
+            return <Modal
+                testInfo={null}
+                dismiss={() => {
+                    global.pauseIndexTimer = false
+                    setShowStageModal(false)
+                }}
+                confirm={() => { }}>
+                {
+                    <CircadianDetailPopup
+                        record={currentRecord}
+                        schedule={props.record.scenario.schedule}
+                        stageIndex={stageIndex}
+                        onlyStage={true}
+                        onClose={() => { setShowStageModal(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={() => { setShowStageModal(false); global.pauseIndexTimer = false; }}
+                show={showStageModal} round={true} overlay={true} position='bottom'
+            >
+                {
+                    <CircadianDetailPopup
+                        record={currentRecord}
+                        schedule={props.record.scenario.schedule}
+                        stageIndex={stageIndex}
+                        onlyStage={true}
+                        onClose={() => { setShowStageModal(false) }} />
+                }
+            </PageContainer>
+        }
+    }
+
+    function tapStage(index) {
+        stageIndex = index
+        setShowStageModal(true)
+    }
 
 
     return <View style={{ marginTop: rpxToPx(0) }}>
@@ -635,7 +690,7 @@ export default function IndexConsole(props: { record: any }) {
                 <View onClick={tapStartFast} className='console_btn'>
                     <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32) }}>{t('feature.track_time_duration.common.start_fast')}</Text>
                 </View> :
-                <View onClick={() => { vibrate() }} className='stage_btn'>
+                <View onClick={() => { tapStage(0) }} className='stage_btn'>
                     <Text style={{ flex: 1 }}>{t('feature.track_time_duration.stage.a')}</Text>
                     {
                         status == 'ONGOING1' ?
@@ -657,7 +712,7 @@ export default function IndexConsole(props: { record: any }) {
         }
         {
             (status != 'WAIT_FOR_START' && status != 'ONGOING1') &&
-            <View onClick={() => { vibrate() }} className='stage_btn'>
+            <View onClick={() => { tapStage(1) }} className='stage_btn'>
                 <Text style={{ flex: 1 }}>{t('feature.track_time_duration.stage.b')}</Text>
                 {
                     status == 'ONGOING2' ? <Text>{TimeFormatter.countdown(currentRecord.sleep.real_start_time)}</Text> :
@@ -679,7 +734,7 @@ export default function IndexConsole(props: { record: any }) {
         }
         {
             status == 'ONGOING3' &&
-            <View onClick={() => { vibrate() }} className='stage_btn'>
+            <View onClick={() => { tapStage(2) }} className='stage_btn'>
                 <Text style={{ flex: 1 }}>{t('feature.track_time_duration.stage.c')}</Text>
                 <Text>{TimeFormatter.countdown(currentRecord.sleep.real_end_time)}</Text>
             </View>
@@ -705,6 +760,9 @@ export default function IndexConsole(props: { record: any }) {
         {
             showTimePicker && modalContent()
         }
+        {
+            showStageModal && stageContent()
+        }
 
     </View>
 }

+ 0 - 546
src/features/trackTimeDuration/components/IndexConsole的副本.tsx

@@ -1,546 +0,0 @@
-import { View, Text, Image, PageContainer } from '@tarojs/components'
-import './IndexConsole.scss'
-import { useTranslation } from 'react-i18next'
-import { useDispatch, useSelector } from 'react-redux';
-import { endFast, endSleep, startFast, startSleep } from "../actions/TrackTimeActions";
-import { jumpPage } from '../hooks/Common';
-import { useEffect, useRef, useState } from 'react';
-import LimitPickers from '@/components/input/LimitPickers';
-import LimitTimeoutPickers from '@/components/input/LimitTimeoutPickers';
-import { getColor, getTimePickerTitle } from '../hooks/Console';
-import { rpxToPx, vibrate } from '@/utils/tools';
-import { TimeFormatter } from '@/utils/time_format';
-import Modal from '@/components/layout/Modal.weapp';
-import Taro, { useDidShow } from '@tarojs/taro';
-import { wxPubFollow } from '@/services/permission';
-import { setWXFollow } from '@/store/permission';
-
-let useNavigation;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-let operateType = ''
-export default function IndexConsole(props: { record: any }) {
-    const user = useSelector((state: any) => state.user);
-    const { status } = props.record.current_record;
-    const currentRecord = props.record.current_record;
-    const { t } = useTranslation()
-    const [fastDuration, setFastDuration] = useState<number>(0);
-    const [sleepDuration, setSleepDuration] = useState<number>(0);
-    const [expand, setExpand] = useState(false);
-    const permission = useSelector((state: any) => state.permission);
-    const common = useSelector((state: any) => state.common);
-    const [firstEnter, setFirstEnter] = useState(true);
-    const dispatch = useDispatch();
-    const [showTimeoutPicker, setShowTimeoutPicker] = useState(false)
-
-    // const [fastPickerValue, setFastPickerValue] = useState([0, 0])
-    // const [sleepPickerValue, setSleepPickerValue] = useState([0, 0])
-
-    const limitPickerRef = useRef(null)
-
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useDidShow(() => {
-        wxPubFollow({ force_refresh: true }).then(res => {
-            dispatch(setWXFollow((res as any).wx_pub_followed));
-        })
-    })
-
-    useEffect(() => {
-        if (currentRecord.fast) {
-            var fastCount = currentRecord.fast.target_end_time - currentRecord.fast.target_start_time
-            setFastDuration(fastCount)
-        }
-
-        if (currentRecord.sleep) {
-            var sleepCount = currentRecord.sleep.target_end_time - currentRecord.sleep.target_start_time
-            setSleepDuration(sleepCount)
-        }
-        if (props.record.current_record.status == 'WAIT_FOR_START') {
-            setExpand(false)
-        }
-
-    }, [props.record])
-
-
-    function tapStartFast(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-
-        operateType = 'startFast'
-
-        showPicker()
-    }
-
-    function tapStartSleep(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
-            return
-        }
-        if (status != 'ONGOING1' && props.record.scenario.name == 'FAST_SLEEP') {
-            vibrate()
-            return;
-        }
-        operateType = 'startSleep'
-
-
-        showPicker()
-    }
-
-    function tapEndSleep(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
-            return
-        }
-        if (status != 'ONGOING2' && status != 'ONGOING') {
-            vibrate()
-            return;
-        }
-        operateType = 'endSleep'
-        global.pauseIndexTimer = true
-
-
-        var last_check_time = props.record.current_record.last_real_check_time
-        if (last_check_time + 24 * 3600 * 1000 <= new Date().getTime()) {
-            setShowTimeoutPicker(true)
-            return
-        }
-
-        showPicker()
-    }
-
-    function tapEndFast(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
-            return
-        }
-        if (status == 'WAIT_FOR_START') {
-            vibrate()
-            return;
-        }
-        global.pauseIndexTimer = true
-        operateType = 'endFast'
-
-        var last_check_time = props.record.current_record.last_real_check_time
-
-        if (last_check_time + 24 * 3600 * 1000 <= new Date().getTime() ||
-            props.record.current_record.fast.real_check_time + 24 * 3600 * 1000 <= new Date().getTime()) {
-            setShowTimeoutPicker(true)
-            return
-        }
-        showPicker()
-    }
-
-    function layoutContent() {
-        var limit = global.set_time - 7 * 3600 * 1000 * 24;
-        global.limit = limit
-
-        if (currentRecord.last_real_check_time) {
-            limit = currentRecord.last_real_check_time
-            global.limit = limit
-            //当set_time秒数<=latest_record_time秒数时,最小限制时间戳需+1分钟
-            if (new Date(global.set_time).getSeconds() <= new Date(currentRecord.last_real_check_time).getSeconds() && global.set_time - currentRecord.last_real_check_time > 60000) {
-                limit = limit + 60 * 1000
-            }
-        }
-
-        var title = getTimePickerTitle(currentRecord, t, operateType == 'endFast')
-        var color = getColor(currentRecord, operateType == 'endFast')
-        var duration = 0
-        if (operateType == 'startFast' && currentRecord.fast) {
-            duration = currentRecord.fast.target_end_time - currentRecord.fast.target_start_time
-        }
-        if (operateType == 'startSleep' && currentRecord.sleep) {
-            duration = currentRecord.sleep.target_end_time - currentRecord.sleep.target_start_time
-        }
-
-        var endTimestamp = 0
-        if (operateType == 'endFast') {
-            endTimestamp = currentRecord.fast.target_end_time
-        }
-        else if (operateType == 'endSleep') {
-            endTimestamp = currentRecord.sleep.target_end_time
-        }
-        return <View className="modal_content">
-            <LimitPickers ref={limitPickerRef} limit={limit} limitDay={7}
-                themeColor={color}
-                title={title}
-                showEndTime={true}
-                isFast={operateType == 'startFast' || operateType == 'endFast'}
-                isEnd={operateType == 'endFast' || operateType == 'endSleep'}
-                endTimestamp={endTimestamp}
-                // showEndTime={operateType == 'startFast' || operateType == 'startSleep'}
-                duration={duration}
-                onCancel={hidePicker} onChange={(e) => {
-                    pickerConfirm(e)
-                    global.pauseIndexTimer = false
-                    // hidePicker()
-                }} />
-        </View>
-    }
-
-    function timeoutPickerContent() {
-        var title = getTimePickerTitle(currentRecord, t, operateType == 'endFast')
-        var color = getColor(currentRecord, operateType == 'endFast')
-        var limit = props.record.current_record.last_real_check_time
-        var targetTime = props.record.current_record.fast.target_end_time
-        if (props.record.current_record.status == 'ONGOING3') {
-            limit = 0
-            targetTime = props.record.current_record.sleep.real_end_time + 60 * 1000
-        }
-        var endTimestamp = 0
-        if (operateType == 'endFast') {
-            endTimestamp = currentRecord.fast.target_end_time
-        }
-        else if (operateType == 'endSleep') {
-            endTimestamp = currentRecord.sleep.target_end_time
-        }
-        return <View className="modal_content">
-            <LimitTimeoutPickers ref={limitPickerRef} limit={limit} limitDay={7}
-                themeColor={color}
-                title={title}
-                isFast={operateType == 'endFast'}
-                endTimestamp={endTimestamp}
-                time={operateType == 'endFast' ? new Date(targetTime).getTime() :
-                    new Date(props.record.current_record.sleep.target_end_time).getTime()
-                }
-                onCancel={hidePicker} onChange={(e) => {
-                    pickerConfirm(e)
-                    global.pauseIndexTimer = false
-                    // hidePicker()
-                }} />
-        </View>
-    }
-
-    function showPicker() {
-        // global.scenario = 'FAST_SLEEP'
-        if (global.testInfotimer) {
-            return
-        }
-        global.pauseIndexTimer = true
-        global.set_time = new Date().getTime()
-        updateNodeInfo()
-        if (!global.isDebug) {
-            return
-        }
-        // global.testInfotimer = setInterval(() => {
-        // updateNodeInfo()
-
-        // }, 1000)
-
-    }
-
-    function updateNodeInfo() {
-        var node = layoutContent()
-        global.showIndexModal(true, node, null);
-    }
-
-    function hidePicker() {
-        var node = layoutContent()
-        global.showIndexModal(false, node, null);
-        setShowTimeoutPicker(false)
-        global.pauseIndexTimer = false
-    }
-
-
-    function followWxPub() {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'follow_wx_pub'
-        })
-
-        jumpPage('/pages/common/H5?title=fast16cc 关注服务号&url=' + resource[0].url)
-    }
-
-    function pickerConfirm(t1: number) {
-        // hidePicker()
-        var date = new Date(t1)
-        var setDate = new Date(global.set_time);
-        date.setMilliseconds(setDate.getMilliseconds());
-        date.setSeconds(setDate.getSeconds());
-
-        t1 = date.getTime();
-
-        switch (operateType) {
-            case 'startFast':
-                startFast(t1, fastDuration).then(res => {
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-
-                    if (permission.wxPubFollow) {
-                        Taro.showModal({
-                            title: t('feature.track_time_duration.reminders.fast_end_title'),
-                            content:
-                                t('feature.track_time_duration.reminders.enable_post_fast_content',
-                                    { time: TimeFormatter.dateDescription(t1 + fastDuration, true) + ' ' + TimeFormatter.timeDescription(t1 + fastDuration) }
-                                ),
-                            showCancel: false,
-                            confirmText: t('feature.track_time_duration.reminders.ok')
-                        })
-                    }
-                    else {
-                        Taro.showModal({
-                            title: t('feature.track_time_duration.reminders.fast_end_title'),
-                            content: t('feature.track_time_duration.reminders.post_fast_content',
-                                { time: TimeFormatter.dateDescription(t1 + fastDuration, true) + ' ' + TimeFormatter.timeDescription(t1 + fastDuration) }
-                            ),
-                            cancelText: t('feature.track_time_duration.reminders.later'),
-                            confirmText: t('feature.track_time_duration.reminders.open'),
-                            success: function (res) {
-                                if (res.confirm) {
-                                    followWxPub()
-                                } else if (res.cancel) {
-                                }
-                            }
-                        })
-                    }
-                })
-                break
-            case 'startSleep':
-                startSleep(t1, sleepDuration).then(res => {
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-
-                    if (permission.wxPubFollow) {
-                        Taro.showModal({
-                            title: t('feature.track_time_duration.reminders.wake_title'),
-                            content:
-                                t('feature.track_time_duration.reminders.enable_post_sleep_content',
-                                    { time: TimeFormatter.dateDescription(t1 + sleepDuration, true) + ' ' + TimeFormatter.timeDescription(t1 + sleepDuration) }),
-                            showCancel: false,
-                            confirmText: t('feature.track_time_duration.reminders.ok')
-                        })
-                    }
-                    else {
-                        Taro.showModal({
-                            title: t('feature.track_time_duration.reminders.wake_title'),
-                            content: t('feature.track_time_duration.reminders.post_sleep_content',
-                                { time: TimeFormatter.dateDescription(t1 + sleepDuration, true) + ' ' + TimeFormatter.timeDescription(t1 + sleepDuration) }),
-                            cancelText: t('feature.track_time_duration.reminders.later'),
-                            confirmText: t('feature.track_time_duration.reminders.open'),
-                            success: function (res) {
-                                if (res.confirm) {
-                                    followWxPub()
-                                } else if (res.cancel) {
-                                }
-                            }
-                        })
-                    }
-                })
-                break
-            case 'endSleep':
-                endSleep(t1).then(res => {
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-                })
-                break
-            case 'endFast':
-                endFast(t1).then(res => {
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-                })
-                break
-        }
-    }
-
-    function expandBtnText() {
-        if (status == 'WAIT_FOR_START') {
-            return '后续步骤' //'Next Steps'
-        }
-        else if (firstEnter) {
-            return '显示更多' //Show More
-        }
-        return '后续步骤' //’Next Steps‘
-    }
-
-    function modalContent() {
-        global.set_time = new Date().getTime()
-        if (process.env.TARO_ENV == 'weapp') {
-            return <Modal
-                testInfo={null}
-                dismiss={() => {
-                    hidePicker()
-                    // setShowTimeoutPicker(false)
-                }}
-                confirm={() => { }}>
-                {
-                    timeoutPickerContent()
-                }
-            </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={() => {
-                    hidePicker()
-                    // setShowTimeoutPicker(false)
-                }}
-                show={showTimeoutPicker} round={true} overlay={true} position='bottom'
-            >
-                {
-                    timeoutPickerContent()
-                }
-            </PageContainer>
-        }
-    }
-
-
-    if (props.record.scenario.name == 'FAST') {
-        return <View style={{ marginTop: rpxToPx(0) }}>
-            {
-                status == 'WAIT_FOR_START' &&
-                <View onClick={tapStartFast} className='console_btn'>
-                    <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.start_fast')}</Text>
-                </View>
-            }
-            {/* {
-                status != 'WAIT_FOR_START' && <View className='btn_line' />
-            } */}
-            {
-                status == 'ONGOING' && <View onClick={tapEndFast} className={status == 'ONGOING' ? 'console_btn' : 'console_btn btn_disable'}>
-                    <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.end_fast')}</Text>
-                </View>
-            }
-            {
-                showTimeoutPicker && modalContent()
-            }
-        </View>
-    }
-    else if (props.record.scenario.name == 'SLEEP') {
-        return <View style={{ marginTop: rpxToPx(0) }}>
-            {
-                status == 'WAIT_FOR_START' &&
-                <View onClick={tapStartSleep} className='console_btn btn_sleep'>
-                    <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.start_sleep')}</Text>
-                </View>
-            }
-            {/* {
-                status != 'WAIT_FOR_START' && <View className='btn_line' />
-            } */}
-            {
-                status == 'ONGOING' && <View onClick={tapEndSleep} className={status == 'ONGOING' ? 'console_btn btn_sleep' : 'console_btn btn_sleep btn_disable'}>
-                    <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.end_sleep')}</Text>
-                </View>
-            }
-
-            {
-                showTimeoutPicker && modalContent()
-            }
-
-        </View>
-    }
-
-
-
-
-    return <View style={{ marginTop: rpxToPx(0) }}>
-        {
-            status == 'WAIT_FOR_START' ?
-                <View onClick={tapStartFast} className='console_btn'>
-                    <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32) }}>{t('feature.track_time_duration.common.start_fast')}</Text>
-                </View> :
-                <View onClick={() => { vibrate() }} className='stage_btn'>
-                    <Text style={{ flex: 1 }}>{t('feature.track_time_duration.stage.a')}</Text>
-                    {
-                        status == 'ONGOING1' ?
-                            <Text>{TimeFormatter.countdown(currentRecord.fast.real_start_time)}</Text> :
-                            <Text>{TimeFormatter.countdown(currentRecord.fast.real_start_time, currentRecord.sleep.real_start_time)}</Text>
-                    }
-
-                </View>
-        }
-        <View className='btn_line' />
-        {
-            (status == 'WAIT_FOR_START' || status == 'ONGOING1') &&
-            <View onClick={tapStartSleep} className={status == 'ONGOING1' ? 'console_btn btn_sleep' : 'console_btn btn_sleep btn_disable'}>
-                {
-                    status != 'ONGOING1' && <Image className='lock' src={require('@assets/images/lock.png')} />
-                }
-                <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.start_sleep')}</Text>
-            </View>
-        }
-        {
-            (status != 'WAIT_FOR_START' && status != 'ONGOING1') &&
-            <View onClick={() => { vibrate() }} className='stage_btn'>
-                <Text style={{ flex: 1 }}>{t('feature.track_time_duration.stage.b')}</Text>
-                {
-                    status == 'ONGOING2' ? <Text>{TimeFormatter.countdown(currentRecord.sleep.real_start_time)}</Text> :
-                        <Text>{TimeFormatter.countdown(currentRecord.sleep.real_start_time, currentRecord.sleep.real_end_time)}</Text>
-                }
-
-
-            </View>
-        }
-        {(expand || (status != 'WAIT_FOR_START' && status != 'ONGOING1')) && <View className='btn_line' />}
-        {
-            (expand || (status != 'WAIT_FOR_START' && status != 'ONGOING1')) && (status == 'WAIT_FOR_START' || status == 'ONGOING1' || status == 'ONGOING2') &&
-            <View onClick={tapEndSleep} className={status == 'ONGOING2' ? 'console_btn btn_sleep' : 'console_btn btn_sleep btn_disable'}>
-                {
-                    status != 'ONGOING2' && <Image className='lock' src={require('@assets/images/lock.png')} />
-                }
-                <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.end_sleep')}</Text>
-            </View>
-        }
-        {
-            status == 'ONGOING3' &&
-            <View onClick={() => { vibrate() }} className='stage_btn'>
-                <Text style={{ flex: 1 }}>{t('feature.track_time_duration.stage.c')}</Text>
-                <Text>{TimeFormatter.countdown(currentRecord.sleep.real_end_time)}</Text>
-            </View>
-        }
-        {(expand || status == 'ONGOING3' || status == 'ONGOING') && <View className='btn_line' />}
-        {
-            (expand || status == 'ONGOING3' || status == 'ONGOING') &&
-            <View onClick={tapEndFast} className={status == 'ONGOING3' ? 'console_btn' : 'console_btn btn_disable'}>
-                {
-                    status == 'WAIT_FOR_START' && <Image className='lock' src={require('@assets/images/lock.png')} />
-                }
-                <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.end_fast')}</Text>
-            </View>
-        }
-        {
-            (status == 'WAIT_FOR_START' || status == 'ONGOING1' || status == 'ONGOING2') &&
-            <View>
-                {
-                    !expand && <Text className='expand' onClick={() => { setExpand(true) }}>{expandBtnText()}</Text>
-                }
-            </View>
-        }
-        {
-            showTimeoutPicker && modalContent()
-        }
-
-    </View>
-}

+ 0 - 504
src/features/trackTimeDuration/components/IndexItem的副本.tsx

@@ -1,504 +0,0 @@
-import { View, Text, Image, PageContainer } from "@tarojs/components";
-import { bigRingRadius, dotIsOuterRange, getBgRing, getCommon, getDot, getReal, getSchedule, getTarget, ringWidth, smallRingRadius, thirdRingRadius, timeTotimestamp } from "../hooks/RingData";
-import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
-import Rings from "./Rings";
-import './IndexItem.scss'
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
-import { TimeFormatter } from "@/utils/time_format";
-import { useSelector } from "react-redux";
-import { useEffect, useState } from "react";
-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";
-import { rpxToPx } from "@/utils/tools";
-
-let useNavigation;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-export default function Component(props: { type: string, data: any, time: any, showStage?: boolean }) {
-    const { t } = useTranslation()
-    const [record, setRecord] = useState(props.data.current_record);
-    const user = useSelector((state: any) => state.user);
-    const dayNight = useSelector((state: any) => state.dayNight);
-    const [stageList, setStageList] = useState([true, false, false])
-    const [isStageMode, setIsStageMode] = useState(false)
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [count, setCount] = useState(0)
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useEffect(() => {
-        setRecord(props.data.current_record)
-    }, [props.data])
-
-    useEffect(() => {
-        setCount((pre) => pre + 1)
-        console.log(dayNight.nightRingSunrise, dayNight.nightRingSunset)
-    }, [dayNight.nightRingSunrise, dayNight.nightRingSunset])
-
-    useEffect(() => {
-        if (props.type == 'FAST_SLEEP') {
-            global.updateMixItem = (data) => {
-                setStageList(data)
-
-            }
-
-            global.changeMixIndex = (index) => {
-                setIsStageMode(index == 1)
-
-            }
-        }
-    }, [])
-
-    
-    function durationArc(start_time: number, end_time: number) {
-        var duration = (end_time - start_time) / 1000;
-        return duration / (24 * 3600) * 2 * Math.PI;
-    }
-
-    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 bigRing() {
-        var common = getCommon(null, true)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        var currentDot1 = getDot(record, true)
-        var targetBigRing1 = getTarget(record, true)
-        if (record.status == 'ONGOING') {
-            var realRing1 = getReal(record, true, false)
-
-            return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} realRing={realRing1} targetRing={targetBigRing1} canvasId={props.type + props.time + 'big'} />
-        }
-        if (record.status == 'WAIT_FOR_START') {
-            var realRing1 = getSchedule(props.data.scenario, props.data.scenario.name != 'SLEEP', true, true)//getSchedule(record, props.type != 'SLEEP', true)
-            var list: any = []
-            if (props.data.scenario.name == 'FAST_SLEEP') {
-                realRing1.color = ColorType.fast + '66'
-
-                if (dotIsOuterRange(true, record.fast)) {
-                    currentDot1.color = ColorType.ring
-                }
-                var detail = timeTotimestamp(props.data.scenario)
-
-                if (stageList[0]) {
-
-                    const realRingBig: RealRing = {
-                        color: global.fastColor ? global.fastColor : ColorType.fast,
-                        startArc: startArc(detail.fast.target_start_time),
-                        durationArc: durationArc(detail.fast.target_start_time, detail.sleep.target_start_time)
-                    }
-
-                    list.push(realRingBig)
-                }
-                if (stageList[1]) {
-                    const realRingBig: RealRing = {
-                        color: global.fastColor ? global.fastColor : ColorType.fast,
-                        startArc: startArc(detail.sleep.target_start_time),
-                        durationArc: durationArc(detail.sleep.target_start_time, detail.sleep.target_end_time)
-                    }
-
-                    list.push(realRingBig)
-                }
-                if (stageList[2]) {
-                    const realRingBig: RealRing = {
-                        color: global.fastColor ? global.fastColor : ColorType.fast,
-                        startArc: startArc(detail.sleep.target_end_time),
-                        durationArc: durationArc(detail.sleep.target_end_time, detail.fast.target_end_time)
-                    }
-
-                    list.push(realRingBig)
-                }
-            }
-            else if (props.data.scenario.name == 'SLEEP') {
-                realRing1.color = ColorType.sleep + '66'
-            }
-            else {
-                realRing1.color = ColorType.fast + '66'
-            }
-
-            if (user.isLogin) {
-                list = []
-            }
-            return <Rings common={common} bgRing={bgRing} currentDot={isStageMode ? null : currentDot1} stageList={list} realRing={realRing1} canvasId={props.type + props.time + 'big'} />
-        }
-        var realRing1 = getReal(record, true, false)
-        return <Rings common={common} bgRing={bgRing} realRing={realRing1} currentDot={currentDot1} targetRing={targetBigRing1} canvasId={props.type + props.time + 'big'} />
-
-    }
-
-    function smallRing() {
-
-        var common = getCommon(null, false)
-        common.radius = smallRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        var realRing = getReal(record, false, false)
-        if (props.type == 'SLEEP' || props.data.scenario.name == 'FAST_SLEEP') {
-            if (!record.sleep) {
-                return null
-            }
-            if (record.sleep.status == 'WAIT_FOR_END') {
-                var targetBigRing1 = getTarget(record, false)
-                targetBigRing1.color = ColorType.sleep + '66'
-                var currentDot = getDot(record, false)
-                realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={props.type + props.time + 'small'} targetRing={targetBigRing1} realRing={realRing} />
-            }
-            else if (record.status == 'WAIT_FOR_START' || record.status == 'ONGOING1') {
-                realRing = getSchedule(props.data.scenario, false, true, true)//getSchedule(record, false, true)
-
-                realRing.color = ColorType.sleep + '66'
-
-                var currentDot = getDot(record, false)
-                if (dotIsOuterRange(true, record.sleep)) {
-                    currentDot.color = ColorType.ring
-                }
-
-                return <Rings common={common} bgRing={bgRing} currentDot={isStageMode ? null : currentDot} realRing={realRing} canvasId={props.type + props.time + 'small'} />
-            }
-            else if (record.sleep.status == 'NOT_COMPLETED') {
-                realRing.durationArc = 0.01
-                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 == 'COMPLETED') {
-                realRing = getReal(record, false, true)
-                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)
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={props.type + props.time + 'small'} />
-            }
-            return <Rings common={common} bgRing={bgRing} canvasId={props.type + props.time + 'small'} />
-        }
-        else {
-
-
-            var currentDot = getDot(record, false)
-            var targetRing = getTarget(record, false)
-            if (record.status == 'ONGOING2') {
-                var realRing = getReal(record, false, false)
-                return <Rings common={common} bgRing={bgRing} realRing={realRing} currentDot={currentDot} targetRing={targetRing} canvasId={props.type + props.time + 'small'} />
-            }
-            if (record.status == 'ONGOING3') {
-                currentDot.color = 'rgba(0, 255, 255, 0.5)'
-            }
-            return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={props.type + props.time + 'small'} />
-        }
-
-    }
-
-    function dayRing() {
-        var common = getCommon(null, true)
-        common.radius = thirdRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        const realRingBig: RealRing = {
-            color: ColorType.night + '66',
-            startArc: 0,
-            durationArc: 2
-        }
-        var sunRise = 24 * 60 + 6 * 60
-        var sunSet = 18 * 60
-
-        // if (dayNight.gpsInfo && user.test_user) {
-        var sunRiseObj = dayNight.nightRingSunrise
-        var sunSetObj = dayNight.nightRingSunset
-        sunRise = 24 * 60 + parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
-        sunSet = parseInt(sunSetObj.split(':')[0]) * 60 + parseInt(sunSetObj.split(':')[1])
-        if (sunSetObj.indexOf('PM') != -1) {
-            sunSet += 12 * 60
-        }
-        // }
-        var duration = sunRise - sunSet
-        realRingBig.startArc = (sunSet * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-        realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
-
-        var currentDot = getDot(record, false)
-        currentDot.color = ColorType.night
-
-        var now = new Date()
-        var t = now.getHours() * 60 + now.getMinutes()
-        var duration2 = t - sunSet
-        if (duration2 < 0) {
-            duration2 += 24 * 60
-        }
-        let realRing: RealRing = {
-            color: ColorType.night,
-            startArc: (sunSet * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0,
-            durationArc: (duration2 * 60) / (24 * 3600) * 2 * Math.PI
-        }
-
-        if (dayNight.nightRingDate){
-            if (new Date(dayNight.nightRingDate).getDate()== new Date().getDate() && new Date().getHours()<12){
-                
-                realRing = null;
-            }
-        }
-
-
-        return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} realRing={duration2 > duration ? null : realRing} currentDot={currentDot} canvasId={props.type + props.time + 'day'} />
-    }
-
-    function rings() {
-        return <View style={{
-            position: 'relative', zIndex: 1,
-            marginLeft: !props.showStage && global.showNightRing === true ? -6 : 0,
-        }}>
-            {
-                bigRing()
-            }
-            {
-                props.data.scenario.name == 'FAST_SLEEP' && <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                    {
-                        smallRing()
-                    }
-                </View>
-            }
-            {
-                !props.showStage && global.showNightRing === true && <View style={{ display: 'flex', position: 'absolute', left: -14, top: -14, right: -14, bottom: -14 }}>
-                    {
-                        dayRing()
-                    }
-                </View>
-            }
-
-        </View>
-    }
-
-    function getDuration(obj) {
-        if (!obj) {
-        }
-        if (obj.status == 'NOT_STARTED' || obj.status == 'NOT_COMPLETED') {
-            return ''
-        }
-        var start = obj.real_start_time
-        var end = obj.real_end_time
-        if (!end) {
-            end = (new Date()).getTime()
-        }
-        if (obj.status == 'WAIT_FOR_START') {
-            start = obj.target_start_time
-            end = obj.target_end_time
-        }
-        return TimeFormatter.durationFormate(start, end)
-        // return TimeFormatter.calculateTimeDifference(start, end)
-    }
-
-    function fastDuration() {
-        if (!record.fast) {
-            return ''
-        }
-        if (!user.isLogin){
-            var count = 0
-            if (stageList[0]){
-                count += 6
-            }
-            if (stageList[1]){
-                count+=8
-            }
-            if (stageList[2]){
-                count+=2
-            }
-            return `${count}小时`
-        }
-        if (record.fast.status == 'WAIT_FOR_END') {
-            return TimeFormatter.countdown(record.fast.real_start_time)
-            // return TimeFormatter.formateTimeDifference(record.fast.real_start_time, new Date().getTime(), false)
-        }
-        if (isStageMode && record.scenario == 'FAST_SLEEP') {
-            if (stageList[0]) {
-                return TimeFormatter.durationFormate(record.fast.target_start_time, record.sleep.target_start_time)
-            }
-            if (stageList[1]) {
-                return TimeFormatter.durationFormate(record.sleep.target_start_time, record.sleep.target_end_time)
-            }
-            if (stageList[2]) {
-                return TimeFormatter.durationFormate(record.sleep.target_end_time, record.fast.target_end_time)
-            }
-        }
-        return getDuration(record.fast)
-    }
-
-    function sleepDuration() {
-        if (!record.sleep) {
-            return ''
-        }
-        if (record.sleep.status == 'WAIT_FOR_END') {
-            return TimeFormatter.formateTimeDifference(record.sleep.real_start_time, new Date().getTime(), false)
-        }
-        return getDuration(record.sleep)
-    }
-
-    function goClock() {
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        if (props.showStage) {
-            return
-        }
-        global.showSegmentPop()
-    }
-
-    function nightDuration() {
-
-            var sunRiseObj = dayNight.nightRingSunrise
-            var sunSetObj = dayNight.nightRingSunset
-            var sunRise = 24 * 60 + parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
-            var sunSet = parseInt(sunSetObj.split(':')[0]) * 60 + parseInt(sunSetObj.split(':')[1])
-            if (sunSetObj.indexOf('PM') != -1) {
-                sunSet += 12 * 60
-            }
-
-            var duration = (sunRise - sunSet) * 60 * 1000
-
-            return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
-    }
-
-    function fastPicker() {
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        global.showFastPicker()
-    }
-
-    function sleepPicker(e) {
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        if (record.status == 'ONGOING3') {
-            return;
-        }
-        global.showSleepPicker()
-    }
-
-
-    function goDetail(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        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 style={{
-        marginLeft: rpxToPx(-40),
-        marginRight: rpxToPx(-40),
-        marginTop: rpxToPx(-40),
-        padding: rpxToPx(48),
-        // backgroundColor:'pink'
-    }}>
-        <View className="time_operate_item1" onClick={goDetail}>
-            <View className="fast_sleep_item" style={{
-                marginTop: !props.showStage && global.showNightRing === true ? -6 : 0,
-                marginBottom: !props.showStage && global.showNightRing === true ? -6 : 0,
-                padding: !props.showStage && global.showNightRing === true ? 14 : 0,
-                paddingRight: 0
-            }}>
-                {
-                    rings()
-                }
-                <View className="duration_bg2" style={{ marginLeft: !props.showStage && global.showNightRing === true ? rpxToPx(68) : rpxToPx(52), height: bigRingRadius * 2, overflow: 'visible' }}>
-                    {
-                        !props.showStage && global.showNightRing === true &&
-                        <Text className="duration_title2">{t('feature.common.overnight')}</Text>
-                    }
-                    {
-                        !props.showStage && global.showNightRing === true &&
-                        <Text className="duration_value2" style={{ color: ColorType.night }}>{nightDuration()}</Text>
-                    }
-                    {
-                        (props.data.scenario.name == 'FAST' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_title2">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                    }
-                    {
-                        (props.data.scenario.name == 'FAST' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_value2" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration()}</Text>
-                    }
-                    {
-                        (props.data.scenario.name == 'SLEEP' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_title2" >{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                    }
-                    {
-                        (props.data.scenario.name == 'SLEEP' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_value2" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep, marginBottom: 0 }}>{sleepDuration()}</Text>
-                    }
-                </View>
-                <Image className="arrow2" src={require('@/assets/images/arrow3.png')} />
-                {/* {
-                !props.showStage && <View className="record_arrow_bg" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
-                    <View style={{ flex: 1 }} />
-                    
-                </View>} */}
-
-
-            </View>
-            {
-                showDetailModal && modalContent()
-            }
-        </View>
-    </View>
-}

+ 0 - 352
src/features/trackTimeDuration/components/RecordFastSleep的副本.tsx

@@ -1,352 +0,0 @@
-import Box from "@/components/layout/Box";
-import Header from "@/components/layout/Header";
-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 Taro from "@tarojs/taro";
-import { useEffect, useState } from "react";
-import TimelineFastSleep from "./TimelineFastSleep";
-import { TimeFormatter } from "@/utils/time_format";
-import './RecordFastSleep.scss'
-import { bigRingRadius, getBgRing, getCommon, getDot, getReal, getTarget, ringWidth, smallRingRadius } from "../hooks/RingData";
-import Rings from "./Rings";
-import Segment from "@/components/navigation/Segment";
-import Stage from "./Stage";
-import CenterContentTitleModal from "@/features/common/CenterContentTitleModal";
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import TimelineStage from "./TimelineStage";
-import { jumpPage } from "../hooks/Common";
-// import { sqrt } from 'mathjs'
-
-let AppState;
-if (process.env.TARO_ENV == 'rn') {
-    AppState = require("react-native").AppState
-}
-
-export default function RecordFastSleep(props: { data: any, type: string, delSuccess?: Function, index: number }) {
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [segmentIndex, setSegmentIndex] = useState(0)
-    const [diffTimeZone, setDiffTimeZone] = useState(false)
-    const [multiTimeZone, setMultiTimeZone] = useState(false)
-    const { t } = useTranslation()
-    var canvasId = props.data.id
-    const record = props.data;
-
-    const handleAppStateChange = (nextAppState) => {
-        checkTimezone()
-    };
-
-    useEffect(() => {
-        checkTimezone()
-        if (process.env.TARO_ENV == 'rn') {
-            AppState.addEventListener('change', handleAppStateChange);
-        }
-        // console.log(sqrt(-4).toString())
-    }, [props.data])
-
-    function checkTimezone() {
-        var split = new Date().toString().split(' ');
-        var currentTZ = split[split.length - 2];
-        var isDiff = false;
-        var isMulti = false;
-        var tempTZ = '';
-        if (props.data.fast) {
-            if (props.data.fast.real_start_time_zone) {
-                tempTZ = props.data.fast.real_start_time_zone
-                if (props.data.fast.real_start_time_zone != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-            if (props.data.fast.real_end_time_zone) {
-                if (tempTZ != props.data.fast.real_end_time_zone) {
-                    isMulti = true
-                }
-                if (props.data.fast.real_end_time_zone != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-        }
-
-        if (props.data.sleep) {
-            if (props.data.sleep.real_start_time_zone) {
-                if (tempTZ == '') {
-                    tempTZ = props.data.sleep.real_start_time_zone
-                }
-                else if (tempTZ != props.data.sleep.real_start_time_zone) {
-                    isMulti = true
-                }
-                if (props.data.sleep.real_start_time_zone != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-            if (props.data.sleep.real_end_time_zone) {
-                if (tempTZ != props.data.sleep.real_end_time_zone) {
-                    isMulti = true
-                }
-                if (props.data.sleep.real_end_time_zone != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-
-        }
-        setDiffTimeZone(isDiff)
-        setMultiTimeZone(isMulti)
-    }
-    function del() {
-        var id = props.data.id
-        delRecord(id
-        ).then(res => {
-            global.refreshTime()
-            Taro.showToast({
-                title: t('page.records_history.del_success')
-            })
-            props.delSuccess && props.delSuccess(props.data)
-            // Taro.navigateBack()
-        })
-    }
-
-    function subTitle(timestamp) {
-        if (multiTimeZone) {
-            return t('feature.common.multi_timezones')
-        }
-        if (diffTimeZone) {
-            return t('feature.common.different_timezone')
-        }
-        return TimeFormatter.getDateAndWeek(timestamp)
-    }
-
-    function schedules() {
-        var timestamp = props.data.first_real_check_time
-
-        return <View style={{ display: 'flex', flexDirection: 'column' }}>
-            <TimelineStage data={props.data} title={t('feature.track_time_duration.record_fast_sleep.pop_title')}
-                subTitle={subTitle(timestamp)} first_real_check_time={timestamp} />
-        </View>
-    }
-
-    function showDetail(e) {
-        if (props.type == 'latest') {
-            setSegmentIndex(0)
-            global.segmentIndex = 0
-            setShowDetailModal(true)
-            return;
-        }
-        setShowDetailModal(true)
-    }
-
-    function getDuration(obj) {
-        if (!obj) {
-        }
-        if (obj.status == 'NOT_STARTED' || obj.status == 'NOT_COMPLETED') {
-            return ''
-        }
-        var start = obj.real_start_time
-        var end = obj.real_end_time
-        if (!end) {
-            end = (new Date()).getTime()
-        }
-        return TimeFormatter.durationFormate(start, end)
-        // return TimeFormatter.calculateTimeDifference(start, end)
-    }
-
-    function durationArc(start_time: number, end_time: number) {
-        var duration = (end_time - start_time) / 1000;
-        return duration / (24 * 3600) * 2 * Math.PI;
-    }
-
-    function bigRing() {
-        var common = getCommon(null, true)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        if (props.type == 'record' || props.type == 'latest') {
-            var realRing = getReal(record, true, true)
-            if (props.data.status == 'ONGOING3') {
-                realRing.color = 'rgba(0,0,0,0)'
-            }
-            return <Rings common={common} bgRing={bgRing} canvasId={props.index} realRing={realRing} />
-        }
-        else {
-            var currentDot1 = getDot(record, true)
-            var targetBigRing1 = getTarget(record, true)
-            if (record.status == 'ONGOING') {
-                var realRing1 = getReal(record, true, false)
-
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} realRing={realRing1} targetRing={targetBigRing1} canvasId={canvasId} />
-            }
-            if (record.status == 'WAIT_FOR_START') {
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} canvasId={canvasId} />
-            }
-            var realRing1 = getReal(record, true, false)
-            return <Rings common={common} bgRing={bgRing} realRing={realRing1} currentDot={currentDot1} targetRing={targetBigRing1} canvasId={canvasId} />
-        }
-    }
-
-    function smallRing() {
-        if (record.scenario == 'FAST_SLEEP') {
-            var common = getCommon(null, false)
-            common.radius = smallRingRadius;
-            common.lineWidth = ringWidth;
-            var bgRing = getBgRing()
-            var realRing = getReal(record, false, false)
-            if (props.type == 'record' || props.type == 'latest') {
-                var showReal = false;
-                if (record.sleep.status == 'WAIT_FOR_END') {
-                    realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
-                    showReal = true
-                    // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                }
-                else if (record.sleep.status == 'NOT_COMPLETED') {
-                    realRing.durationArc = 0.01
-                    showReal = true
-                    // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                }
-                else if (record.sleep.status == 'COMPLETED') {
-                    realRing = getReal(record, false, true)
-                    showReal = true
-                    // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                }
-                return <Rings common={common} bgRing={bgRing} canvasId={props.index + 'small'} realRing={showReal ? realRing : null} />
-                // if (record.sleep.status == 'WAIT_FOR_END') {
-                //     realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
-                //     return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                // }
-                // else if (record.sleep.status == 'NOT_COMPLETED') {
-                //     realRing.durationArc = 0.01
-                //     return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                // }
-                // else if (record.sleep.status == 'COMPLETED') {
-                //     realRing = getReal(record, false, true)
-                //     return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                // }
-                // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} />
-            }
-            else {
-
-                var currentDot = getDot(record, false)
-                var targetRing = getTarget(record, false)
-                if (record.status == 'ONGOING2') {
-                    var realRing = getReal(record, false, false)
-                    return <Rings common={common} bgRing={bgRing} realRing={realRing} currentDot={currentDot} targetRing={targetRing} canvasId={canvasId + 'small'} />
-                }
-                if (record.status == 'ONGOING3') {
-                    currentDot.color = 'rgba(0, 255, 255, 0.5)'
-                }
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={canvasId + 'small'} />
-            }
-        }
-        return null
-    }
-
-    function rings() {
-        return <View style={{ position: 'relative', zIndex: 1 }}>
-            {
-                bigRing()
-            }
-            <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                {
-                    smallRing()
-                }
-            </View>
-        </View>
-    }
-
-    function recordTime() {
-        var timestamp = props.data.first_real_check_time
-        if (props.data.first_time_zone) {
-            timestamp = TimeFormatter.transferTimestamp(timestamp, props.data.first_time_zone)
-        }
-        return TimeFormatter.dateDescription(timestamp, true)
-    }
-
-    function getArrowText() {
-        if (multiTimeZone) {
-            return t('feature.common.multi_timezones')
-        }
-        if (diffTimeZone) {
-            return t('feature.common.different_timezone')
-        }
-        return recordTime()
-    }
-
-    function recordDetail() {
-        var fastDuration = ''
-        var sleepDuration = ''
-        var showFast = false;
-        var showSleep = false;
-        if (record.scenario == 'FAST_SLEEP') {
-
-            fastDuration = getDuration(record.fast)
-            sleepDuration = getDuration(record.sleep)
-            if (record.status == 'ONGOING3') {
-                fastDuration = t('feature.common.wait_for_end')
-            }
-
-            if (record.sleep.status == "NOT_STARTED") {
-                sleepDuration = t('feature.common.not_started')
-            }
-            else if (record.sleep.status == 'NOT_COMPLETED') {
-                sleepDuration = t('feature.common.not_completed')
-            }
-            showFast = true
-            showSleep = true
-        }
-        else if (record.scenario == 'FAST') {
-            fastDuration = getDuration(record.fast)
-            showFast = true
-        }
-        else {
-            sleepDuration = getDuration(record.sleep)
-            showSleep = true
-        }
-        return <View className="fast_sleep_item">
-            {
-                rings()
-            }
-            <View className="duration_bg">
-                {
-                    showFast && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                }
-                {
-                    showFast && <Text className="duration_value" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration}</Text>
-                }
-                {
-                    showSleep && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                }
-                {
-                    showSleep && <Text className="duration_value" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{sleepDuration}</Text>
-                }
-            </View>
-            {/* <Image className="arrow1" src={require('@/assets/images/arrow.png')} /> */}
-            <View className="record_arrow_bg" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
-                <View style={{ flex: 1 }} />
-                <Text className='recordTime'>{getArrowText()}</Text>
-                <Image className="arrow2" src={require('@/assets/images/arrow3.png')} />
-            </View>
-
-        </View>
-    }
-
-    return <View>
-        <View className="time_operate_item">
-            <RecordItem canDel={record.status == 'COMPLETED'} delete={del}
-                onClick={showDetail}
-            >{recordDetail()}
-            </RecordItem>
-            {
-                showDetailModal && <Modal children={schedules()}
-                    modalType={ModalType.center}
-                    dismiss={() => setShowDetailModal(false)}
-                    confirm={() => { }} />
-            }
-        </View>
-    </View>
-}

+ 0 - 219
src/features/trackTimeDuration/components/TimelineFastSleep的副本.tsx

@@ -1,219 +0,0 @@
-import Timeline from "@/components/view/Timeline";
-import { TimeFormatter } from "@/utils/time_format";
-import { View } from "@tarojs/components";
-import getStatus from "../hooks/Record";
-import { ColorType } from "@/context/themes/color";
-import { useTranslation } from "react-i18next";
-import { useEffect, useState } from "react";
-import { useSelector } from "react-redux";
-
-export default function TimelineFastSleep(props: { data: any, title?: string, first_real_check_time?: number }) {
-    const { t } = useTranslation()
-    const [diffTimeZone, setDiffTimeZone] = useState(false)
-    const scenario = useSelector((state: any) => state.scenario);
-
-    useEffect(() => {
-        var split = new Date().toString().split(' ');
-        var currentTZ = split[split.length - 2];
-        if (props.data.fast) {
-            if (props.data.fast.real_start_time_zone && props.data.fast.real_start_time_zone != currentTZ) {
-                setDiffTimeZone(true)
-                return
-            }
-            if (props.data.fast.real_end_time_zone && props.data.fast.real_end_time_zone != currentTZ) {
-                setDiffTimeZone(true)
-                return
-            }
-        }
-
-        if (props.data.sleep) {
-            if (props.data.sleep.real_start_time_zone && props.data.sleep.real_start_time_zone != currentTZ) {
-                setDiffTimeZone(true)
-                return
-            }
-            if (props.data.sleep.real_end_time_zone && props.data.sleep.real_end_time_zone != currentTZ) {
-                setDiffTimeZone(true)
-                return
-            }
-        }
-        setDiffTimeZone(false)
-
-    }, [props.data])
-
-
-    function formateTime(obj: any, isEnd: boolean) {
-        if (isEnd) {
-            if (obj.real_end_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_end_time, obj.real_end_time_zone)
-                return diffTimeZone ? TimeFormatter.timelineFullFormatTime(newTimestamp) : TimeFormatter.timelineFormatTime(obj.real_end_time)
-            }
-            else {
-                return diffTimeZone ? TimeFormatter.timelineFullFormatTime(obj.target_end_time) : TimeFormatter.timelineFormatTime(obj.target_end_time)
-            }
-        }
-        else {
-            if (obj.real_start_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_start_time, obj.real_start_time_zone)
-                return diffTimeZone ? TimeFormatter.timelineFullFormatTime(newTimestamp) : TimeFormatter.timelineFormatTime(obj.real_start_time)
-            }
-            else {
-                return diffTimeZone ? TimeFormatter.timelineFullFormatTime(obj.target_start_time) : TimeFormatter.timelineFormatTime(obj.target_start_time)
-            }
-        }
-
-    }
-
-    function showDate(obj: any, isEnd: boolean) {
-        var dt = 0
-        if (isEnd) {
-            if (obj.real_end_time) {
-                dt = obj.real_end_time
-            }
-            else {
-                dt = obj.target_end_time
-            }
-        }
-        else {
-            if (obj.real_start_time) {
-                dt = obj.real_start_time
-            }
-            else {
-                dt = obj.target_start_time
-            }
-        }
-        // debugger
-        var dt2 = props.first_real_check_time ? props.first_real_check_time : 0
-        var date1 = new Date(dt)
-        var date2 = new Date(dt2)
-        if (date1.getFullYear() == date2.getFullYear() &&
-            date1.getMonth() == date2.getMonth() &&
-            date1.getDate() == date2.getDate()) {
-            return false
-        }
-        return true
-    }
-
-    function formateDate(obj: any, isEnd: boolean) {
-        if (isEnd) {
-            if (obj.real_end_time) {
-                return TimeFormatter.dateDescription(obj.real_end_time)
-            }
-            else {
-                return TimeFormatter.dateDescription(obj.target_end_time)
-            }
-        }
-        else {
-            if (obj.real_start_time) {
-                return TimeFormatter.dateDescription(obj.real_start_time)
-            }
-            else {
-                return TimeFormatter.dateDescription(obj.target_start_time)
-            }
-        }
-
-    }
-
-    function getWaitForStartDate(time: string) {
-        var strTime
-        if (scenario.name == 'SLEEP') {
-            strTime = scenario.schedule.sleep.start_time
-        }
-        else {
-            strTime = scenario.schedule.fast.start_time
-        }
-        var count = parseInt(strTime.split(':')[0]) * 60 + parseInt(strTime.split(':')[1])
-        var count2 = parseInt(time.split(':')[0]) * 60 + parseInt(time.split(':')[1])
-        if (count > count2) {
-            return global.language == 'en' ? 'Tomorrow' : '明天'
-        }
-        return ''
-    }
-
-    var timelineItems: any = [];
-    /*
-    attention:
-    status == 待开始时
-    timeline的时间不以时间戳进行处理,而是以target时间字符串进行显示
-    */
-    if (props.data.fast && scenario.name != 'SLEEP') {
-        var timeZone = ''
-        if (props.data.fast.real_start_time_zone) {
-            timeZone = ' ' + props.data.fast.real_start_time_zone
-        }
-        debugger
-        timelineItems.push(
-            {
-                status: getStatus(true, true, props.data),
-                title: getStatus(true, true, props.data) == 'padding' ?
-                    t('feature.track_time_duration.common.start_fast') :
-                    t('feature.track_time_duration.common.started_fasting'),
-                content: props.data.status == 'WAIT_FOR_START' ? scenario.schedule.fast.start_time : formateTime(props.data.fast, false),
-                date: props.data.status == 'WAIT_FOR_START' ? '' :
-                    (diffTimeZone ? timeZone : showDate(props.data.fast, false) ? formateDate(props.data.fast, false) : ''),
-                color: global.fastColor ? global.fastColor : ColorType.fast
-            }
-        )
-    }
-    if (props.data.sleep && scenario.name != 'FAST') {
-        var timeZone = ''
-        if (props.data.sleep.real_start_time_zone) {
-            timeZone = ' ' + props.data.sleep.real_start_time_zone
-        }
-        var status = getStatus(false, true, props.data)
-        var strContent = props.data.status == 'WAIT_FOR_START' ? scenario.schedule.sleep.start_time : formateTime(props.data.sleep, false)
-        var strDate = props.data.status == 'WAIT_FOR_START' ? getWaitForStartDate(scenario.schedule.sleep.start_time) :
-            (diffTimeZone ? timeZone : showDate(props.data.sleep, false) ? formateDate(props.data.sleep, false) : '')
-        timelineItems.push(
-            {
-                status: status,
-                title: status == 'padding' ?
-                    t('feature.track_time_duration.common.start_sleep') :
-                    t('feature.track_time_duration.common.started_sleeping'),
-                content: status=='un_done'?'':strContent,
-                date: status=='un_done'?'':strDate,
-                color: global.sleepColor ? global.sleepColor : ColorType.sleep
-            }
-        )
-    }
-    if (props.data.sleep && scenario.name != 'FAST') {
-        var timeZone = ''
-        if (props.data.sleep.real_end_time_zone) {
-            timeZone = ' ' + props.data.sleep.real_end_time_zone
-        }
-        var status = getStatus(false, false, props.data)
-        var strContent = props.data.status == 'WAIT_FOR_START' ? scenario.schedule.sleep.end_time : formateTime(props.data.sleep, true)
-        var strDate = props.data.status == 'WAIT_FOR_START' ? getWaitForStartDate(scenario.schedule.sleep.end_time) :
-            (diffTimeZone ? timeZone : showDate(props.data.sleep, true) ? formateDate(props.data.sleep, true) : '')
-        timelineItems.push(
-            {
-                status: status,
-                title: status == 'padding' ?
-                    t('feature.track_time_duration.common.end_sleep') :
-                    t('feature.track_time_duration.common.ended_sleeping'),
-                content: status=='un_done'?'':strContent,
-                date: status=='un_done'?'':strDate,
-                color: global.sleepColor ? global.sleepColor : ColorType.sleep
-            }
-        )
-    }
-    if (props.data.fast && scenario.name != 'SLEEP') {
-        var timeZone = ''
-        if (props.data.fast.real_end_time_zone) {
-            timeZone = ' ' + props.data.fast.real_end_time_zone
-        }
-        timelineItems.push(
-            {
-                status: getStatus(true, false, props.data),
-                title: getStatus(true, false, props.data) == 'padding' ?
-                    t('feature.track_time_duration.common.end_fast') :
-                    t('feature.track_time_duration.common.ended_fasting'),
-                content: props.data.status == 'WAIT_FOR_START' ? scenario.schedule.fast.end_time : formateTime(props.data.fast, true),
-                date: props.data.status == 'WAIT_FOR_START' ? getWaitForStartDate(scenario.schedule.fast.end_time) :
-                    (diffTimeZone ? timeZone : showDate(props.data.fast, true) ? formateDate(props.data.fast, true) : ''),
-                color: global.fastColor ? global.fastColor : ColorType.fast
-            }
-        )
-    }
-
-    return <Timeline items={timelineItems} title={props.title} />
-}

+ 0 - 121
src/features/trackTimeDuration/components/TimelineStage.weapp的副本.tsx

@@ -1,121 +0,0 @@
-import { View, Text } from '@tarojs/components'
-import './TimelineStage.scss'
-import { useEffect, useState } from 'react';
-import Segment from '@/components/navigation/Segment';
-import TimelineFastSleep from './TimelineFastSleep';
-import Stage from './Stage';
-import { useTranslation } from 'react-i18next';
-import Switch from '@/components/input/Switch2';
-import { useSelector } from 'react-redux';
-import Taro from '@tarojs/taro';
-import { jumpPage } from '../hooks/Common';
-import { rpxToPx } from '@/utils/tools';
-import TotalTime from './TotalTime';
-
-
-
-export default function Component(props: { data: any, title?: string, subTitle?: string, isSchedule?: boolean, first_real_check_time?: number }) {
-    // debugger
-    const [segmentIndex, setSegmentIndex] = useState(0)
-    const permission = useSelector((state: any) => state.permission);
-    const common = useSelector((state: any) => state.common);
-
-
-
-
-    const { t } = useTranslation()
-
-    function followWxPub() {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'follow_wx_pub'
-        })
-
-        const title = permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.h5_followed_title') :
-            t('feature.track_time_duration.follow_wx_pub.h5_unfollowed_title')
-
-        Taro.showModal({
-            title: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_title') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_title'),
-            content: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_content') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_content'),
-            showCancel: true,
-            cancelText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_cancel_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_cancel_btn'),
-            confirmText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_confirm_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_confirm_btn'),
-            success(result) {
-                if (result.confirm) {
-                    global.forceRefreshWXPub = true
-                    jumpPage('/pages/common/H5?title=' + title + '&url=' + resource[0].url)
-                }
-            },
-        })
-    }
-
-    return <View style={{ display: 'flex', flexDirection: 'column', width: rpxToPx(578) }}>
-        {/* <Text className='box_title'>{props.title ? props.title : 'Title'}</Text> */}
-        <View className="box_header" style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
-            <Text className="box_title" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{props.title ? props.title : 'Title'}</Text>
-            {
-                props.isSchedule && process.env.TARO_ENV == 'weapp' &&
-                <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
-            }
-        </View>
-        <Text className='box_subtitle'>{props.subTitle ? props.subTitle : 'subTitle'}</Text>
-        <View className="segment_detail" style={{
-            display: 'flex', alignItems: 'center',
-            flexDirection: 'column', justifyContent: 'center'
-        }}>
-            <View style={{
-                position: 'relative', width: '100%', display: 'flex', alignItems: 'center',
-                flexDirection: 'column', justifyContent: 'center'
-            }}>
-                {/* <View style={{ backgroundColor: 'pink' }}>
-                    {
-                        segmentIndex == 0 ? <TimelineFastSleep data={props.data} /> : <Stage data={props.data} />
-                    }
-                </View> */}
-
-                <View style={{ position: 'relative' }}>
-                    <View style={{ opacity: segmentIndex == 0 ? 1 : 0,height:200 }}>
-                        <TotalTime record={props.data} />
-
-                    </View>
-                    {props.data.scenario == 'FAST_SLEEP' && <View style={{
-                        opacity: segmentIndex == 1 ? 1 : 0,
-                        // position: 'absolute', left: 0, top: 0, right: 0, bottom: 0,
-                    }}>
-                        <TimelineFastSleep data={props.data} first_real_check_time={props.first_real_check_time} />
-                        {/* <Stage data={props.data} /> */}
-                    </View>}
-                </View>
-
-
-                {/* <View style={{ opacity: segmentIndex == 0 ? 1 : 0 }}>
-                    <TimelineFastSleep data={props.data} />
-                </View>
-                {
-                    props.data.scenario == 'FAST_SLEEP' && <View style={{
-                        position: 'absolute', left: 0, top: 0, right: 0, bottom: 0,
-                        opacity: segmentIndex == 1 ? 1 : 0
-                    }}>
-                        <Stage data={props.data} />
-                    </View>
-                } */}
-
-            </View>
-        </View>
-        {
-            props.data.scenario == 'FAST_SLEEP' &&
-            <View style={{ marginBottom: 0 }}>
-                <Segment titles={[
-                    t('feature.track_time_duration.schedule.total_time'),
-                    t('feature.track_time_duration.record_fast_sleep.timeline'),
-                ]} changed={(e) => {
-                    setSegmentIndex(e);
-                    global.segmentIndex = e
-                }} />
-            </View>
-        }
-    </View>
-}

+ 0 - 8
src/pages/clock/Clock2.config.ts

@@ -1,8 +0,0 @@
-export default definePageConfig({
-    usingComponents: {
-        // 'ec-canvas': '../../lib/ec-canvas/ec-canvas',
-        // 'demo':'../../components/demo'
-        'MySVG':'../../components/basic/svg'
-    },
-    "navigationBarTitleText": ""
-})

+ 0 - 58
src/pages/clock/Clock2.scss

@@ -1,58 +0,0 @@
-/* #ifdef weapp */
-.console_box {
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  margin: 20px;
-  padding-top: 40px;
-  padding-bottom: 40px;
-  color: #fff;
-  // margin-bottom: 12px;
-  background-color: #1c1c1c;
-  border-radius: 40px;
-}
-
-/* #endif */
-
-/* #ifdef rn */
-
-/* #endif */
-
-.popDemo {
-  position: fixed;
-  top: 0;
-  left: 0;
-  z-index: 100000;
-  width: 100%;
-  height: 100%;
-  overflow: hidden;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  background-color: rgba($color: #000000, $alpha: 0.5);
-}
-
-.clock_bg {
-  width: 578px;
-  height: 578px;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-}
-
-.swiper {
-  height: 360px;
-  
-}
-
-.console_bg {
-  height: 360px;
-  overflow: hidden;
-  margin-bottom: 24px;
-}
-
-.swiperItem {
-  // height: 300px !important;
-  // height: auto !important;
-  // overflow: visible !important;
-}

+ 0 - 649
src/pages/clock/Clock2.tsx

@@ -1,649 +0,0 @@
-import { Component, PropsWithChildren, useEffect, useRef, useState } from 'react'
-import { View, Text, Button, Input, Picker, Swiper, SwiperItem, Icon, PageContainer, ScrollView } from '@tarojs/components'
-import Tabbar from "@/components/navigation/TabBar";
-import '../index/index.scss'
-import './Clock.scss'
-// import './context/locales/index'
-import '@/context/locales/index'
-import Taro, { useDidShow, usePageScroll, useReady, useRouter, useShareAppMessage } from '@tarojs/taro'
-// import ComponentA from './component'
-
-
-import { useDispatch, useSelector } from 'react-redux';
-import { getInfoSuccess, logoutSuccess } from '@/store/user';
-import { wxPubFollow } from '@/services/permission';
-import { gobalConfigs, staticResources, uploadSessionKey } from '@/services/common';
-import Clocks from '@/features/trackTimeDuration/components/Clock';
-import Console from '@/features/trackTimeDuration/components/Console';
-import Schedule from '@/features/trackTimeDuration/components/Schedule';
-import { getChecks, getClocks } from '@/services/trackTimeDuration';
-import { setScenario } from '@/store/scenario';
-
-import { setSpecifiedStatus, setSpecifiedState, machine } from '@/store/trackTimeMachine';
-import trackTimeService from '@/store/trackTimeMachine';
-import { setWXFollow } from '@/store/permission';
-import Tooltip from '@/components/view/Tooltip'
-import RequestType, { thirdPartRequest } from '@/services/thirdPartRequest'
-import { setConfigs, setTabbarStatus } from '@/store/common'
-import RecordFastSleep from '@/features/trackTimeDuration/components/RecordFastSleep'
-import Box from '@/components/layout/Box'
-import Layout from '@/components/layout/layout'
-import { CheckBoxType, NaviBarTitleShowType, TemplateType } from '@/utils/types'
-import { updateScenario } from '@/store/time'
-import { ConsoleType, changeConsoleStatus } from '@/store/console'
-import TitleView from '@/features/trackTimeDuration/components/TitleView'
-import StatusIndicator from '@/features/trackTimeDuration/components/StatusIndicator'
-import { useTranslation } from 'react-i18next'
-import SectionHeader from '@/components/layout/SectionHeader'
-import Header from '@/components/layout/Header'
-import NoData from '@/components/view/NoData'
-import { ColorType } from '@/context/themes/color'
-import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
-import { ChooseScenarioBtn } from '@/features/common/SpecBtns'
-import { rpxToPx, vibrate } from '@/utils/tools'
-import Modal from '@/components/layout/Modal'
-// import TabBar from '../../components/Tabbar';
-
-// import Rings from '@components/view/Rings';
-
-let useNavigation;
-let AppState;
-if (process.env.TARO_ENV == 'rn') {
-  AppState = require("react-native").AppState
-  useNavigation = require("@react-navigation/native").useNavigation
-}
-
-
-export default function IndexPage() {
-  const dispatch = useDispatch();
-  const { t, i18n } = useTranslation()
-  const [checkData, setCheckData] = useState(null)
-  const user = useSelector((state: any) => state.user);
-  const time = useSelector((state: any) => state.time);
-
-  const consoleData = useSelector((state: any) => state.console);
-  const [counter, setCounter] = useState(0)
-  const [timerId, setTimerId] = useState(null)
-  const [needShowAddTip, setNeedShowAddTip] = useState(false)
-  const [showErrorPage, setErrorPage] = useState(false)
-
-  const [swiperIndex, setSwiperIndex] = useState(0)
-  const [autoPlay, setAutoPlay] = useState(false)
-
-  const [showModal, setShowModal] = useState(false)
-  const [modalDetail, setModalDetail] = useState<any>(null)
-
-  const [showModal2, setShowModal2] = useState(false)
-  const [modalDetail2, setModalDetail2] = useState<any>(null)
-  const [showSingleFastEnd, setShowSingleFastEnd] = useState(false)
-  const [consoleStatus, setConsoleStatus] = useState(consoleData.status)
-  const [showLogin, setShowLogin] = useState(false)
-  const [showTip, setShowTip] = useState(false)
-  const [isModal1, setIsModal1] = useState(false)
-  const [debugInfo, setDebugInfo] = useState(null)
-  const [loaded, setLoaded] = useState(false)
-
-  let navigation;
-  if (useNavigation) {
-    navigation = useNavigation()
-  }
-
-  global.dispatch = dispatch;
-
-  global.checkData = () => {
-    getCheckData()
-  }
-
-  useEffect(() => {
-    if (process.env.TARO_ENV == 'rn') {
-      AppState.addEventListener('change', handleAppStateChange);
-    }
-
-    global.consoleType = 'idle'
-    dispatch(staticResources() as any);
-    // dispatch(gobalConfigs() as any);
-    trackTimeService.onTransition(state => {
-      if ((state.value as any).FAST_SLEEP == 'COMPLETED' ||
-        (state.value as any).FAST == 'ONGOING' ||
-        (state.value as any).SLEEP == 'ONGOING' ||
-        (state.value as any).FAST_SLEEP == 'ONGOING1' ||
-        (state.value as any).FAST_SLEEP == 'ONGOING2' ||
-        (state.value as any).FAST_SLEEP == 'ONGOING3' ||
-        (state.value as any).FAST == 'COMPLETED' ||
-        (state.value as any).SLEEP == 'COMPLETED') {
-        getCheckData()
-      }
-    })
-
-
-  }, [])
-
-  useEffect(() => {
-
-    const currentLanguage = i18n.language;
-    global.language = currentLanguage
-    console.log('current language', currentLanguage)
-  }, [])
-
-  const handleAppStateChange = (nextAppState) => {
-    checkTimeZone()
-  };
-
-  useEffect(() => {
-    setConsoleStatus(consoleData.status)
-    switch (consoleData.status) {
-      // case ConsoleType.going:
-      //   setShowSingleFastEnd(true)
-      //   setTimeout(() => {
-      //     setShowSingleFastEnd(false)
-      //     setSwiperIndex(1)
-      //     setAutoPlay(true)
-      //     dispatch(changeConsoleStatus({ status: ConsoleType.end }))
-      //   }, 2000)
-      //   break
-      case ConsoleType.end:
-        setTimeout(() => {
-          dispatch(changeConsoleStatus({ status: ConsoleType.idle }))
-        }, 2000)
-
-        break
-    }
-  }, [consoleData.status])
-
-  useEffect(() => {
-    if (user.isLogin) {
-      //检查用户是否添加过小程序
-      checkAddToMini();
-      //检查session是否过期
-      checkSession()
-      getCheckData()
-    }
-  }, [user.isLogin])
-
-  function checkTimeZone() {
-    var split = new Date().toString().split(' ');
-    var timeZoneFormatted = split[split.length - 2];
-
-
-    Taro.getStorage({
-      key: 'last_tz',
-      success: function (res) {
-        if (res.data && res.data != timeZoneFormatted) {
-
-          if (global.currentStatus != 'WAIT_FOR_START') {
-            Taro.showModal({
-              title: t('feature.track_time_duration.change_tz_alert.title'),
-              content: t('feature.track_time_duration.change_tz_alert.content', { tz: timeZoneFormatted }),
-              showCancel: false,
-              confirmText: t('feature.track_time_duration.change_tz_alert.confirm'),
-            })
-          }
-        }
-      },
-      complete: function () {
-        Taro.setStorage({ key: 'last_tz', data: timeZoneFormatted })
-      }
-    })
-  }
-
-  function checkSession() {
-    if (process.env.TARO_ENV === 'weapp') {
-      thirdPartRequest(RequestType.RequestTypeCheckSession).then(res => {
-      }).catch(err => {
-        console.log('session_key 已经失效,需要更新登录code')
-        thirdPartRequest(RequestType.RequestTypeWXLogin).then(result => {
-          uploadSessionKey({ type: 'WX_MP', code: (result as any).code });
-        })
-      })
-    }
-  }
-
-  function checkAddToMini() {
-    process.env.TARO_ENV == 'weapp' &&
-      wx.checkIsAddedToMyMiniProgram({
-        success: (res) => {
-          if (!res.added) {
-            setNeedShowAddTip(true)
-          }
-        },
-        fail: (e) => {
-        }
-      });
-  }
-
-  useEffect(() => {
-    startTimer();
-    return () => {
-      // 在组件卸载时清除定时器
-      if (timerId) {
-        clearInterval(timerId);
-      }
-    };
-  }, []);
-
-  const startTimer = () => {
-    // 避免重复启动定时器
-    if (timerId) {
-      return;
-    }
-
-    const id = setInterval(() => {
-      setShowLogin(true)
-      if (global.showModal) {
-        return
-      }
-      setCounter((prevCounter) => prevCounter + 1);
-      //每天0点刷新一下打卡数据
-      var now = new Date()
-      if (now.getHours() == 0 && now.getMinutes() == 0) {
-        getCheckData()
-      }
-    }, 1000);
-
-    setTimerId(id as any);
-  };
-
-
-  useReady(async () => {
-
-
-    const userData = await getStorage('userData');
-    if (userData) {
-      dispatch(getInfoSuccess(JSON.parse(userData as string)) as any);
-      setTimeout(() => {
-        checkWXPubFollow()
-        getCheckData()
-
-      }, 200)
-
-    }
-  })
-
-  if (process.env.TARO_ENV == 'weapp') {
-    useShareAppMessage((e) => {
-      return {
-        title: t('feature.track_time_duration.common.share_title'),
-        path: 'pages/clock/Clock'
-      }
-    })
-  }
-
-  function clearTempScenarioCache() {
-    global.schedule_fast = null
-    global.schedule_sleep = null
-    Taro.removeStorage({
-      key: 'tempScenario',
-      success: function (res) {
-      }
-    })
-  }
-
-  usePageScroll((e) => {
-  })
-
-  useDidShow(() => {
-    // global.updateTab(0)
-    global.showModal = false;
-    if (user.isLogin) {
-      checkWXPubFollow()
-      // getCheckData();
-    }
-    clearTempScenarioCache()
-  })
-
-  global.refreshTime = () => {
-    getCheckData()
-  }
-
-  global.showSingleFastEnd = () => {
-    setShowSingleFastEnd(true)
-  }
-
-  function tapClock(e) {
-    if (process.env.TARO_ENV == 'weapp') {
-      e.stopPropagation()
-    }
-    if (!user.isLogin) {
-      jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-    }
-    else {
-      vibrate()
-    }
-  }
-
-  function tapLogin(e) {
-    jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-  }
-
-  function getCheckData() {
-    var res = global.selectData
-    setErrorPage(false)
-    dispatch(updateScenario((res as any).current_record))
-    dispatch(setConfigs((res as any).time_input_schema));
-    dispatch(setScenario((res as any).scenario));
-
-    if ((res as any).theme_color) {
-      global.fastColor = (res as any).theme_color.fast
-      global.sleepColor = (res as any).theme_color.sleep
-    }
-    machine.context.checkData = res as any;
-
-    global.scenario = (res as any).current_record.scenario;
-    const currentState = trackTimeService.getSnapshot();
-    let json = {};
-    var key = (res as any).current_record.scenario
-    var status = (res as any).current_record.status
-    json[key] = status
-    currentState.value = json;
-    machine.context.currentStatus = `${key}.${status}`;//'mixed.ON_GOING2'
-    setCheckData(res as any)
-
-    setLoaded(true)
-
-    if ((res as any).current_record.status != 'ONGOING1') {
-      setSwiperIndex(0)
-    }
-    else {
-      if (global.consoleType == 'going') {
-        setShowSingleFastEnd(true)
-        setTimeout(() => {
-          setShowSingleFastEnd(false)
-          setSwiperIndex(1)
-          setAutoPlay(true)
-          global.consoleType = 'end'
-          dispatch(changeConsoleStatus({ status: ConsoleType.end }))
-          setTimeout(() => {
-            global.consoleType = 'idle'
-          }, 2000)
-        }, 500)
-      }
-      else {
-      }
-    }
-    return
-    getClocks().then(res => {
-      debugger
-      setErrorPage(false)
-      dispatch(updateScenario((res as any).current_record))
-      dispatch(setConfigs((res as any).time_input_schema));
-      dispatch(setScenario((res as any).scenario));
-
-      if ((res as any).theme_color) {
-        global.fastColor = (res as any).theme_color.fast
-        global.sleepColor = (res as any).theme_color.sleep
-      }
-      machine.context.checkData = res as any;
-
-      global.scenario = (res as any).current_record.scenario;
-      const currentState = trackTimeService.getSnapshot();
-      let json = {};
-      var key = (res as any).current_record.scenario
-      var status = (res as any).current_record.status
-      json[key] = status
-      currentState.value = json;
-      machine.context.currentStatus = `${key}.${status}`;//'mixed.ON_GOING2'
-      setCheckData(res as any)
-
-      setLoaded(true)
-
-      if ((res as any).current_record.status != 'ONGOING1') {
-        setSwiperIndex(0)
-      }
-      else {
-        if (global.consoleType == 'going') {
-          setShowSingleFastEnd(true)
-          setTimeout(() => {
-            setShowSingleFastEnd(false)
-            setSwiperIndex(1)
-            setAutoPlay(true)
-            global.consoleType = 'end'
-            dispatch(changeConsoleStatus({ status: ConsoleType.end }))
-            setTimeout(() => {
-              global.consoleType = 'idle'
-            }, 2000)
-          }, 500)
-        }
-        else {
-        }
-      }
-
-    }).catch(e => {
-      setLoaded(true)
-      if (!checkData) {
-        setErrorPage(true)
-      }
-      else {
-      }
-    })
-  }
-
-  function checkWXPubFollow() {
-    var params;
-    if (global.forceRefreshWXPub) {
-      params = {
-        force_refresh: true
-      }
-    }
-    global.forceRefreshWXPub = false
-    wxPubFollow(params).then(res => {
-      dispatch(setWXFollow((res as any).wx_pub_followed));
-      console.log('当前的关注状态' + (res as any).wx_pub_followed);
-
-    })
-  }
-
-  async function getStorage(key: string) {
-    try {
-      const res = await Taro.getStorage({ key });
-      return res.data;
-    } catch {
-      return '';
-    }
-  }
-
-  function schedule() {
-    if (!user.isLogin) {
-      return <View />
-    }
-    return <Schedule data={(checkData as any).current_record} />
-  }
-
-  function needSwiper() {
-    var isNeed = time.scenario == 'FAST_SLEEP' &&
-      (time.status == 'WAIT_FOR_START' ||
-        time.status == 'ONGOING1' ||
-        time.status == 'ONGOING2')
-    if (showSingleFastEnd) {
-      return false;
-    }
-    return isNeed
-  }
-
-  global.showClockModal = (isShow: boolean, detail: any, debugNode?: any) => {
-    global.showModal = isShow
-    setIsModal1(true)
-    setDebugInfo(debugNode)
-    setShowModal(isShow)
-    setModalDetail(detail)
-  }
-
-  global.showClockModal2 = (isShow: boolean, detail: any) => {
-    setDebugInfo(null)
-    global.showModal = isShow
-    setIsModal1(false)
-    setShowModal2(isShow)
-    setModalDetail2(detail)
-  }
-
-  function headerView() {
-    return <TitleView title={t('page.clock.title')} showAddBtn={loaded && !showErrorPage ? true : false}>
-      <StatusIndicator />
-    </TitleView>
-  }
-
-  function errorView() {
-    if (showErrorPage) {
-      return <NoData refresh={() => { getCheckData() }} />
-    }
-    return <View />
-  }
-
-  function consoleView() {
-    if (!checkData) {
-      return <View />
-    }
-    return <View className='console_bg'>
-      {
-        needSwiper() ? <Swiper className='swiper' indicatorColor='#333'
-          indicatorActiveColor='#999'
-          current={swiperIndex}
-          autoplay={autoPlay}
-          duration={300}
-          interval={300}
-          indicator-offset={[0, -30]}
-          indicator-height={30}
-          indicatorDots={global.consoleType == 'idle'}
-          onChange={(e) => {
-            setSwiperIndex(e.detail.current)
-            if (e.detail.current == 0)
-              setAutoPlay(false)
-          }}
-        >
-          <SwiperItem className='swiperItem'>
-            <Console />
-
-          </SwiperItem>
-
-          <SwiperItem className='swiperItem'>
-            <Console isNextStep={true} />
-          </SwiperItem>
-        </Swiper> :
-          <Console isNextStep={showSingleFastEnd} />
-
-      }
-    </View>
-  }
-
-  usePageScroll((e) => {
-    if (e.scrollTop > 70) {
-      setShowTip(true)
-    }
-    else {
-      setShowTip(false)
-    }
-
-  })
-
-  function modalContent() {
-    if (showModal || showModal2) {
-      if (process.env.TARO_ENV == 'weapp') {
-        return <Modal
-          testInfo={debugInfo}
-          dismiss={() => {
-            setDebugInfo(null)
-            setShowModal(false); setShowModal2(false)
-          }}
-          confirm={() => { }}>
-          {
-            isModal1 ? modalDetail : modalDetail2
-          }
-        </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={() => {
-            Taro.hideTabBar();
-          }}
-          onBeforeLeave={() => {
-            Taro.showTabBar();
-          }}
-          onClick={() => { alert('b') }}
-          onClickOverlay={() => { alert('a') }}
-          onAfterLeave={() => { setShowModal(false); setShowModal2(false) }}
-          show={showModal || showModal2} round={true} overlay={true} position='bottom'
-        >
-          {
-            isModal1 ? modalDetail : modalDetail2
-          }
-        </PageContainer>
-      }
-    }
-    return <View />
-  }
-
-
-  function detail() {
-    return (
-      <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
-        <View style={{ flex: 1, flexDirection: 'column', display: 'flex', backgroundColor: '#000', color: '#fff' }}>
-          {
-            needShowAddTip && showTip && <Tooltip title="添加到我的小程序" closeTip={() => { setNeedShowAddTip(false) }} />
-          }
-
-          <Box>
-            <View className='clock_bg' onClick={tapClock}>
-              <Clocks showCoverView={!global.showModal} />
-            </View>
-          </Box>
-          {
-            !user.isLogin && showLogin && <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginTop: rpxToPx(36) }}>
-              <ChooseScenarioBtn title={t('feature.auth.login.login_now')} background={ColorType.fast} onClick={tapLogin} />
-            </View>
-          }
-          {
-            errorView()
-          }
-          {
-            user.isLogin && consoleView()
-          }
-          {
-            user.isLogin && checkData && schedule()
-          }
-          {
-            user.isLogin && <View style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
-              {
-                checkData && (checkData as any).latest_record &&
-                <SectionHeader top={48} bottom={24} title={t('feature.track_time_duration.record_fast_sleep.header.latest_record')}>
-                  <Header title='' action={() => {
-                    jumpPage('/pages/common/RecordsHistory?type=time&title=time', 'RecordsHistory', navigation, {
-                      type: 'time',
-                      title: 'time'
-                    })
-                  }} />
-                </SectionHeader>
-              }
-            </View>
-          }
-          {
-            user.isLogin && checkData && (checkData as any).latest_record &&
-            <RecordFastSleep type='latest' data={(checkData as any).latest_record} delSuccess={getCheckData} index={10000}/>
-          }
-          <View style={{ height: process.env.TARO_ENV == 'rn' ? 0 : 100 }} />
-        </View>
-
-        {
-          modalContent()
-        }
-
-      </Layout>
-    )
-  }
-
-  // if (process.env.TARO_ENV == 'rn') {
-  //   return <ScrollView>
-  //     {detail()}
-  //   </ScrollView>
-  // }
-
-
-
-  return <View>
-    {detail()}
-    {/* <Tabbar index={0} /> */}
-  </View>
-}

+ 0 - 514
src/pages/clock/Index的副本.tsx

@@ -1,514 +0,0 @@
-import { View, Text, Image, ScrollView, PageContainer, Swiper, SwiperItem, Switch } from "@tarojs/components";
-import Tabbar from "@/components/navigation/TabBar";
-import IndexItem from '@/features/trackTimeDuration/components/IndexItem';
-import Rings from "@/features/trackTimeDuration/components/Rings";
-import './Index.scss'
-import { useDispatch, useSelector } from "react-redux";
-import { useDidShow, useReady } from "@tarojs/taro";
-import Taro from "@tarojs/taro";
-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, setStep } from "@/store/scenario";
-import { useEffect, useState } from "react";
-import { IconPlus, IconRadioCheck, IconRadioCross } from "@/components/basic/Icons";
-import { ColorType } from "@/context/themes/color";
-import { bigRingRadius, getBgRing, getCommon, getDot, getSchedule, ringWidth, smallRingRadius } from "@/features/trackTimeDuration/hooks/RingData";
-import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
-import IndexConsole from "@/features/trackTimeDuration/components/IndexConsole";
-import Modal from '@/components/layout/Modal'
-import { rpxToPx } from "@/utils/tools";
-import RecordFastSleep from "@/features/trackTimeDuration/components/RecordFastSleep";
-import DayLight from "@/features/trackTimeDuration/components/DayLight";
-import { getInfo } from "@/services/user";
-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
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-export default function Page() {
-    const dispatch = useDispatch();
-    global.dispatch = dispatch;
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    const { t } = useTranslation()
-    const user = useSelector((state: any) => state.user);
-    const time = useSelector((state: any) => state.time);
-    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 [debugInfo, setDebugInfo] = useState(null)
-
-    const [isMulti, setIsMulti] = useState(false)
-    const [records, setRecords] = useState([])
-
-    const [multiData, setMultiData] = useState([
-        {
-            title: '睡前断食',
-            checked: false
-        },
-        {
-            title: '睡眠中断食',
-            checked: false
-        },
-        {
-            title: '起床后断食',
-            checked: false
-        },
-    ])
-
-    useEffect(() => {
-        setInterval(() => {
-            if (isPause) {
-                return
-            }
-            setCount((prevCounter) => prevCounter + 1)
-        }, 1000)
-    }, [])
-
-    useEffect(() => {
-        getCheckData()
-    }, [user.isLogin, time.status])
-
-    useReady(async () => {
-        const userData = await getStorage('userData');
-        if (userData) {
-            dispatch(getInfoSuccess(JSON.parse(userData as string)) as any);
-            // setTimeout(() => {
-            //     // checkWXPubFollow()
-            //     getCheckData()
-
-            // }, 200)
-            getHistory()
-
-
-        }
-
-    })
-
-    useDidShow(() => {
-        if (user.isLogin)
-            refresh()
-    })
-
-    global.refreshIndex = () => {
-        setCount((prevCounter) => prevCounter + 1)
-    }
-
-    function refresh() {
-        getInfo().then(res => {
-            dispatch(getInfoSuccess(res))
-        }).catch(e => {
-
-        })
-    }
-
-    function getCheckData() {
-        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)
-            getClockRecords({
-                page: 1,
-                limit: 1,
-                completed: true
-            }).then(res => {
-                setRecords((res as any).data)
-            })
-    }
-
-    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;
-    }
-
-    const durationArc = (start_time: number, end_time: number) => {
-        var duration = (end_time - start_time) / 1000;
-        return duration / (24 * 3600) * 2 * Math.PI;
-    }
-
-    function bigRing() {
-        var currentRecord = (homeData as any).fast_sleep.current_record
-
-        var common = getCommon(null, true)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        var realRing1 = getSchedule(currentRecord, true, true)
-        realRing1.color = ColorType.fast + '66'
-
-        var list: any = []
-        if (multiData[0].checked) {
-
-            const realRingBig: RealRing = {
-                color: global.fastColor ? global.fastColor : ColorType.fast,
-                startArc: startArc(currentRecord.fast.target_start_time),
-                durationArc: durationArc(currentRecord.fast.target_start_time, currentRecord.sleep.target_start_time)
-            }
-
-            list.push(realRingBig)
-        }
-        if (multiData[1].checked) {
-            const realRingBig: RealRing = {
-                color: global.fastColor ? global.fastColor : ColorType.fast,
-                startArc: startArc(currentRecord.sleep.target_start_time),
-                durationArc: durationArc(currentRecord.sleep.target_start_time, currentRecord.sleep.target_end_time)
-            }
-
-            list.push(realRingBig)
-        }
-        if (multiData[2].checked) {
-            const realRingBig: RealRing = {
-                color: global.fastColor ? global.fastColor : ColorType.fast,
-                startArc: startArc(currentRecord.sleep.target_end_time),
-                durationArc: durationArc(currentRecord.sleep.target_end_time, currentRecord.fast.target_end_time)
-            }
-
-            list.push(realRingBig)
-        }
-
-        var points: any = []
-        for (var i = 0; i < 12; i++) {
-            var dot: CurrentDot = {
-                color: 'red',
-                lineWidth: 8,
-                borderColor: 'black',
-                timestamp: new Date().getTime() + i * 3600 * 1000 * 2
-            }
-            points.push(dot)
-        }
-        return <Rings common={common} bgRing={bgRing} realRing={realRing1} stageList={list} dotList={points} canvasId={'testA'} />
-
-    }
-
-    function smallRing() {
-        var common = getCommon(null, true)
-        common.radius = smallRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        var realRing1 = getSchedule((homeData as any).fast_sleep.current_record, false, false)
-        return <Rings common={common} bgRing={bgRing} realRing={realRing1} canvasId={'testB'} />
-    }
-
-    function rings() {
-        return <View style={{ display: 'flex', flexDirection: 'row', marginLeft: 100, marginBottom: 30 }}>
-            <View style={{ position: 'relative', zIndex: 1 }}>
-                {
-                    bigRing()
-                }
-                {
-                    <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                        {
-                            smallRing()
-                        }
-                    </View>
-                }
-
-            </View>
-        </View>
-    }
-
-    global.indexPageRefresh = () => {
-        getCheckData()
-    }
-
-    global.showIndexModal = (isShow: boolean, detail: any, debugNode?: any) => {
-        global.showModal = isShow
-        setDebugInfo(debugNode)
-        setShowModal(isShow)
-        setModalDetail(detail)
-    }
-
-    global.showIndexModal2 = (isShow: boolean, detail: any) => {
-        setDebugInfo(null)
-        global.showModal = isShow
-        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') {
-                return <Modal
-                    testInfo={debugInfo}
-                    dismiss={() => {
-                        setDebugInfo(null)
-                        setShowModal(false);
-                        setShowModal2(false);
-                    }}
-                    confirm={() => { }}>
-                    {
-                        showModal ? modalDetail :  modalDetail2 
-                    }
-                </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={() => {
-                        Taro.hideTabBar();
-                    }}
-                    onBeforeLeave={() => {
-                        Taro.showTabBar();
-                    }}
-                    onClick={() => { alert('b') }}
-                    onClickOverlay={() => { alert('a') }}
-                    onAfterLeave={() => { setShowModal(false); setShowModal2(false) }}
-                    show={showModal || showModal2} round={true} overlay={true} position='bottom'
-                >
-                    {
-                        showModal ? modalDetail :  modalDetail2
-                    }
-                </PageContainer>
-            }
-        }
-        return <View />
-    }
-
-    async function getStorage(key: string) {
-        try {
-            const res = await Taro.getStorage({ key });
-            return res.data;
-        } catch {
-            return '';
-        }
-    }
-    if (!homeData) {
-        return <View>
-            <Tabbar index={0} />
-        </View>
-    }
-
-    function more() {
-        jumpPage('/pages/common/RecordsHistory?type=time&title=time', 'RecordsHistory', navigation, {
-            type: 'time',
-            title: 'time'
-        })
-    }
-
-
-
-    function headerView() {
-        return <ClockHeader homeData={homeData} />
-    }
-
-    var timestamp = new Date().getTime()
-
-    function render() {
-        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' ?
-                        <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>
-
-                            {
-                                (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>
-                }
-                {
-                    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>
-                }
-
-                {
-                    records.length > 0 && <View className="fast_sleep_item_bg">
-                        <RecordFastSleep data={records[0]} type='record' index={-20000} />
-                    </View>
-                }
-
-                {
-                    user.isLogin && <View>
-                        <Text className="discovery">周统计</Text>
-                        <WeekCalendar />
-                    </View>
-                }
-
-                <View style={{ height: 100 }} />
-                {
-                    modalContent()
-                }
-
-                {
-                    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>
-    // }
-    return render()
-}