leon 1 éve
szülő
commit
4444ba8979

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 3 - 0
src/components/basic/Icons.tsx


+ 26 - 24
src/features/trackTimeDuration/components/AllRings.tsx

@@ -12,7 +12,7 @@ import { TimeFormatter } from '@/utils/time_format'
 import { useSelector } from 'react-redux'
 import { RealRing } from '@/features/trackTimeDuration/components/Rings'
 
-export default function AllRings(props: { data: any, time: any }) {
+export default function AllRings(props: { data?: any, time?: any }) {
     const [showRing, setShowRing] = useState(false)
     const [record, setRecord] = useState(props.data.current_record);
     const user = useSelector((state: any) => state.user);
@@ -248,7 +248,7 @@ export default function AllRings(props: { data: any, time: any }) {
     function rings() {
         return <View style={{
             position: 'relative', zIndex: 1,
-            marginLeft:  -6,
+            marginLeft: -6,
         }}>
             {
                 bigRing()
@@ -328,34 +328,36 @@ export default function AllRings(props: { data: any, time: any }) {
 
 
     function popDetail() {
-        return <View className="ring_full_container">
-            <View className="time_operate_item1">
-                <View className='fast_sleep_item three_ring_card_detail'>
-                    {
-                        rings()
-                    }
-                    <View className="duration_bg2" style={{ marginLeft: rpxToPx(68), height: bigRingRadius * 2, overflow: 'visible' }}>
-
-                        <Text className="duration_title2">{t('feature.common.overnight')}</Text>
-                        <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>
-                        }
+        return <Box>
+            <View className="ring_full_container">
+                <View className="time_operate_item1">
+                    <View className='fast_sleep_item three_ring_card_detail'>
                         {
-                            (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>
+                            rings()
                         }
-                    </View>
+                        <View className="duration_bg2" style={{ marginLeft: rpxToPx(68), height: bigRingRadius * 2, overflow: 'visible' }}>
+
+                            <Text className="duration_title2">{t('feature.common.overnight')}</Text>
+                            <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>
 
 
+                    </View>
                 </View>
             </View>
-        </View>
+        </Box>
     }
 
     function modalContent() {

+ 15 - 2
src/features/trackTimeDuration/components/DayNightCard.scss

@@ -217,10 +217,17 @@
     z-index: 0;
 }
 
+.day_card_header{
+    position: absolute;
+    right: 0;
+    top: -16px;
+
+}
+
 .day_card_footer {
     position: absolute;
-    right: -20px;
-    bottom: -20px;
+    right: 0px;
+    bottom: -8px;
     display: flex;
     flex-direction: row;
     align-items: center;
@@ -237,4 +244,10 @@
     width: 40px;
     height: 40px;
     opacity: 0.2;
+}
+
+.footer_desc_text{
+    font-size: 24px;
+    line-height: 24px;
+    margin-left: 5px;
 }

+ 90 - 41
src/features/trackTimeDuration/components/DayNightCard.tsx

@@ -19,6 +19,7 @@ import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Ri
 import Rings from "./Rings";
 import { bigRingRadius, getBgRing, getCommon, getDot, ringWidth } from '../hooks/RingData'
 import '@/utils/ring_card.scss';
+import { IconNight, IconSunrise, IconSunset } from '@/components/basic/Icons'
 
 let useNavigation;
 if (process.env.TARO_ENV == 'rn') {
@@ -59,6 +60,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
     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 [status,setStatus] = useState('')
 
 
     const [showDetailModal, setShowDetailModal] = useState(false)
@@ -85,25 +87,18 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                 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 => {
-                console.log(data)
-                setAuthInfo(data as any)
-                setDetail(data as any)
-                updateDate(data)
-                locationDetail = data
-                global.locationDetail = locationDetail
-                Taro.setStorage({
-                    key: 'gps',
-                    data: JSON.stringify(data as any)
-                })
-            })
+            getLatestLocation()
+
+            if (props.isNight) {
+                global.refreshNight = () => {
+                    getLatestLocation()
+                }
+            }
+            else {
+                global.refreshDay = () => {
+                    getLatestLocation()
+                }
+            }
 
         } else {
             setSunriseTime('06:00');
@@ -195,6 +190,28 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
         }
     })
 
+    function getLatestLocation() {
+        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 => {
+            console.log(data)
+            setAuthInfo(data as any)
+            setDetail(data as any)
+            updateDate(data)
+            locationDetail = data
+            global.locationDetail = locationDetail
+            Taro.setStorage({
+                key: 'gps',
+                data: JSON.stringify(data as any)
+            })
+        })
+    }
+
     async function getGPSCache() {
         var gps = await getStorage('gps')
         if (gps && gps.length > 0) {
@@ -925,6 +942,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
             durationArc: 2
         }
 
+        
         if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
             realRingBig.color = ColorType.night
             var duration = (authInfo.night_completed.sunrise_ts - authInfo.night_completed.sunset_ts) / 1000
@@ -934,7 +952,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
             return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} canvasId={'ddddsss' + 'index_day'} />
 
         }
-
+        debugger
 
         var sunRise = 24 * 60 + 6 * 60
         var sunSet = 18 * 60
@@ -1130,48 +1148,74 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
 
     function completedDate() {
         if (props.isNight) {
-            if (authInfo.night_completed && new Date().getTime()>authInfo.night_completed.sunrise_ts) {
-                return TimeFormatter.getMonthAndDayByTimestamp(authInfo.night_completed.sunset_ts)
+            if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
+                return TimeFormatter.dateDescription(authInfo.night_completed.sunset_ts)
             }
             return ''
         }
-        if (authInfo.day_completed && new Date().getTime()>authInfo.day_completed.sunset_ts) {
-            return TimeFormatter.getMonthAndDayByTimestamp(authInfo.day_completed.sunrise_ts)
+        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
+            return TimeFormatter.dateDescription(authInfo.day_completed.sunrise_ts)
         }
         return ''
     }
 
-    function showArrow(){
+    function showArrow() {
         if (props.isNight) {
-            if (authInfo.night_completed && new Date().getTime()>authInfo.night_completed.sunrise_ts) {
+            if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
                 return true
             }
             return false
         }
-        if (authInfo.day_completed && new Date().getTime()>authInfo.day_completed.sunset_ts) {
+        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
             return true
         }
         return false
     }
 
-    function footerDesc(){
+    function currentStatus(){
+        if (showArrow()){
+            return '过去'
+        }
+        var strTime = props.isNight?getSunsetDuration():getSunriseDuration()
+        return (strTime.indexOf('小时')!=-1||strTime.indexOf('分钟')!=-1)?'即将到来':'当前'
+    }
+
+    function footerDesc() {
         var now = new Date()
         if (props.isNight) {
             if (now.getTime() < sunsetDate.getTime()) {
-                return '距日落'+TimeFormatter.countdown(sunsetDate.getTime())
-                
+                return '距日落' + TimeFormatter.countdown(sunsetDate.getTime())
+
             }
-            return '距日出'+TimeFormatter.countdown(sunriseTmrDate.getTime())
+            return '距日出' + TimeFormatter.countdown(sunriseTmrDate.getTime())
         }
 
-        if (now.getTime() > sunriseDate.getTime() && now.getTime()<sunsetDate.getTime()) {
-            
-            return '距日落'+TimeFormatter.countdown(sunsetDate.getTime())
+        if (now.getTime() > sunriseDate.getTime() && now.getTime() < sunsetDate.getTime()) {
+
+            return '距日落' + TimeFormatter.countdown(sunsetDate.getTime())
         }
-        return '距日出'+TimeFormatter.countdown(sunriseDate.getTime())
-        
-        
-        
+        return '距日出' + TimeFormatter.countdown(sunriseDate.getTime())
+
+
+
+    }
+
+    function footerIcon() {
+        var now = new Date()
+        if (props.isNight) {
+            if (now.getTime() < sunsetDate.getTime()) {
+                return <IconSunset color={ColorType.night + '66'} width={14} />
+
+            }
+            return <IconSunrise color={ColorType.night + '66'} width={14} />
+        }
+
+        if (now.getTime() > sunriseDate.getTime() && now.getTime() < sunsetDate.getTime()) {
+
+            return <IconSunset color={ColorType.day + '66'} width={14} />
+        }
+        return <IconSunrise color={ColorType.day + '66'} width={14} />
+
     }
 
     return <Box><View style={{ position: 'relative' }}>
@@ -1204,8 +1248,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                             {/* <Text className='duration_value22' style={{ color: !props.isNight ? ColorType.night : ColorType.day }}>{!props.isNight ? getSunsetTime() : getSunriseTime()}</Text> */}
 
                         </View>
-                        {/* <Image className="arrow2" src={require('@/assets/images/arrow3.png')} /> */}
-                        <View style={{ position: 'absolute', right: -rpxToPx(20), top: -rpxToPx(20) }}>
+                        {/* <View style={{ position: 'absolute', right: -rpxToPx(20), top: -rpxToPx(20) }}>
                             {
                                 authInfo && authInfo.lat ?
                                     <View style={{ display: 'flex', flexDirection: 'row' }} onClick={operate}>
@@ -1218,6 +1261,9 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                                         </View>
                                     </View>
                             }
+                        </View> */}
+                        <View className='day_card_header'>
+                        <View className='free' style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#1C1C1C' }}>{currentStatus()}</View>
                         </View>
                         <View className='day_card_footer'>
                             <Text className='day_card_footer_date'>
@@ -1228,9 +1274,12 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                             {
                                 showArrow() && <Image className="card_arrow" src={require('@/assets/images/arrow3.png')} />
                             }
+                            {
+                                !showArrow() && footerIcon()
+                            }
 
                             {
-                                !showArrow() && <Text style={{color:'#fff'}}>{footerDesc()}</Text>
+                                !showArrow() && <Text className='footer_desc_text' style={{ color: props.isNight?ColorType.night:ColorType.day,opacity:0.4 }}>{footerDesc()}</Text>
                             }
                         </View>
                     </View>

+ 160 - 60
src/features/trackTimeDuration/components/DayNightDetailPopup.tsx

@@ -1,7 +1,7 @@
 import { View, Text } from '@tarojs/components'
 import './CircadianDetailPopup.scss'
 import { useTranslation } from 'react-i18next'
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
 import { rpxToPx } from '@/utils/tools'
 import { TimeFormatter } from '@/utils/time_format'
 import { useSelector } from 'react-redux'
@@ -17,20 +17,59 @@ export default function DayNightDetailPopup(props: {
     sunsetTime: any,
     sunriseTime: any,
     sunriseTmrTime: any,
-    nightDate:any,
-    dayDate:any,
-    onClose: Function
+    nightDate: any,
+    dayDate: any,
+    onClose: Function,
 }) {
     const dayNight = useSelector((state: any) => state.night);
     const day = useSelector((state: any) => state.day);
     const [tabIndex, setTabIndex] = useState(0)
     const { t } = useTranslation()
 
+    useEffect(() => {
+        if (isCompleted()) {
+            setTabIndex(1)
+        }
+    }, [])
+
     function getTitle() {
         return props.isNight ? t('feature.day_night.night_popover') : t('feature.day_night.day_popover')
     }
 
+    function getCompletedTitle(){
+        if (props.isNight){
+            return TimeFormatter.getDayOfWeek(new Date(props.authInfo.night_completed.sunset_ts).getDay(),true)
+        }
+        return TimeFormatter.getDayOfWeek(new Date(props.authInfo.night_completed.sunrise_ts).getDay(),true)
+    }
+
+    function getSubTitle(){
+        if (props.isNight){
+            return TimeFormatter.getMonthAndDayByTimestamp(props.authInfo.night_completed.sunset_ts)
+        }
+        return TimeFormatter.getMonthAndDayByTimestamp(props.authInfo.night_completed.sunrise_ts)
+    }
+
+    function isCompleted() {
+        if (props.isNight) {
+            if (props.authInfo && props.authInfo.night_completed && new Date().getTime() > props.authInfo.night_completed.sunrise_ts) {
+                return true
+            }
+        }
+        else {
+            if (props.authInfo && props.authInfo.day_completed && new Date().getTime() > props.authInfo.day_completed.sunset_ts) {
+
+                return true
+            }
+        }
+        return false
+
+    }
+
     function nightDuration() {
+        if (isCompleted()) {
+            return TimeFormatter.calculateTimeDifference(props.authInfo.night_completed.sunset_ts, props.authInfo.night_completed.sunrise_ts);
+        }
 
         var sunRiseObj = dayNight.nightRingSunrise
         var sunSetObj = dayNight.nightRingSunset
@@ -46,6 +85,9 @@ export default function DayNightDetailPopup(props: {
     }
 
     function dayDuration() {
+        if (isCompleted()) {
+            return TimeFormatter.calculateTimeDifference(props.authInfo.day_completed.sunrise_ts, props.authInfo.day_completed.sunset_ts);
+        }
         var sunRiseObj = day.dayRingSunrise
         var sunSetObj = day.dayRingSunset
         var sunRise = parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
@@ -174,34 +216,37 @@ export default function DayNightDetailPopup(props: {
             <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
                 <Text className='pop_duration_txt'>{props.isNight ? nightDuration() : dayDuration()}</Text>
             </View>
-            <View style={{ marginTop: rpxToPx(20), display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                <View className='countdown_time_bg'>
-                    <Text className='title'>{timeDesc()}</Text>
-                    <Text className='value' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount()}</Text>
-                </View>
-                {
-                    showExtraData() && <View className='countdown_time_bg'>
-                        <Text className='title'>{timeDesc2()}</Text>
-                        <Text className='value' style={{ opacity: 0.4, color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount2()}</Text>
+            {
+                !isCompleted() && <View style={{ marginTop: rpxToPx(20), display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+                    <View className='countdown_time_bg'>
+                        <Text className='title'>{timeDesc()}</Text>
+                        <Text className='value' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount()}</Text>
                     </View>
-                }
+                    {
+                        showExtraData() && <View className='countdown_time_bg'>
+                            <Text className='title'>{timeDesc2()}</Text>
+                            <Text className='value' style={{ opacity: 0.4, color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount2()}</Text>
+                        </View>
+                    }
+
+                </View>
+            }
 
-            </View>
         </View>
     }
 
     function nightDurationDesc() {
         if (!props.authInfo || !(props.authInfo as any).lat) {
             if (new Date().getHours() >= 6) {
-                return [t('feature.day_night.tonight'),t('feature.day_night.tomorrow_morning')]
+                return [t('feature.day_night.tonight'), t('feature.day_night.tomorrow_morning')]
             }
-            return [t('feature.day_night.last_night'),t('feature.day_night.this_morning')]
+            return [t('feature.day_night.last_night'), t('feature.day_night.this_morning')]
             // return `Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
         }
         if (props.nightDate.getDate() == new Date().getDate()) {
-            return [t('feature.day_night.tonight'),t('feature.day_night.tomorrow_morning')]
+            return [t('feature.day_night.tonight'), t('feature.day_night.tomorrow_morning')]
         }
-        return [t('feature.day_night.last_night'),t('feature.day_night.this_morning')]
+        return [t('feature.day_night.last_night'), t('feature.day_night.this_morning')]
         //`Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
     }
 
@@ -225,49 +270,98 @@ export default function DayNightDetailPopup(props: {
 
     function events() {
         let timelineItems: any = []
-        
+
         if (props.isNight) {
-            var list = nightDurationDesc()
-            timelineItems.push(
-                {
-                    status: showExtraData() ? 'done' : 'padding',
-                    title: '日落',//list[0],
-                    content: list[0]+' '+props.sunsetTime,
-                    date: '',
-                    color: ColorType.night
-                }
-            )
-
-            timelineItems.push(
-                {
-                    status: 'padding',
-                    title: '日出',//list[1],
-                    content: list[1]+' '+props.sunriseTmrTime,
-                    date: '',
-                    color: ColorType.night
-                }
-            )
+            if (isCompleted()) {
+                timelineItems.push(
+                    {
+                        status: 'done',
+                        title: '日落',//list[0],
+                        content: TimeFormatter.dateTimeFormate(props.authInfo.night_completed.sunset_ts, true),
+                        date: '',
+                        color: ColorType.night
+                    }
+                )
+
+                timelineItems.push(
+                    {
+                        status: 'done',
+                        title: '日出',//list[1],
+                        content: TimeFormatter.dateTimeFormate(props.authInfo.night_completed.sunrise_ts, true),
+                        date: '',
+                        color: ColorType.night
+                    }
+                )
+            }
+            else {
+
+                var list = nightDurationDesc()
+                timelineItems.push(
+                    {
+                        status: showExtraData() ? 'done' : 'padding',
+                        title: '日落',//list[0],
+                        content: list[0] + ' ' + props.sunsetTime,
+                        date: '',
+                        color: ColorType.night
+                    }
+                )
+
+                timelineItems.push(
+                    {
+                        status: 'padding',
+                        title: '日出',//list[1],
+                        content: list[1] + ' ' + props.sunriseTmrTime,
+                        date: '',
+                        color: ColorType.night
+                    }
+                )
+
+            }
+
         }
         else {
-            timelineItems.push(
-                {
-                    status: showExtraData() ? 'done' : 'padding',
-                    title: '日出',//dayDurationDesc(),
-                    content: dayDurationDesc()+' '+props.sunriseTime,
-                    date: '',
-                    color: ColorType.day
-                }
-            )
-
-            timelineItems.push(
-                {
-                    status: 'padding',
-                    title: '日落',//dayDurationDesc(),
-                    content: dayDurationDesc()+' '+props.sunsetTime,
-                    date: '',
-                    color: ColorType.day
-                }
-            )
+            if (isCompleted()) {
+                timelineItems.push(
+                    {
+                        status: 'done',
+                        title: '日落',//list[0],
+                        content: TimeFormatter.dateTimeFormate(props.authInfo.day_completed.sunrise_ts, true),
+                        date: '',
+                        color: ColorType.night
+                    }
+                )
+
+                timelineItems.push(
+                    {
+                        status: 'done',
+                        title: '日出',//list[1],
+                        content: TimeFormatter.dateTimeFormate(props.authInfo.day_completed.sunset_ts, true),
+                        date: '',
+                        color: ColorType.night
+                    }
+                )
+            }
+            else {
+                timelineItems.push(
+                    {
+                        status: showExtraData() ? 'done' : 'padding',
+                        title: '日出',//dayDurationDesc(),
+                        content: dayDurationDesc() + ' ' + props.sunriseTime,
+                        date: '',
+                        color: ColorType.day
+                    }
+                )
+
+                timelineItems.push(
+                    {
+                        status: 'padding',
+                        title: '日落',//dayDurationDesc(),
+                        content: dayDurationDesc() + ' ' + props.sunsetTime,
+                        date: '',
+                        color: ColorType.day
+                    }
+                )
+            }
         }
         return <View style={{ display: 'flex', flexDirection: 'row' }}>
             <Timeline items={timelineItems} title='' width={468} />
@@ -275,7 +369,13 @@ export default function DayNightDetailPopup(props: {
     }
 
     return <View className='detail_container'>
-        <Text className='detail_popup_title'>{getTitle()}</Text>
+        {
+            isCompleted()?<Text className='detail_popup_title'>{getCompletedTitle()}<Text className='detail_popup_subttitle'> {getSubTitle()}</Text></Text>:
+            <Text className='detail_popup_title'>{getTitle()}</Text>
+        
+        }
+        
+        
         <View className='detail_tabbar'>
             <View onClick={() => { setTabIndex(0) }} className={tabIndex == 0 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>{t('feature.day_night.overview')}</View>
             <View onClick={() => { setTabIndex(1) }} className={tabIndex == 1 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>{t('feature.day_night.events')}</View>

+ 4 - 0
src/features/trackTimeDuration/components/Discovery.tsx

@@ -18,6 +18,7 @@ import DayNightCard from "@/features/trackTimeDuration/components/DayNightCard";
 import { clearDayStore } from "@/store/day";
 import { AtActivityIndicator } from "taro-ui";
 import NoData from "@/components/view/NoData";
+import AllRings from "./AllRings";
 // import AtActivityIndicator from "taro-ui/types/activity-indicator";
 
 
@@ -546,6 +547,9 @@ export default function Discovery() {
         </Box>
 
         <DayNightCard isNight={false} count={count} />
+        {
+            // user.isLogin && <AllRings />
+        }
         {
             showErrorPage && <NoData refresh={() => { getPlanData() }} />
         }

+ 14 - 0
src/features/trackTimeDuration/components/IndexConsole.tsx

@@ -424,6 +424,7 @@ export default function IndexConsole(props: { record: any }) {
                     setFirstEnter(false)
                     hidePicker()
                     setBtnDisable(false)
+                    refreshDayNight()
 
                     if (permission.wxPubFollow) {
                         Taro.showModal({
@@ -462,6 +463,7 @@ export default function IndexConsole(props: { record: any }) {
                     setFirstEnter(false)
                     hidePicker()
                     setBtnDisable(false)
+                    refreshDayNight()
 
                     if (permission.wxPubFollow) {
                         Taro.showModal({
@@ -501,8 +503,10 @@ export default function IndexConsole(props: { record: any }) {
                     setFirstEnter(false)
                     hidePicker()
                     global.refrehWeekly()
+                    refreshDayNight()
                     if (props.record.current_record.scenario == 'SLEEP') {
                         global.scrollToLatest()
+                        
                     }
                 }).catch((e) => {
                     setBtnDisable(false)
@@ -520,6 +524,7 @@ export default function IndexConsole(props: { record: any }) {
                     hidePicker()
                     global.scrollToLatest()
                     global.refrehWeekly()
+                    refreshDayNight()
                 }).catch((e) => {
                     setBtnDisable(false)
                     var picker = limitPickerRef.current;
@@ -531,6 +536,15 @@ export default function IndexConsole(props: { record: any }) {
         }
     }
 
+    function refreshDayNight(){
+        if (global.refreshNight) {
+            global.refreshNight()
+        }
+        if (global.refreshDay) {
+            global.refreshDay()
+        }
+    }
+
     function expandBtnText() {
         if (status == 'WAIT_FOR_START') {
             return '后续步骤' //'Next Steps'

+ 2 - 2
src/pages/clock/Clock.tsx

@@ -430,7 +430,7 @@ export default function Page() {
         if (data.id == (homeData as any).current_record.id) {
             var obj = JSON.parse(JSON.stringify(homeData))
             obj.current_record = data
-            if (schedule){
+            if (schedule) {
                 obj.scenario.schedule = schedule
             }
             setHomeData(obj)
@@ -644,7 +644,7 @@ export default function Page() {
                 </Box>
 
                 <DayNightCard isNight={true} count={count} />
-                <AllRings data={homeData} time={timestamp}/>
+                {user.isLogin && <AllRings data={homeData} time={timestamp} />}
                 {
                     user.isLogin && records.length > 0 && <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', marginTop: rpxToPx(40), }}>
                         {

+ 31 - 1
src/utils/time_format.ts

@@ -77,7 +77,7 @@ export class TimeFormatter {
     )} ${TimeFormatter.formatTime(inputDate)}`;
   }
 
-  static dateTimeFormate(timestamp: number) {
+  static dateTimeFormate(timestamp: number,ignoreWeek?:boolean) {
     const currentDate = new Date();
     const inputDate = new Date(timestamp);
 
@@ -111,6 +111,11 @@ export class TimeFormatter {
     // if (global.language == 'en') {
     //   return `${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())} ${TimeFormatter.getDateAndWeek(timestamp)}`
     // }
+
+    if (ignoreWeek){
+      return TimeFormatter.getDate(timestamp) + ' ' + `${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())}`
+
+    }
     return TimeFormatter.getDateAndWeek(timestamp) + ' ' + `${TimeFormatter.padZero(inputDate.getHours())}:${TimeFormatter.padZero(inputDate.getMinutes())}`
 
   }
@@ -486,6 +491,31 @@ export class TimeFormatter {
     }
   }
 
+    //获取今天的日期和星期几
+    static getDate = (timestamp: number) => {
+      const now = new Date();
+      var dt = new Date(timestamp)
+      dt.setSeconds(0)
+      dt.setMilliseconds(0)
+      dt.setMinutes(0)
+      dt.setHours(0)
+  
+      const diff = now.getTime() - dt.getTime();
+      const day = 1000 * 60 * 60 * 24;
+  
+      if (diff < day) {
+        return TimeFormatter.getTodayUnit();
+      } else if (diff < 2 * day) {
+        return TimeFormatter.getYesterdayUnit();
+      } else {
+        if (global.language == 'en') {
+          return `${TimeFormatter.getDayOfWeek(dt.getDay())} ${TimeFormatter.getMonth(dt.getMonth() + 1)} ${dt.getDate()}`
+        }
+        return `${TimeFormatter.getMonth(dt.getMonth() + 1)}${dt.getDate()}日`
+      }
+    }
+
+
   //获取今天的日期和星期几
   static getDateAndWeek = (timestamp: number, ignore = false) => {
     const now = new Date();

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott