leon 1 年間 前
コミット
911cc05505

+ 2 - 1
src/_health/components/add_label.scss

@@ -26,7 +26,7 @@
 .label_bg{
     display: flex;
     flex-direction: row;
-    flex-wrap: wrap;
+    // flex-wrap: wrap;
     margin-left: 40px;
     margin-right: 40px;
     margin-top: 40px;
@@ -45,6 +45,7 @@
     display: flex;
     align-items: center;
     justify-content: center;
+    flex-shrink: 0;
 
 }
 

+ 65 - 47
src/_health/components/add_label.tsx

@@ -1,4 +1,4 @@
-import { View, Text, Input, Switch } from "@tarojs/components";
+import { View, Text, Input, Switch, ScrollView } from "@tarojs/components";
 import './add_label.scss'
 import { useEffect, useState } from "react";
 import Modal from "@/components/layout/Modal.weapp";
@@ -137,22 +137,10 @@ export default function AddLabel(props: {
         }
     }
 
-    function timeContent2() {
-        return <Card>
+    function timeContent() {
+        return <View style={{ display: 'flex', flexDirection: 'column' }}>
             {
-                isEat() ? <View style={{
-                    position: 'relative',
-                    display: 'flex', flexDirection: 'row',
-                    height: rpxToPx(128),
-                    alignItems: 'center',
-                    boxSizing: 'border-box',
-                    paddingLeft: rpxToPx(54),
-                    paddingRight: rpxToPx(54),
-                    justifyContent: 'center'
-                }}>
-                    <Text className="h34" style={{ color: MainColorType.eat }}>{strTime}</Text>
-                    <View className="border_footer_line" />
-                </View> :
+                !isEat() && <Card>
                     <View style={{
                         position: 'relative',
                         display: 'flex', flexDirection: 'row',
@@ -170,36 +158,60 @@ export default function AddLabel(props: {
                             onChange={(e) => {
                                 setIsFullday(!e.detail.value)
                             }} />
-                        <View className="border_footer_line" />
                     </View>
+                </Card>
+            }
+            {
+                !isEat() && <View style={{ height: rpxToPx(36) }} />
             }
-
             {
                 isFullday ? <View>
-                    <Input className="input_lb" placeholder="选择或输入时间标签" value={strLabel} onInput={(e: any) => {
-                        setStrLabel(e.target.value)
-                    }} />
-                    <View className="label_bg">
-                        {
-                            timeLabels.map((item, index) => {
-                                return <View className="label" key={index} onClick={() => setStrLabel(item.title)}>{item.title}</View>
-                            })
-                        }
-                    </View>
-                </View> :
-                    <View style={{ flexDirection: 'column', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+                    <Card>
+                        <Input className="input_lb" placeholder="选择或输入时间标签" value={strLabel} onInput={(e: any) => {
+                            setStrLabel(e.target.value)
+                        }} />
+                    </Card>
+                    <ScrollView scrollX style={{ width: rpxToPx(750), height: rpxToPx(164) }} showScrollbar={false}>
+                        <View className="label_bg">
+                            {
+                                timeLabels.map((item, index) => {
+                                    return <View className="label" key={index} onClick={() => setStrLabel(item.title)}>{item.title}</View>
+                                })
+                            }
+                        </View>
+                    </ScrollView>
+                </View> : <Card>
+                    <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: rpxToPx(700) }}>
+                        <View style={{
+                            position: 'relative',
+                            display: 'flex', flexDirection: 'row',
+                            height: rpxToPx(128),
+                            alignItems: 'center',
+                            boxSizing: 'border-box',
+                            paddingLeft: rpxToPx(54),
+                            paddingRight: rpxToPx(54),
+                            justifyContent: 'center'
+                            , width: rpxToPx(698)
+                        }}>
+                            <Text className="h34" style={{ color: isEat() ? MainColorType.eat : MainColorType.active }}>{strTime}</Text>
+                            <View className="border_footer_line" style={{ left: rpxToPx(40), right: rpxToPx(40) }} />
+                        </View>
                         <NewTimePicker
                             color={props.color ? props.color : getThemeColor(health.mode)}
                             onChange={e => {
                                 console.log(e)
                                 setStrTime(e)
                             }} />
+
                     </View>
+
+                </Card>
             }
-        </Card>
+
+        </View>
     }
 
-    function timeContent() {
+    function timeContent2() {
         return <View>
             <Card>
                 {
@@ -235,7 +247,7 @@ export default function AddLabel(props: {
                         </View>
                 }
             </Card>
-            <View style={{height:rpxToPx(36)}}/>
+            <View style={{ height: rpxToPx(36) }} />
 
             {
                 isFullday ? <View>
@@ -244,13 +256,15 @@ export default function AddLabel(props: {
                             setStrLabel(e.target.value)
                         }} />
                     </Card>
-                    <View className="label_bg">
-                        {
-                            timeLabels.map((item, index) => {
-                                return <View className="label" key={index} onClick={() => setStrLabel(item.title)}>{item.title}</View>
-                            })
-                        }
-                    </View>
+                    <ScrollView scrollX style={{ width: rpxToPx(750), height: rpxToPx(164) }} showScrollbar={false}>
+                        <View className="label_bg">
+                            {
+                                timeLabels.map((item, index) => {
+                                    return <View className="label" key={index} onClick={() => setStrLabel(item.title)}>{item.title}</View>
+                                })
+                            }
+                        </View>
+                    </ScrollView>
                 </View> :
                     <Card>
                         <View style={{ flexDirection: 'column', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
@@ -280,13 +294,17 @@ export default function AddLabel(props: {
                 <Input className="input_lb" placeholder="选择或输入标签" value={value} onInput={(e: any) => {
                     setValue(e.target.value)
                 }} />
-                <View className="label_bg">
-                    {
-                        props.labels.map((item, index) => {
-                            return <View className="label" key={index} onClick={() => setValue(item.title)}>{item.title}</View>
-                        })
-                    }
-                </View>
+                <ScrollView scrollX style={{ width: rpxToPx(750), height: rpxToPx(164) }} showScrollbar={false}>
+                    <View className="label_bg">
+
+
+                        {
+                            props.labels.map((item, index) => {
+                                return <View className="label" key={index} onClick={() => setValue(item.title)}>{item.title}</View>
+                            })
+                        }
+                    </View>
+                </ScrollView>
             </View>
             {/* <View className="pop_footer" style={{ backgroundColor: props.color ? props.color : getThemeColor(health.mode) }} onClick={tapDone}>{props.justLabel ? '完成' : '下一步'}</View> */}
             {

+ 5 - 1
src/_health/components/fast_sleep_console.tsx

@@ -1,6 +1,6 @@
 import { View, Text, Image } from "@tarojs/components";
 import './fast_sleep_console.scss'
-import { rpxToPx } from "@/utils/tools";
+import { rpxToPx, vibrate } from "@/utils/tools";
 import NewButton, { NewButtonType } from "../base/new_button";
 import { getThemeColor } from "@/features/health/hooks/health_hooks";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
@@ -83,11 +83,14 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
         if (index == 0 && props.data.fast.status == 'OG') {
             const { event_id, schedule_id } = props.data.fast.timeline[0]
             jumpPage(`/_health/pages/timeline_detail?event_id=${event_id}&schedule_id=${schedule_id}`)
+            return
         }
         else if (index == 1 && (props.data.sleep.status == 'OG' || props.data.status == 'OG3')) {
             const { event_id, schedule_id } = props.data.sleep.timeline[0]
             jumpPage(`/_health/pages/timeline_detail?event_id=${event_id}&schedule_id=${schedule_id}`)
+            return
         }
+        vibrate()
 
     }
 
@@ -283,6 +286,7 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
         }
 
         function rightView() {
+            if (index==2 && status=='OG3') return null
             if (isError) {
                 return <View style={{
                     borderColor: MainColorType.error,

+ 0 - 2
src/_health/components/fast_sleep_popup_content.tsx

@@ -91,8 +91,6 @@ export default function FastSleepPopupContent(props: {
             }
         </StatusIndicator>
     }
-
-    debugger
     return <View className="popup_container1" style={{
         top:props.top,
         height:'100vh'

+ 14 - 4
src/_health/components/target_progress.tsx

@@ -18,7 +18,8 @@ export default function TargetProgress(props: {
     //双环
     doubleRing?: boolean,
     first?: any,
-    second?: any
+    second?: any,
+    onClick?: any
 }) {
 
     function ring() {
@@ -62,7 +63,7 @@ export default function TargetProgress(props: {
             startArc: startArc(props.first.window_range.start_timestamp ?? 0),
             durationArc: durationArc(props.first.window_range.start_timestamp ?? 0, props.first.window_range.end_timestamp ?? 0)
         }
-        return <Rings common={common} bgRing={bgRing} realRing={realRing} canvasId={props.canvasId+'big' ?? 'helloworld'} />
+        return <Rings common={common} bgRing={bgRing} realRing={realRing} canvasId={props.canvasId + 'big' ?? 'helloworld'} />
     }
 
     function ring2() {
@@ -84,7 +85,7 @@ export default function TargetProgress(props: {
             startArc: startArc(props.second.window_range.start_timestamp ?? 0),
             durationArc: durationArc(props.second.window_range.start_timestamp ?? 0, props.second.window_range.end_timestamp ?? 0)
         }
-        return <Rings common={common} bgRing={bgRing} realRing={realRing} canvasId={props.canvasId+'small' ?? 'helloworld'} />
+        return <Rings common={common} bgRing={bgRing} realRing={realRing} canvasId={props.canvasId + 'small' ?? 'helloworld'} />
     }
 
     function twoRing() {
@@ -115,7 +116,16 @@ export default function TargetProgress(props: {
     }
 
 
-    return <View className='history_duration_bg' style={{ position: 'relative', marginTop: 0, marginBottom: props.showLine ? rpxToPx(7) : 0 }}>
+    return <View className='history_duration_bg'
+        onClick={(e) => {
+            if (props.onClick) {
+                if (process.env.TARO_ENV == 'weapp') {
+                    e.stopPropagation()
+                }
+                props.onClick()
+            }
+        }}
+        style={{ position: 'relative', marginTop: 0, marginBottom: props.showLine ? rpxToPx(7) : 0 }}>
         {
             props.showRing ? <View className='recent_ring_bg'>
                 {

+ 1 - 0
src/_health/pages/active_plan.tsx

@@ -80,6 +80,7 @@ export default function ActivePlan() {
                         type={StatusType.normal}
                         color={MainColorType.active}
                         fontSize={rpxToPx(34)}
+                        space={rpxToPx(12)}
                         text={schedule.title} />
                     <View style={{ flex: 1 }} />
                     <Text style={{ color: getThemeColor('ACTIVE') }}>Tap to customize</Text>

+ 10 - 8
src/_health/pages/add_moment.tsx

@@ -14,7 +14,6 @@ import { MainColorType } from "@/context/themes/color";
 import { createMoment, getLabelsEvent, updateMoment } from "@/services/health";
 import { useDispatch, useSelector } from "react-redux";
 import { getThemeColor } from "@/features/health/hooks/health_hooks";
-import { setShowActionTip } from "@/store/health";
 import DurationPicker from "../components/duration_picker";
 import NewModal from "../base/new_modal";
 import PostMomentTime from "../components/post_moment_time";
@@ -104,7 +103,6 @@ export default function AddMoment() {
             }
         }
         else {
-            debugger
             Taro.enableAlertBeforeUnload({
                 message: 'hhh',
                 success(res) {
@@ -241,12 +239,12 @@ export default function AddMoment() {
                 })
             }
 
-            if (health.mode == 'EAT') {
-                dispatch(setShowActionTip({
-                    isShow: true,
-                    isCompleted: false
-                }))
-            }
+            // if (health.mode == 'EAT') {
+            //     dispatch(setShowActionTip({
+            //         isShow: true,
+            //         isCompleted: false
+            //     }))
+            // }
 
             Taro.disableAlertBeforeUnload({
 
@@ -254,6 +252,10 @@ export default function AddMoment() {
 
             global.refreshWindow()
             global.refreshHistory()
+
+            if (global.postMementSuccess){
+                global.postMementSuccess()
+            }
         })
     }
 

+ 11 - 1
src/_health/pages/post_result.tsx

@@ -9,7 +9,7 @@ import { MainColorType } from "@/context/themes/color";
 import { useState } from "react";
 import dayjs from "dayjs";
 import { useDispatch, useSelector } from "react-redux";
-import { setMode } from "@/store/health";
+import { setMode, setShowActionTip } from "@/store/health";
 import NewModal from "../base/new_modal";
 import Card from "../components/card";
 import { updateReminder } from "@/services/health";
@@ -222,6 +222,16 @@ export default function PostResult() {
                         Taro.navigateBack()
                     }
 
+                    if (data.status_change){
+                        if (data.status_change.previous != data.status_change.current) {
+                            //灵动岛弹窗
+                            dispatch(setShowActionTip({
+                                isShow: true,
+                                isCompleted: false
+                            }))
+                        }
+                    }
+
                 }}
             />
             {

+ 94 - 15
src/_health/pages/timeline_detail.tsx

@@ -1,5 +1,5 @@
 import { View, Image, Text, Input, Textarea } from "@tarojs/components";
-import { useSelector } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
 import './timeline_detail.scss'
 import '@features/health/History.scss'
 import { useEffect, useState } from "react";
@@ -10,8 +10,8 @@ import { baseUrl } from "@/services/http/api";
 import { checkAuthorized } from "@/utils/check_authorized";
 import { createMoment, delEvents, delRecord, getEvents, getRecordDetail, makeDone } from "@/services/health";
 import NewButton, { NewButtonType } from "../base/new_button";
-import { IconClose } from "@/components/basic/Icons";
-import { rpxToPx } from "@/utils/tools";
+import { IconClose, IconLongFast } from "@/components/basic/Icons";
+import { rpxToPx, vibrate } from "@/utils/tools";
 import { MainColorType } from "@/context/themes/color";
 import NewModal from "../base/new_modal";
 import Card from "../components/card";
@@ -27,6 +27,9 @@ import { TimeFormatter } from "@/utils/time_format";
 import TargetProgress from "../components/target_progress";
 import formatMilliseconds from "@/utils/format_time";
 import SingleImage from "../components/single_img";
+import { setShowActionTip } from "@/store/health";
+import FastSleepPopupContent from "../components/fast_sleep_popup_content";
+import { StatusType } from "../base/status_indicator";
 
 let timestamp = 0;
 let useRoute;
@@ -55,6 +58,9 @@ export default function TimelineDetail() {
     const [selTime, setSelTime] = useState(dayjs().format('HH:mm'))
     const [selDate, setSelDate] = useState(dayjs().format('YYYY-MM-DD'))
 
+    const [fastSleepPop, setFastSleepPop] = useState(false)
+    const dispatch = useDispatch()
+
     const { t } = useTranslation()
     let router
     let navigation;
@@ -77,8 +83,31 @@ export default function TimelineDetail() {
             frontColor: '#000000'
         })
         Taro.setBackgroundColor({
-            backgroundColor:'#ffffff',
-            backgroundColorBottom:'#ffffff'
+            backgroundColor: '#ffffff',
+            backgroundColorBottom: '#ffffff'
+        })
+
+        var title = '详情'
+        if (router.params.timestamp){
+            var t = parseInt(router.params.timestamp+'')
+            if (TimeFormatter.isToday(t)){
+                title = TimeFormatter.getTodayUnit()
+            }
+            else if (TimeFormatter.isYesterday(t)){
+                title = TimeFormatter.getYesterdayUnit()
+            }
+            else {
+                if (global.languange == 'en'){
+                    title = dayjs(t).format('dddd, MMM D')
+                }
+                else {
+                    title = dayjs(t).format('MMMD日 dddd')
+                }
+            }
+            // title = t('health.journal_detail')
+        }
+        Taro.setNavigationBarTitle({
+            title:title
         })
     }, [showPop])
 
@@ -295,6 +324,18 @@ export default function TimelineDetail() {
                 delEvents(event_id).then(res => {
                     Taro.navigateBack()
                     global.refreshWindow()
+                    if ((res as any).status_change) {
+                        if ((res as any).status_change.previous != (res as any).status_change.current) {
+                            //灵动岛弹窗
+                            setTimeout(() => {
+                                dispatch(setShowActionTip({
+                                    isShow: true,
+                                    isCompleted: false
+                                }))
+                            }, 1000)
+
+                        }
+                    }
                     // global.refreshHistory()
                 })
             }
@@ -311,6 +352,7 @@ export default function TimelineDetail() {
                     global.refreshWindow()
                     global.refreshHistory()
                     Taro.navigateBack()
+
                 })
             }
         })
@@ -383,10 +425,40 @@ export default function TimelineDetail() {
         return TimeFormatter.dayTagText(begin, end)
     }
 
+    function showFastSleepPopDetail() {
+        setFastSleepPop(true)
+    }
+
     if (!loaded) return <View />
 
 
-    return <View style={{ display: 'flex', flex: 1, flexDirection: 'column',backgroundColor:'#fff' }}>
+    function fastSleepPopContent() {
+
+        function stepContent(str,index){
+            return <View className="bold h30" style={{color:index==1?MainColorType.sleep:MainColorType.fast}}>{str}</View>
+        }
+        if (fastSleepPop) {
+            var fast = detail.windows[0]
+            var sleep = detail.windows[1]
+            return <FastSleepPopupContent
+                close={() => { setFastSleepPop(false) }}
+                beforeStatus={StatusType.normal}
+                sleepStatus={StatusType.normal}
+                afterStatus={StatusType.normal}
+                title={t('health.my_fast_journal')}
+                showStep={true}
+                total={''}
+                // total1={total1()}
+                // total2={total2()}
+                // total3={total3()}
+                step1={stepContent(TimeFormatter.calculateTimeDifference(fast.window_range.start_timestamp, sleep.window_range.start_timestamp),0)}
+                step2={stepContent(TimeFormatter.calculateTimeDifference(sleep.window_range.start_timestamp, sleep.window_range.end_timestamp),1)}
+                step3={stepContent(TimeFormatter.calculateTimeDifference(sleep.window_range.end_timestamp, fast.window_range.end_timestamp),2)}
+            />
+        }
+        return null
+    }
+    return <View style={{ display: 'flex', flex: 1, flexDirection: 'column', backgroundColor: '#fff' }}>
         <View className="detail_header">
             <Image className="detail_header_header"
                 src={user.avatar}
@@ -492,25 +564,28 @@ export default function TimelineDetail() {
                     </View>
                 } */}
                 {
-                    mediaCount() > 1 && <View style={{ marginTop: rpxToPx(17),display:'flex',flexShrink:0 }}>
+                    mediaCount() > 1 && <View style={{ marginTop: rpxToPx(17), display: 'flex', flexShrink: 0 }}>
                         <CoverList imgs={imgList()} count={mediaCount()} />
                     </View>
                 }
                 {
-                    mediaCount()==1 && <View style={{ marginTop: rpxToPx(17),display:'flex',flexShrink:0 }}>
-                        <SingleImage url={imgList()[0]}/>
-                        </View>
+                    mediaCount() == 1 && <View style={{ marginTop: rpxToPx(17), display: 'flex', flexShrink: 0 }}>
+                        <SingleImage url={imgList()[0]} />
+                    </View>
                 }
-                <View style={{height:rpxToPx(17),flexShrink:0,display:'flex'}}/>
+                <View style={{ height: rpxToPx(17), flexShrink: 0, display: 'flex' }} />
 
                 {
-                    isfastsleep=='0' && history && detail.windows && detail.windows.map((item, index) => {
+                    isfastsleep == '0' && history && detail.windows && detail.windows.map((item, index) => {
                         return <TargetProgress key={index} showLine={index < detail.windows.length - 1}
+                            onClick={()=>{
+                                vibrate()
+                            }}
                             color={getThemeColor(item.window)}
-                            showRing={true}
+                            showRing={detail.fast_type == 'LF' ? false : true}
                             desc={item.description}
                             icon={
-                                null
+                                detail.fast_type == 'LF' ? <IconLongFast color={MainColorType.fast} width={rpxToPx(32)} /> : null
                             }
                             canvasId={`${item.window}${item.window_range.start_timestamp}${index}aa`}
                             startTimestamp={item.window_range.start_timestamp}
@@ -519,7 +594,8 @@ export default function TimelineDetail() {
                     })
                 }
                 {
-                    isfastsleep=='1' && history && detail.windows && <TargetProgress
+                    isfastsleep == '1' && history && detail.windows && <TargetProgress
+                        onClick={showFastSleepPopDetail}
                         showRing={true}
                         doubleRing={true}
                         first={detail.windows[0]}
@@ -627,5 +703,8 @@ export default function TimelineDetail() {
                 </Card>
             </NewModal>
         }
+        {
+            fastSleepPopContent()
+        }
     </View>
 }

+ 16 - 0
src/context/locales/en.js

@@ -984,5 +984,21 @@ export default {
         log_extra_activity:'Log Extra Activity',
 
         photo_wall:'Photo Wall',
+
+        all_logs:'All logged {{scenario}} ',
+        activities:'activities',
+        meals:'meals',
+        will_collected:'will be collected in ',
+        journal_end:'Journal.',
+        new_journal_created:'New Journal Created',
+        show_journal:'Show Journal',
+        tonight_at:'Tonight at {{time}}',
+        tomorrow_at:'Tomorrow at {{time}}',
+
+        title_journal:'Journal',
+        title_food_journal:'Food Journal',
+        title_active_journal:'Activity Journal',
+        journal_detail:'Journal Details',
+
     }
 }

+ 32 - 16
src/context/locales/zh.js

@@ -880,29 +880,29 @@ export default {
         fasting: '断食',
         fast: '断食',
         eat: '进食',
-        eating:'进食',
+        eating: '进食',
         sleep: '睡眠',
         active: '活跃',
         window_day: '白天',
         night: '夜晚',
-        daytime:'白天',
-        nighttime:'夜晚',
+        daytime: '白天',
+        nighttime: '夜晚',
         switch_to: '切换到{{scenario}}',
 
-        live_now:'正在进行',
-        next_up:'接下来',
-        in_progress:'进行中',
-        longfast_wait:'待开始',
+        live_now: '正在进行',
+        next_up: '接下来',
+        in_progress: '进行中',
+        longfast_wait: '待开始',
 
-        fasting_log:'断食记录',
-        meal_log:'饮食记录',
-        active_log:'活动记录',
-        sleep_log:'睡眠记录',
+        fasting_log: '断食记录',
+        meal_log: '饮食记录',
+        active_log: '活动记录',
+        sleep_log: '睡眠记录',
 
-        fasting_schedule:'断食日程',
-        eating_schedule:'进食日程',
-        active_schedule:'活动日程',
-        sleep_schedule:'睡眠日程',
+        fasting_schedule: '断食日程',
+        eating_schedule: '进食日程',
+        active_schedule: '活动日程',
+        sleep_schedule: '睡眠日程',
 
         faststreak: '连续断食记录',
         eatstreak: '连续进食记录',
@@ -984,6 +984,22 @@ export default {
         log_extra_meal: '记录额外一餐',
         log_extra_activity: '记录额外活动',
 
-        photo_wall:'照片墙',
+        photo_wall: '照片墙',
+
+        all_logs: '所有记录的{{scenario}} ',
+        activities: '活动',
+        meals: '饮食',
+        will_collected: '将被收录到 ',
+        journal_end: '日记。',
+        new_journal_created: '新日记已成功创建',
+        show_journal: '显示日记',
+        tonight_at: '今晚 {{time}}',
+        tomorrow_at: '明天 {{time}}',
+
+        title_journal:'日记',
+        title_food_journal:'食物日记',
+        title_active_journal:'活动日记',
+        journal_detail:'日记详情',
+
     }
 }

+ 67 - 95
src/features/health/HeaderCircadian.tsx

@@ -38,35 +38,29 @@ export default function HeaderCircadian() {
 
     function checkTip() {
         //启动时toast
+
+
+
         if (health && health.windows) {
-            // lauchShow = true
-            const scenario = getScenario(health.windows, health.mode)
-            if (scenario.real || scenario.status == 'OG') {
-                if (getScenario(health.windows, 'FAST').window_id == scenario.window_id){
-                    console.log('oooo',scenario)
-                    setIcon('FAST')
-                }
-                else if (getScenario(health.windows, 'SLEEP').window_id == scenario.window_id){
-                    setIcon('SLEEP')
-                }
-                else if (getScenario(health.windows, 'ACTIVE').window_id == scenario.window_id){
-                    setIcon('ACTIVE')
-                }
-                else if (getScenario(health.windows, 'EAT').window_id == scenario.window_id){
-                    setIcon('EAT')
-                }
-                setIsOG(true)
-                // dispatch(setShowActionTip({
-                //     isShow: false,
-                //     isCompleted: false
-                // }))
+            setShowTip(true)
+            setIcon(health.mode)
 
-                // setTimeout(() => {
+            if (timer) {
+                clearTimeout(timer)
+                timer = null
+            }
+            timer = setTimeout(() => {
+                setShowTip(false)
                 dispatch(setShowActionTip({
-                    isShow: true,
+                    isShow: false,
                     isCompleted: false
                 }))
-                // }, 50)
+            }, 3000)
+
+            // lauchShow = true
+            const scenario = getScenario(health.windows, health.mode)
+            if (scenario.real || scenario.status == 'OG') {
+                setIsOG(true)
 
                 switch (health.mode) {
                     case 'FAST':
@@ -87,7 +81,6 @@ export default function HeaderCircadian() {
                 return;
             }
             else {
-
                 if (new Date().getTime() >= scenario.target.start_timestamp && new Date().getTime() < scenario.target.end_timestamp) {
                     setDesc(t('health.live_now'))
                 }
@@ -95,115 +88,95 @@ export default function HeaderCircadian() {
                     setDesc(t('health.next_up'))
                 }
             }
-            console.log(health.mode)
             switch (health.mode) {
                 case 'FAST':
                     {
-                        setIcon('FAST')
                         setTitle(t('health.fasting_schedule'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : 'IN PROGRESS')
                     }
                     break;
                 case 'EAT':
                     {
-                        setIcon('EAT')
                         setTitle(t('health.eating_schedule'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : 'IN PROGRESS')
                     }
                     break;
                 case 'SLEEP':
                     {
-                        setIcon('SLEEP')
                         setTitle(t('health.sleep_schedule'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : 'IN PROGRESS')
                     }
                     break;
                 case 'ACTIVE':
                     {
-                        setIcon('ACTIVE')
                         setTitle(t('health.active_schedule'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : 'IN PROGRESS')
                     }
                     break;
                 case 'DAY':
                     {
-                        setIcon('DAY')
                         setTitle(t('health.daytime'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : 'IN PROGRESS')
                     }
                     break;
                 case 'NIGHT':
                     {
-                        setIcon('NIGHT')
                         setTitle(t('health.nighttime'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : 'IN PROGRESS')
                     }
                     break;
             }
 
             setIsOG(false)
-            setShowTip(true)
-            if (timer) {
-                clearTimeout(timer)
-                timer = null
-            }
-            timer = setTimeout(() => {
-                setShowTip(false)
-            }, 3000)
+
+
         }
     }
 
     useEffect(() => {
         if (health.showActionCircadian) {
-            const scenario = getScenario(health.windows, health.mode)
-            setIsOG(scenario.status == 'OG')
-            var isLiveNow = new Date().getTime() >= scenario.target.start_timestamp && new Date().getTime() < scenario.target.end_timestamp
-            setDesc(scenario.status == 'OG' ? t('health.in_progress') : isLiveNow ? t('health.live_now') : t('health.next_up'))
-            switch (health.mode) {
-                case 'FAST':
-                    {
-                        setIcon('FAST')
-                        setTitle(scenario.status == 'OG' ? t('health.fasting_log') : t('health.fasting_schedule'))
-
+            checkTip()
+            // const scenario = getScenario(health.windows, health.mode)
+            // setIsOG(scenario.status == 'OG')
+            // var isLiveNow = new Date().getTime() >= scenario.target.start_timestamp && new Date().getTime() < scenario.target.end_timestamp
+            // setDesc(scenario.status == 'OG' ? t('health.in_progress') : isLiveNow ? t('health.live_now') : t('health.next_up'))
+            // switch (health.mode) {
+            //     case 'FAST':
+            //         {
+            //             setIcon('FAST')
+            //             setTitle(scenario.status == 'OG' ? t('health.fasting_log') : t('health.fasting_schedule'))
 
-                    }
-                    break;
-                case 'EAT':
-                    {
-                        setIcon('EAT')
-                        setTitle(scenario.status == 'OG' ? t('health.meal_log') : t('health.eating_schedule'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : t('health.in_progress'))
-                    }
-                    break;
-                case 'SLEEP':
-                    {
-                        setIcon('SLEEP')
-                        setTitle(scenario.status == 'OG' ? t('health.sleep_log') : t('health.sleep_schedule'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : t('health.in_progress'))
-                    }
-                    break;
-                case 'ACTIVE':
-                    {
-                        setIcon('ACTIVE')
-                        setTitle(scenario.status == 'OG' ? t('health.active_log') : t('health.active_schedule'))
-                        // setDesc(health.isCompleted ? 'COMPLETED' : t('health.in_progress'))
-                    }
-                    break;
-            }
 
-            // setIsOG(scenario.status == 'OG')
-            setShowTip(true)
-            if (timer) {
-                clearTimeout(timer)
-                timer = null
-            }
-            timer = setTimeout(() => {
-                setShowTip(false)
-                dispatch(setShowActionTip({
-                    isShow: false,
-                    isCompleted: false
-                }))
-            }, 3000)
+            //         }
+            //         break;
+            //     case 'EAT':
+            //         {
+            //             setIcon('EAT')
+            //             setTitle(scenario.status == 'OG' ? t('health.meal_log') : t('health.eating_schedule'))
+            //             // setDesc(health.isCompleted ? 'COMPLETED' : t('health.in_progress'))
+            //         }
+            //         break;
+            //     case 'SLEEP':
+            //         {
+            //             setIcon('SLEEP')
+            //             setTitle(scenario.status == 'OG' ? t('health.sleep_log') : t('health.sleep_schedule'))
+            //             // setDesc(health.isCompleted ? 'COMPLETED' : t('health.in_progress'))
+            //         }
+            //         break;
+            //     case 'ACTIVE':
+            //         {
+            //             setIcon('ACTIVE')
+            //             setTitle(scenario.status == 'OG' ? t('health.active_log') : t('health.active_schedule'))
+            //             // setDesc(health.isCompleted ? 'COMPLETED' : t('health.in_progress'))
+            //         }
+            //         break;
+            // }
+            // setShowTip(true)
+            // if (timer) {
+            //     clearTimeout(timer)
+            //     timer = null
+            // }
+            // timer = setTimeout(() => {
+            //     setShowTip(false)
+            //     dispatch(setShowActionTip({
+            //         isShow: false,
+            //         isCompleted: false
+            //     }))
+            // }, 3000)
         }
     }, [health.showActionCircadian])
 
@@ -284,7 +257,7 @@ export default function HeaderCircadian() {
                 break
         }
 
-        console.log(isOG,icon,bgColor)
+
 
         return <View className='circadian_icon' style={{ backgroundColor: bgColor }}>
             {
@@ -326,7 +299,6 @@ export default function HeaderCircadian() {
         return MainColorType.g02
     }
 
-
     return <View className='circadian_bg' style={{ opacity: showTip ? 1 : 0 }}>
         {
             leftIcon()

+ 287 - 97
src/features/health/HistoryItem.tsx

@@ -265,6 +265,271 @@ export default function HistoryItem(props: {
 
     }
 
+    function temp() {
+        return <View className="history_item2" onClick={goDetail}>
+            <View className="cell_date" >
+                <View className="h42 bold" style={{ lineHeight: rpxToPx(60) + 'px' }}>{historyDate()}</View>
+                <View className="h24 bold" style={{ marginLeft: rpxToPx(6), marginTop: rpxToPx(13), lineHeight: rpxToPx(47) + 'px' }}>{historyMonth()}</View>
+            </View>
+            <View className="history_content" style={{ paddingTop: rpxToPx(4) }}>
+                {
+                    props.data.dataArray.map((content, i) => {
+                        return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i}>
+                            {
+                                content.type == 'TEXT' && <View style={{
+                                    display: 'flex',
+                                    flex: 1,
+                                    flexShrink: 0,
+                                    flexDirection: 'column',
+                                    backgroundColor: '#fafafa',
+                                    paddingLeft: rpxToPx(20),
+                                    paddingRight: rpxToPx(20),
+                                    paddingTop: rpxToPx(12),
+                                    paddingBottom: rpxToPx(12)
+                                }}>{content.data.map((detail, j) => {
+                                    return <TimeTitleDesc
+                                        key={j * 100}
+                                        className={'line2'}
+                                        time=''
+                                        title={detail.title}
+                                        desc={detail.description}
+                                    />
+                                })}</View>
+                            }
+                            {
+                                content.type == 'PIC' && <CoverList imgs={content.data} count={content.data.length} />
+                            }
+                            {
+                                content.type == 'PIC_TEXT' && <Image
+                                    style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
+                                    src={content.data[0].url}
+                                    onClick={(e) => {
+                                        if (process.env.TARO_ENV == 'weapp') {
+                                            e.stopPropagation()
+                                        }
+                                        Taro.previewImage({
+                                            current: content.data[0].url,
+                                            urls: [content.data[0].url]
+                                        })
+                                    }}
+                                    mode="aspectFill" />
+                            }
+                            {
+                                content.type == 'PIC_TEXT' && <View style={{
+                                    display: 'flex',
+                                    flex: 1,
+                                    flexShrink: 0,
+                                    flexDirection: 'column',
+                                    backgroundColor: 'transparent',
+                                    paddingLeft: rpxToPx(17),
+                                    paddingRight: 0,
+                                    paddingTop: 0,
+                                    paddingBottom: 0
+                                }}>
+                                    <TimeTitleDesc
+                                        className={'line3'}
+                                        time=''
+                                        title={content.data[0].title}
+                                        desc={content.data[0].description}
+                                    />
+                                </View>
+                            }
+                        </View>
+                    })
+                }
+                {/* {
+                props.data.events.map((event, i) => {
+                    return event.moments && event.moments.map((moment, j) => {
+                        return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i * 100 + j}>
+                            {
+                                moment.media && moment.media.length > 0 && <Image
+                                    style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
+                                    src={moment.media[0].url}
+                                    mode="aspectFill" />
+                            }
+                            {
+                                momentItem(moment)
+                            }
+                        </View>
+                    })
+                })
+            } */}
+
+                {/* <View style={{ display: 'flex', flexDirection: 'column', marginBottom: rpxToPx(12), flex: 1, paddingTop: rpxToPx(4) }}>
+                {
+                    props.data.events.map((item, index) => {
+                        return <TimeTitleDesc
+                            timeObj={item.time}
+                            time={item.time && dayjs(item.time.timestamp).format('HH:mm')}
+                            dayTag={dayTag(index)}
+                            title={getTitle(item)}
+                            desc={item.moments && item.moments.length > 0 ? item.moments[0].description : ''}
+                        />
+                    })
+                }
+            </View> */}
+                {/* {
+                mediaCount() > 0 && <CoverList count={mediaCount()} imgs={imgList()} />
+            } */}
+
+                {
+                    props.type != 'FAST,SLEEP' && props.mode != 'EAT' && props.mode != 'ACTIVE' && props.data.windows.map((item, index) => {
+                        return <TargetProgress key={index} showLine={index < props.data.windows.length - 1}
+                            color={getThemeColor(item.window)}
+                            showRing={props.fast_type != 'LF'}
+                            desc={item.description}
+                            icon={
+                                props.fast_type == 'LF' ? <IconLongFast color={MainColorType.fast} width={rpxToPx(32)} /> : null
+                            }
+                            canvasId={`${item.window}${item.window_range.start_timestamp}${index}`}
+                            startTimestamp={item.window_range.start_timestamp}
+                            endTimerstamp={item.window_range.end_timestamp}
+                        />
+                    })
+                }
+
+                {
+                    props.type == 'FAST,SLEEP' && <TargetProgress
+                        showRing={true}
+                        doubleRing={true}
+                        first={props.data.windows[0]}
+                        second={props.data.windows[1]}
+                        canvasId={`double_${props.data.windows[0].window_range.start_timestamp}`}
+                    />
+                }
+                {/* <TargetProgress showLine={props.mode == 'FAST,SLEEP' && props.data.events.length > 2}
+                color={props.mode == 'FAST,SLEEP' ? getThemeColor('FAST') : getThemeColor(health.mode)}
+                showRing={props.fast_type != 'LF'}
+                desc={props.data.window_range.end_timestamp ? formatMilliseconds(props.data.window_range.end_timestamp - props.data.window_range.start_timestamp) : ''}
+                icon={
+                    props.fast_type == 'LF' ? <IconLongFast color={MainColorType.fast} width={rpxToPx(32)} /> : null
+                }
+                canvasId={(props.mode == 'FAST,SLEEP' ? 'history_fast_sleep' + props.index : 'history_' + props.index) + props.type}
+                startTimestamp={props.data.window_range.start_timestamp}
+                endTimerstamp={props.data.window_range.end_timestamp}
+            />
+            {
+                props.mode == 'FAST,SLEEP' && props.data.events.length > 2 && <View className="history_duration_bg" style={{ marginTop: 0 }}>
+                    {
+                        props.fast_type != 'LF' && <View className="recent_ring_bg">
+                            {
+                                ring2()
+                            }
+                        </View>
+                    }
+                    {
+                        props.data.window_range.end_timestamp && <Text className="history_item_duration h26">{formatMilliseconds(props.data.events[2].time.timestamp - props.data.events[1].time.timestamp)}</Text>
+                    }
+                </View>
+            } */}
+                {/* {
+                props.isArchived && <View className="history_archived_row">
+                    <View className="history_archived" onClick={(e) => {
+                        if (process.env.TARO_ENV == 'weapp') {
+                            e.stopPropagation()
+                        }
+                        showActionSheet({
+                            showActionSheetWithOptions: showActionSheetWithOptions,
+                            title: 'Oprate Title',
+                            itemList: ['标记完成', '补记'],
+                            success: (res) => {
+                                // tapActionSheet(res)
+                                switch (res) {
+                                    case 1:
+                                        break;
+                                    case 0:
+                                        makeDone(props.data.window_id).then(res => {
+                                            global.refreshWindow()
+                                            global.refreshHistory()
+                                            if (props.refresh)
+                                                props.refresh()
+                                        })
+                                        break;
+                                }
+                            }
+                        });
+                    }}>
+                        <IconMore width={17} color="#b2b2b2" />
+                    </View>
+                </View>
+            } */}
+                <View style={{ height: rpxToPx(0), flexShrink: 0 }} />
+                {/* <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(60), marginTop: rpxToPx(20) }}>
+                <View style={{ flex: 1 }} />
+                <NewButton type={NewButtonType.more}
+                    onClick={tapDel}
+                />
+            </View> */}
+            </View>
+            {/* 
+        {
+            !props.hideLine && <View className="border_footer_line" />
+        } */}
+
+        </View>
+    }
+
+    function singleItem(type, url, obj, key) {
+        return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={key * 1000}>
+            {
+                type == 'TEXT' && <View style={{
+                    display: 'flex',
+                    flex: 1,
+                    flexShrink: 0,
+                    flexDirection: 'column',
+                    backgroundColor: '#fafafa',
+                    paddingLeft: rpxToPx(20),
+                    paddingRight: rpxToPx(20),
+                    paddingTop: rpxToPx(12),
+                    paddingBottom: rpxToPx(12)
+                }}><TimeTitleDesc
+                        className={'line2'}
+                        time=''
+                        title={obj.title}
+                        desc={obj.description}
+                    />
+                </View>
+            }
+            {
+                type == 'PIC' && <CoverList imgs={[url]} count={1} />
+            }
+            {
+                type == 'PIC_TEXT' && <Image
+                    style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
+                    src={url}
+                    onClick={(e) => {
+                        if (process.env.TARO_ENV == 'weapp') {
+                            e.stopPropagation()
+                        }
+                        Taro.previewImage({
+                            current: url,
+                            urls: [url]
+                        })
+                    }}
+                    mode="aspectFill" />
+            }
+            {
+                type == 'PIC_TEXT' && <View style={{
+                    display: 'flex',
+                    flex: 1,
+                    flexShrink: 0,
+                    flexDirection: 'column',
+                    backgroundColor: 'transparent',
+                    paddingLeft: rpxToPx(17),
+                    paddingRight: 0,
+                    paddingTop: 0,
+                    paddingBottom: 0
+                }}>
+                    <TimeTitleDesc
+                        className={'line3'}
+                        time=''
+                        title={obj.title}
+                        desc={obj.description}
+                    />
+                </View>
+            }
+        </View>
+    }
     return <View className="history_item2" onClick={goDetail}>
         <View className="cell_date" >
             <View className="h42 bold" style={{ lineHeight: rpxToPx(60) + 'px' }}>{historyDate()}</View>
@@ -272,7 +537,7 @@ export default function HistoryItem(props: {
         </View>
         <View className="history_content" style={{ paddingTop: rpxToPx(4) }}>
             {
-                props.data.dataArray.map((content, i) => {
+                props.mode != 'EAT' && props.mode != 'ACTIVE' && props.data.dataArray.map((content, i) => {
                     return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i}>
                         {
                             content.type == 'TEXT' && <View style={{
@@ -334,45 +599,36 @@ export default function HistoryItem(props: {
                             </View>
                         }
                     </View>
+
                 })
             }
-            {/* {
-                props.data.events.map((event, i) => {
-                    return event.moments && event.moments.map((moment, j) => {
-                        return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i * 100 + j}>
+
+            {
+                (props.mode == 'EAT' || props.mode == 'ACTIVE') && props.data.dataArray.map((content, i) => {
+                    switch (content.type) {
+                        case 'TEXT':
                             {
-                                moment.media && moment.media.length > 0 && <Image
-                                    style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
-                                    src={moment.media[0].url}
-                                    mode="aspectFill" />
+                                return content.data.map((detail, j) => {
+                                    return singleItem('TEXT', '', detail, j*10)
+                                })
                             }
+                            break
+                        case 'PIC':
                             {
-                                momentItem(moment)
+                                return content.data.map((detail, j) => {
+                                    return singleItem('PIC', detail, '', j*10)
+                                })
                             }
-                        </View>
-                    })
+                            break
+                        case 'PIC_TEXT':
+                            return singleItem('PIC_TEXT', content.data[0].url, content.data[0], i)
+                            break
+                    }
                 })
-            } */}
-
-            {/* <View style={{ display: 'flex', flexDirection: 'column', marginBottom: rpxToPx(12), flex: 1, paddingTop: rpxToPx(4) }}>
-                {
-                    props.data.events.map((item, index) => {
-                        return <TimeTitleDesc
-                            timeObj={item.time}
-                            time={item.time && dayjs(item.time.timestamp).format('HH:mm')}
-                            dayTag={dayTag(index)}
-                            title={getTitle(item)}
-                            desc={item.moments && item.moments.length > 0 ? item.moments[0].description : ''}
-                        />
-                    })
-                }
-            </View> */}
-            {/* {
-                mediaCount() > 0 && <CoverList count={mediaCount()} imgs={imgList()} />
-            } */}
+            }
 
             {
-                props.type != 'FAST,SLEEP' && props.mode!='EAT' && props.mode!='ACTIVE' && props.data.windows.map((item, index) => {
+                props.type != 'FAST,SLEEP' && props.mode != 'EAT' && props.mode != 'ACTIVE' && props.data.windows.map((item, index) => {
                     return <TargetProgress key={index} showLine={index < props.data.windows.length - 1}
                         color={getThemeColor(item.window)}
                         showRing={props.fast_type != 'LF'}
@@ -396,74 +652,8 @@ export default function HistoryItem(props: {
                     canvasId={`double_${props.data.windows[0].window_range.start_timestamp}`}
                 />
             }
-            {/* <TargetProgress showLine={props.mode == 'FAST,SLEEP' && props.data.events.length > 2}
-                color={props.mode == 'FAST,SLEEP' ? getThemeColor('FAST') : getThemeColor(health.mode)}
-                showRing={props.fast_type != 'LF'}
-                desc={props.data.window_range.end_timestamp ? formatMilliseconds(props.data.window_range.end_timestamp - props.data.window_range.start_timestamp) : ''}
-                icon={
-                    props.fast_type == 'LF' ? <IconLongFast color={MainColorType.fast} width={rpxToPx(32)} /> : null
-                }
-                canvasId={(props.mode == 'FAST,SLEEP' ? 'history_fast_sleep' + props.index : 'history_' + props.index) + props.type}
-                startTimestamp={props.data.window_range.start_timestamp}
-                endTimerstamp={props.data.window_range.end_timestamp}
-            />
-            {
-                props.mode == 'FAST,SLEEP' && props.data.events.length > 2 && <View className="history_duration_bg" style={{ marginTop: 0 }}>
-                    {
-                        props.fast_type != 'LF' && <View className="recent_ring_bg">
-                            {
-                                ring2()
-                            }
-                        </View>
-                    }
-                    {
-                        props.data.window_range.end_timestamp && <Text className="history_item_duration h26">{formatMilliseconds(props.data.events[2].time.timestamp - props.data.events[1].time.timestamp)}</Text>
-                    }
-                </View>
-            } */}
-            {/* {
-                props.isArchived && <View className="history_archived_row">
-                    <View className="history_archived" onClick={(e) => {
-                        if (process.env.TARO_ENV == 'weapp') {
-                            e.stopPropagation()
-                        }
-                        showActionSheet({
-                            showActionSheetWithOptions: showActionSheetWithOptions,
-                            title: 'Oprate Title',
-                            itemList: ['标记完成', '补记'],
-                            success: (res) => {
-                                // tapActionSheet(res)
-                                switch (res) {
-                                    case 1:
-                                        break;
-                                    case 0:
-                                        makeDone(props.data.window_id).then(res => {
-                                            global.refreshWindow()
-                                            global.refreshHistory()
-                                            if (props.refresh)
-                                                props.refresh()
-                                        })
-                                        break;
-                                }
-                            }
-                        });
-                    }}>
-                        <IconMore width={17} color="#b2b2b2" />
-                    </View>
-                </View>
-            } */}
             <View style={{ height: rpxToPx(0), flexShrink: 0 }} />
-            {/* <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(60), marginTop: rpxToPx(20) }}>
-                <View style={{ flex: 1 }} />
-                <NewButton type={NewButtonType.more}
-                    onClick={tapDel}
-                />
-            </View> */}
         </View>
-        {/* 
-        {
-            !props.hideLine && <View className="border_footer_line" />
-        } */}
 
     </View>
 }

+ 9 - 1
src/features/health/MainConsole.scss

@@ -230,7 +230,15 @@
   width: 39px;
   height: 24px;
 }
-
+.mark_done_tip{
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  padding: 24px 28px;
+  padding-left: 52px;
+  width: 750px;
+  box-sizing: border-box;
+}
 
 
 /*

+ 84 - 0
src/features/health/MainConsole.tsx

@@ -48,6 +48,9 @@ export default function MainConsole(props: { type: WindowType }) {
     const [selItem, setSelItem] = useState<any>(null)
     const [hideGuideTip, setHideGuideTip] = useState(false)
     const [hideErrorTip, setHideErrorTip] = useState(false)
+
+    const [hideEatArchiveTip, setHideEatArchiveTip] = useState(false)
+    const [hideActiveArchiveTip, setHideActiveArchiveTip] = useState(false)
     const { t } = useTranslation()
     const dispatch = useDispatch()
 
@@ -76,6 +79,15 @@ export default function MainConsole(props: { type: WindowType }) {
         chooseLocation()
     }
 
+    global.postMementSuccess = ()=>{
+        if (health.mode == 'ACTIVE'){
+            setHideActiveArchiveTip(false)
+        }
+        else {
+            setHideEatArchiveTip(false)
+        }
+    }
+
     function edit(item) {
         if (item.scenario != 'FAST' && item.scenario != 'SLEEP') {
             return
@@ -518,6 +530,19 @@ export default function MainConsole(props: { type: WindowType }) {
                         confirm: () => {
                             delRecord(obj.window_id).then(res => {
                                 global.refreshWindow()
+
+                                if ((res as any).status_change) {
+                                    if ((res as any).status_change.previous != (res as any).status_change.current) {
+                                        //灵动岛弹窗
+                                        setTimeout(() => {
+                                            dispatch(setShowActionTip({
+                                                isShow: true,
+                                                isCompleted: false
+                                            }))
+                                        }, 1000)
+
+                                    }
+                                }
                             })
                         }
                     })
@@ -553,6 +578,19 @@ export default function MainConsole(props: { type: WindowType }) {
         makeDone(getScenario(health.windows, health.mode).window_id).then(res => {
             global.refreshWindow()
             global.refreshHistory()
+
+            if ((res as any).status_change) {
+                if ((res as any).status_change.previous != (res as any).status_change.current) {
+                    //灵动岛弹窗
+                    setTimeout(() => {
+                        dispatch(setShowActionTip({
+                            isShow: true,
+                            isCompleted: false
+                        }))
+                    }, 1000)
+
+                }
+            }
         })
     }
 
@@ -836,6 +874,49 @@ export default function MainConsole(props: { type: WindowType }) {
         </View>
     }
 
+    function markDoneTip() {
+        if (health.mode != 'EAT' && health.mode != 'ACTIVE') return
+        var scenario = getScenario(health.windows, health.mode)
+        if (scenario.status != 'OG') return
+
+        if (health.mode == 'EAT' && hideEatArchiveTip) return
+        if (health.mode == 'ACTIVE' && hideActiveArchiveTip) return
+
+        var strTitle = ''
+        if (scenario.archive_timestamp) {
+            var today = new Date().getDate()
+            var date = new Date(scenario.archive_timestamp).getDate()
+            if (today == date){
+                strTitle = t('health.tonight_at',{time:dayjs(scenario.archive_timestamp).format('HH:mm')})
+            }
+            else {
+                strTitle = t('health.tomorrow_at',{time:dayjs(scenario.archive_timestamp).format('HH:mm')})
+            }
+        }
+
+        return <View className="mark_done_tip" style={{
+            backgroundColor: getThemeColor(health.mode) + '1A'
+        }}>
+            <View style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
+                <Text className="h28 bold" style={{ color: getThemeColor(health.mode) }}>{strTitle}</Text>
+                <Text className="h24 bold">{t('health.all_logs',{scenario:health.mode=='EAT'?t('health.meals'):t('health.activities')})}<Text style={{fontWeight:'normal'}}>{t('health.will_collected')}</Text>{t('health.journal_end')}</Text>
+            </View>
+            <NewButton type={NewButtonType.img} btnStyle={{
+                height: rpxToPx(32),
+                width: rpxToPx(32)
+            }} onClick={() => {
+                if (health.mode == 'EAT'){
+                    setHideEatArchiveTip(true)
+                }
+                else {
+                    setHideActiveArchiveTip(true)
+                }
+            }}>
+                <IconClose color={MainColorType.g01} width={rpxToPx(32)} height={rpxToPx(32)} />
+            </NewButton>
+        </View>
+    }
+
     return <View className="main-console-bg">
         <Image className="main_arrow" src={require('@assets/images/center_arrow.png')} />
         <View className="main_summary">
@@ -901,6 +982,9 @@ export default function MainConsole(props: { type: WindowType }) {
 
             </View>
         }
+        {
+            markDoneTip()
+        }
         {
             health.mode == 'ACTIVE' && <View>
                 <View className="main_column_space" /><IconTitleCell

+ 95 - 4
src/features/health/MainHistory.tsx

@@ -3,7 +3,7 @@ import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "re
 import { records } from "@/services/health";
 import './History.scss'
 import Calendar from "./calendar";
-import { useSelector } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
 import HistoryItem from "./HistoryItem";
 import { rpxToPx } from "@/utils/tools";
 import { jumpPage } from "../trackTimeDuration/hooks/Common";
@@ -16,6 +16,7 @@ import { IconArrow, IconCellArrow } from "@/components/basic/Icons";
 import NoRecord from "@/_health/components/no_record";
 import ListFooter from "@/_health/components/list_footer";
 import { useTranslation } from "react-i18next";
+import { setActiveTip, setEatTip, setFirstActiveId, setFirstEatId } from "@/store/health";
 
 let lastMode = ''
 let myScrollTop = 0
@@ -32,6 +33,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
     const [showEatArchive, setShowEatArchive] = useState(true)
     const [showActiveArchive, setShowActiveArchive] = useState(true)
     const healthRef = useRef(health)
+    const dispatch = useDispatch()
     const { t } = useTranslation()
 
     useImperativeHandle(ref, () => ({
@@ -238,6 +240,21 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
             setLoading(false)
             setLoaded(true)
             if (index == 1) {
+                // console.log(props.type,health.mode)
+                if (!props.type && array.length > 0) {
+                    if (health.mode == 'EAT') {
+                        dispatch(setFirstEatId(array[0].window_id))
+                        if (health.first_eat_id.length > 0 && health.first_eat_id != array[0].window_id) {
+                            dispatch(setEatTip(true))
+                        }
+                    }
+                    else if (health.mode == 'ACTIVE') {
+                        dispatch(setFirstActiveId(array[0].window_id))
+                        if (health.first_active_id.length > 0 && health.first_active_id != array[0].window_id) {
+                            dispatch(setActiveTip(true))
+                        }
+                    }
+                }
                 setList(array)
                 setTotal((res as any).total)
                 if (props.refreshSuccess) {
@@ -357,13 +374,84 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
 
     if (!user.isLogin) return <View />
 
+    function newJournalTip() {
+        if (!props.type) {
+            var show = false
+            if (health.mode == 'EAT' && health.eat_journal_tip) {
+                show = true
+            }
+            else if (health.mode == 'ACTIVE' && health.active_journal_tip) {
+                show = true
+            }
+
+            if (show) {
+                return <View style={{
+                    display: 'flex',
+                    flexDirection: 'column',
+                    alignItems: 'center',
+                    paddingTop: rpxToPx(82),
+                    paddingBottom: rpxToPx(82),
+                    backgroundColor: '#fff',
+                    position: 'relative'
+                }}>
+                    <View className="archived_bg" onClick={() => {
+                        // jumpPage('/_health/pages/archive')
+                        var data = list[0]
+                        jumpPage(`/_health/pages/timeline_detail?window_id=${data.window_id}&type=recent&isfastsleep=0&timestamp=${data.publish.timestamp}`)
+                        setTimeout(() => {
+                            if (health.mode == 'EAT') {
+                                dispatch(setEatTip(false))
+                            }
+                            else {
+                                dispatch(setActiveTip(false))
+                            }
+                        }, 1000)
+
+                    }}>
+                        <Text className="archived_text bold" style={{ color: getThemeColor(health.mode) }}>{t('health.new_journal_created')}</Text>
+                        {/* {
+                            health.eatArchived.images.map((item, index) => {
+                                return <Image src={item} key={index} className="archived_img" mode="aspectFill" />
+                            })
+                        } */}
+                        <IconArrow color={MainColorType.g03} width={rpxToPx(34)} />
+                    </View>
+                    <View className="border_footer_line" />
+                </View>
+                // return <View className="h28 bold" 
+                // onClick={()=>{
+                //     if (health.mode == 'EAT'){
+                //         dispatch(setEatTip(false))
+                //     }
+                //     else {
+                //         dispatch(setActiveTip(false))
+                //     }
+                // }}
+                // style={{
+                //     width:rpxToPx(750),
+                //     height:rpxToPx(156),
+                //     display:'flex',
+                //     alignItems:'center',
+                //     justifyContent:'center',
+                //     backgroundColor:'#fff',
+                //     color:getThemeColor(health.mode),
+
+                // }}>
+                //     New Journal Created {'>'}
+                // </View>
+            }
+        }
+        return <View />
+    }
+
     return <View style={{ width: rpxToPx(750), marginTop: rpxToPx(36) }}>
+
         {
             (list.length >= 0 || health.mode == 'EAT') && <View className="recent">
                 <Text className="h42 bold" >{t('health.recents')}</Text>
                 {
                     (health.mode == 'EAT' || health.mode == 'ACTIVE') && <View onClick={() => {
-                        jumpPage('/_health/pages/archive')
+                        jumpPage('/pages/account/Journal?type='+health.mode)
                         setTimeout(() => {
                             health.mode == 'EAT' ? setShowEatArchive(false) : setShowActiveArchive(false)
                         }, 1000)
@@ -386,8 +474,11 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                 }
             </View>
         }
-        {
+        {/* {
             archiveContent()
+        } */}
+        {
+            newJournalTip()
         }
         {
             list.length == 0 && <NoRecord />
@@ -409,7 +500,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                                 type={props.type}
                                 hideLine={hideLine(index)}
                                 onClick={() => {
-                                    jumpPage('/_health/pages/moment_detail')
+                                    
                                 }} />
 
                         </View>

+ 38 - 3
src/pages/account/Journal.tsx

@@ -7,14 +7,23 @@ import dayjs from "dayjs";
 import { rpxToPx } from "@/utils/tools";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import NewHeader, { NewHeaderType } from "@/_health/components/new_header";
-import Taro from "@tarojs/taro";
+import Taro, { useRouter } from "@tarojs/taro";
 import StickyDateList from "@/_health/components/sticky_date_list";
 import { MainColorType } from "@/context/themes/color";
 import ListFooter from "@/_health/components/list_footer";
 import TimeTitleDesc from "@/_health/components/time_title_desc";
 import { TimeFormatter } from "@/utils/time_format";
+import { useTranslation } from "react-i18next";
 
 let myScrollTop = 0
+let useRoute;
+let useNavigation;
+let scenario = '';
+if (process.env.TARO_ENV == 'rn') {
+    useRoute = require("@react-navigation/native").useRoute
+    useNavigation = require("@react-navigation/native").useNavigation
+}
+
 export default function Journal() {
     const [journals, setJournals] = useState<any>([])
     const [isPulling, setIsPulling] = useState(false)
@@ -25,6 +34,21 @@ export default function Journal() {
     const [page, setPage] = useState(1)
     const [total, setTotal] = useState(0)
     const [loading, setLoading] = useState(false)
+    const {t} = useTranslation()
+
+    let router
+    let navigation;
+    if (useNavigation) {
+        navigation = useNavigation()
+    }
+
+    if (process.env.TARO_ENV == 'rn') {
+        router = useRoute()
+    }
+    else {
+        router = useRouter()
+    }
+    
 
     useEffect(() => {
         getJounalsData(1)
@@ -107,8 +131,9 @@ export default function Journal() {
         myScrollTop = top
 
         if (e.detail.scrollTop > 60) {
+            
             Taro.setNavigationBarTitle({
-                title: 'Journal'
+                title: pageTitle()
             })
         }
         else {
@@ -322,6 +347,16 @@ export default function Journal() {
         </View>
     }
 
+    function pageTitle(){
+        if (router.params.type == 'EAT'){
+            return t('health.title_food_journal')
+        }
+        else if (router.params.type == 'ACTIVE'){
+            return t('health.title_active_journal')
+        }
+        return t('health.title_journal')
+    }
+
     return <StickyDateList onRefresherRefresh={() => {
         setIsPulling(true)
         getJounalsData()
@@ -333,7 +368,7 @@ export default function Journal() {
             more()
         }}
     ><View style={{ display: 'flex', flexDirection: 'column', minHeight: rpxToPx(464), backgroundColor: '#f5f5f5' }}>
-            <NewHeader type={NewHeaderType.left} title="Journal" />
+            <NewHeader type={NewHeaderType.left} title={pageTitle()} />
             {
                 journals.map((item, index) => {
                     // if (index>0) return <View key={index}/>

+ 33 - 2
src/store/health.tsx

@@ -18,6 +18,10 @@ interface HealthState {
     schedules: any;
     footer: any;
     finish_setup: boolean;
+    first_eat_id: any;
+    eat_journal_tip: boolean;
+    first_active_id: any;
+    active_journal_tip: boolean;
 }
 
 const initialState: HealthState = {
@@ -36,7 +40,13 @@ const initialState: HealthState = {
     isCompleted: false,
     schedules: [],
     footer: null,
-    finish_setup: false
+    finish_setup: false,
+
+    //tip
+    first_eat_id: '',
+    first_active_id: '',
+    eat_journal_tip: false,
+    active_journal_tip: false
 }
 
 const healthSlice = createSlice({
@@ -90,6 +100,19 @@ const healthSlice = createSlice({
         },
         setFinishSetup(state, action) {
             state.finish_setup = action.payload
+        },
+
+        setFirstEatId(state, action) {
+            state.first_eat_id = action.payload
+        },
+        setFirstActiveId(state, action) {
+            state.first_active_id = action.payload
+        },
+        setEatTip(state, action) {
+            state.eat_journal_tip = action.payload
+        },
+        setActiveTip(state, action) {
+            state.active_journal_tip = action.payload
         }
 
     }
@@ -98,5 +121,13 @@ const healthSlice = createSlice({
 
 
 
-export const { setWindows, setMode, setTab, setRefreshs, setTitle, setEatArchived, setActiveArchived, setEatArchivedTotal, setActiveArchivedTotal, setShowActionTip, setFastWithSleep, setLongFast, setSchedules, setFooter, setFinishSetup } = healthSlice.actions;
+export const { setWindows,
+    setMode, setTab, setRefreshs,
+    setTitle, setEatArchived, setActiveArchived,
+    setEatArchivedTotal, setActiveArchivedTotal,
+    setShowActionTip, setFastWithSleep, setLongFast,
+    setSchedules, setFooter, setFinishSetup,
+    setFirstEatId, setFirstActiveId,
+    setEatTip, setActiveTip
+} = healthSlice.actions;
 export default healthSlice.reducer;