Leon пре 1 година
родитељ
комит
a64951b6d0

+ 0 - 1
src/_health/components/onboard.tsx

@@ -7,7 +7,6 @@ import NewButton, { NewButtonType } from "../base/new_button";
 
 export default function OnBoard(props: { title: string, desc: string, btnTitle: string, onClick: any, color?: string }) {
     const health = useSelector((state: any) => state.health);
-    debugger
     return <View className="onboard_bg">
         <Text className="onboard_title">{props.title}</Text>
         <Text className={health.mode=='ACTIVE'?"onboard_desc g01":"onboard_desc g02"} 

+ 4 - 2
src/_health/pages/add_moment.tsx

@@ -33,6 +33,8 @@ if (process.env.TARO_ENV == 'rn') {
     useNavigation = require("@react-navigation/native").useNavigation
 }
 
+const enterTimestamp = new Date().getTime()
+
 export default function AddMoment() {
     const [desc, setDesc] = useState('')
     const { t } = useTranslation()
@@ -191,7 +193,7 @@ export default function AddMoment() {
         // }
         // debugger
 
-        var date = new Date(selDate + ' ' + time + ':00')
+        var date = new Date(selDate + ' ' + time + ':'+dayjs(enterTimestamp).format('ss'))
 
         var params: any = {
             schedule_id: schedule_id,
@@ -266,7 +268,7 @@ export default function AddMoment() {
     }
 
     function edit() {
-        var date = new Date(selDate + ' ' + time + ':00')
+        var date = new Date(selDate + ' ' + time + ':'+dayjs(enterTimestamp).format('ss'))
 
         var params: any = {
             schedule_id: schedule_id,

+ 27 - 4
src/_health/pages/log_time.tsx

@@ -30,6 +30,7 @@ if (process.env.TARO_ENV == 'rn') {
     useNavigation = require("@react-navigation/native").useNavigation
 }
 
+const enter_timestamp = new Date().getTime()
 export default function LogTime() {
     let router
     let navigation;
@@ -72,7 +73,7 @@ export default function LogTime() {
 
 
 
-    const enter_timestamp = new Date().getTime()
+    
 
 
     useEffect(() => {
@@ -303,7 +304,7 @@ export default function LogTime() {
         // var hour = parseInt(time.split(':')[0])
         // var minute = parseInt(time.split(':')[1])
         // var date = obj.date
-        var now = new Date(obj.date + 'T' + time + ':' + dayjs().format('ss'))
+        var now = new Date(obj.date + 'T' + time + ':' + dayjs(enter_timestamp).format('ss'))
         // now.setHours(hour)
         // now.setMinutes(minute)
         // now.setSeconds(0)
@@ -465,6 +466,19 @@ export default function LogTime() {
 
     }
 
+    function getLogMethod(list){
+        // if (isSingle) return 'LOG_ONCE'
+        if (list.length==1) return 'LOG_ONCE'
+        const { status } = data
+        if (status == 'OG2_MISALIGNED') return 'LOG_MULTIPLE'
+        if (status == 'OG2_NO1') return 'LOG_MULTIPLE'
+        if (status == 'WFS' && list.length>1) return 'LOG_MULTIPLE'
+        if (status == 'OG1' && list.length>2) return 'LOG_MULTIPLE'
+        if (status == 'OG2' && list.length>3) return 'LOG_MULTIPLE'
+        
+        return 'LOG_ONCE'
+    }
+
     function commit(list, onlyCheck, save_confirm) {
         const sortedData = list.sort((a, b) => {
             return b.extra.confirm_time - a.extra.confirm_time; // 降序
@@ -473,6 +487,7 @@ export default function LogTime() {
             check_items: sortedData,
             op_page: isFastWithSleep ? 'FAST_WITH_SLEEP' : null,
             only_check: onlyCheck,
+            log_method: getLogMethod(list),
             extra: {
                 set_time: enterTime,
                 confirm_time: new Date().getTime()
@@ -481,6 +496,10 @@ export default function LogTime() {
         if (save_confirm) {
             params.save_confirm = save_confirm
         }
+        // console.log(new Date().getTime())
+        // console.log(params)
+
+        // return
 
         if (posting) return
         setPosting(true)
@@ -582,10 +601,13 @@ export default function LogTime() {
         var minutes = Math.floor((seconds % 3600) / 60)
         var str = ''
         if (hour > 0) {
-            str = hour + '小时'
+            str = hour + TimeFormatter.getHoursUnit(hour)
         }
         if (minutes > 0) {
-            str += minutes + '分钟'
+            str += minutes + TimeFormatter.getMinutesUnit(minutes)
+        }
+        if (hour == 0 && minutes == 0){
+            str = 0 + TimeFormatter.getMinutesUnit(0)
         }
         return str
     }
@@ -912,6 +934,7 @@ export default function LogTime() {
                                 type={expandIndex == -1 ? NewButtonType.alpha : NewButtonType.gray}
                                 color={isFast ? MainColorType.fast : MainColorType.sleep}
                                 height={rpxToPx(84)}
+                                width={rpxToPx(218)}
                                 title={durationTime()}
                                 fontNormal
                                 onClick={() => { setExpandIndex(-1) }}

+ 2 - 1
src/_health/pages/long_fast_setting.tsx

@@ -16,6 +16,7 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import ChooseDateTime from "../components/choose_date_time";
 import StatusIndicator, { StatusType } from "../base/status_indicator";
 
+const enterTimestamp = new Date().getTime()
 export default function LongFastSetting() {
     const [showGoal, setShowGoal] = useState(true)
     const [isToday, setIsToday] = useState(true)
@@ -41,7 +42,7 @@ export default function LongFastSetting() {
 
     function commit() {
 
-        let now = new Date(dayjs().format('YYYY-MM-DDT') + time + ':00').getTime()
+        let now = new Date(dayjs().format('YYYY-MM-DDT') + time + ':'+dayjs(enterTimestamp).format('ss')).getTime()
         if (!isToday) {
             now = now - 24 * 3600 * 1000
         }

+ 7 - 0
src/_health/pages/schedules.tsx

@@ -33,6 +33,8 @@ if (process.env.TARO_ENV == 'rn') {
     useNavigation = require("@react-navigation/native").useNavigation
 }
 
+let indexError = true
+
 export default function Schedules() {
     let navigation, showActionSheetWithOptions;
 
@@ -125,6 +127,11 @@ export default function Schedules() {
             setTimeout(() => {
                 setHighlight(false)
             }, 2000)
+
+            if (router.params.error && indexError){
+                indexError = false
+                checkResultData(JSON.parse(router.params.error))
+            }
         }).catch(e => {
 
         })

+ 66 - 50
src/_health/pages/streak_calendar.tsx

@@ -11,6 +11,8 @@ import NewButton, { NewButtonType } from "../base/new_button";
 import { MainColorType } from "@/context/themes/color";
 import Calendar from "@/features/health/calendar";
 import { useTranslation } from "react-i18next";
+import Layout from "@/components/layout/layout";
+import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
 
 
 export default function StreakCalendar() {
@@ -25,7 +27,7 @@ export default function StreakCalendar() {
     const [month, setMonth] = useState(new Date().getMonth() + 1)
     const [current, setCurrent] = useState<any>(null)
     const [loaded, setLoaded] = useState(false)
-    const {t} = useTranslation()
+    const { t } = useTranslation()
 
     useEffect(() => {
         // loadData()
@@ -261,56 +263,70 @@ export default function StreakCalendar() {
         </View>
     }
 
-    console.log(mode)
-    return <View style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
-        <NewHeader type={NewHeaderType.left} title={t('health.streaks')} />
-        <ScrollView style={{ width: rpxToPx(750), flexDirection: 'row', display: 'flex', height: rpxToPx(72) }} scrollX enableFlex showScrollbar={false}>
-            <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
-            <NewButton type={NewButtonType.img} onClick={() => setMode('EAT')}>
-                <View className="streak_toolbar_btn"
-                    style={{ backgroundColor: mode == 'EAT' ? getThemeColor('EAT') + '1A' : 'transparent' }}
-                >
-                    <Text className={mode == 'EAT' ? 'bold h30' : 'h30'}
-                        style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01, marginRight: 5 }}>Eat </Text>
-                    <Text className="h20" style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01 }}>{currentCount('EAT')}</Text>
-                </View>
-            </NewButton>
-
-            <NewButton type={NewButtonType.img} onClick={() => setMode('ACTIVE')}>
-                <View className="streak_toolbar_btn"
-                    style={{ backgroundColor: mode == 'ACTIVE' ? getThemeColor('ACTIVE') + '1A' : 'transparent' }}
-                >
-                    <Text className={mode == 'ACTIVE' ? 'bold h30' : 'h30'}
-                        style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01, marginRight: 5 }}>Active</Text>
-                    <Text className="h20" style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01 }}> {currentCount('ACTIVE')}</Text>
-                </View>
-            </NewButton>
-            <NewButton type={NewButtonType.img} onClick={() => setMode('FAST')}>
-                <View className="streak_toolbar_btn"
-                    style={{ backgroundColor: mode == 'FAST' ? getThemeColor('FAST') + '1A' : 'transparent' }}
-                >
-                    <Text className={mode == 'FAST' ? 'bold h30' : 'h30'}
-                        style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01, marginRight: 5 }}>Fast</Text>
-                    <Text className="h20" style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01 }}> {currentCount('FAST')}</Text>
-                </View>
-            </NewButton>
-            <NewButton type={NewButtonType.img} onClick={() => setMode('SLEEP')}>
-                <View className="streak_toolbar_btn"
-                    style={{ backgroundColor: mode == 'SLEEP' ? getThemeColor('SLEEP') + '1A' : 'transparent' }}
-                >
-                    <Text className={mode == 'SLEEP' ? 'bold h30' : 'h30'}
-                        style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01, marginRight: 5 }}>Sleep</Text>
-                    <Text className="h20" style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01 }}> {currentCount('SLEEP')}</Text>
-                </View>
-            </NewButton>
-            <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
-        </ScrollView>
-        <View style={{ flex: 1, backgroundColor: '#fff', marginTop: rpxToPx(36) }}>
-            <Calendar year={year} month={month} mode={mode} />
-        </View>
+    function detail() {
+        return <View style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
+            <NewHeader type={NewHeaderType.left} title={t('health.streaks')} />
+            <ScrollView style={{ width: rpxToPx(750), flexDirection: 'row', display: 'flex', height: rpxToPx(72) }} scrollX enableFlex showScrollbar={false}>
+                <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
+                <NewButton type={NewButtonType.img} onClick={() => setMode('EAT')}>
+                    <View className="streak_toolbar_btn"
+                        style={{ backgroundColor: mode == 'EAT' ? getThemeColor('EAT') + '1A' : 'transparent' }}
+                    >
+                        <Text className={mode == 'EAT' ? 'bold h30' : 'h30'}
+                            style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01, marginRight: 5 }}>Eat </Text>
+                        <Text className="h20" style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01 }}>{currentCount('EAT')}</Text>
+                    </View>
+                </NewButton>
+
+                <NewButton type={NewButtonType.img} onClick={() => setMode('ACTIVE')}>
+                    <View className="streak_toolbar_btn"
+                        style={{ backgroundColor: mode == 'ACTIVE' ? getThemeColor('ACTIVE') + '1A' : 'transparent' }}
+                    >
+                        <Text className={mode == 'ACTIVE' ? 'bold h30' : 'h30'}
+                            style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01, marginRight: 5 }}>Active</Text>
+                        <Text className="h20" style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01 }}> {currentCount('ACTIVE')}</Text>
+                    </View>
+                </NewButton>
+                <NewButton type={NewButtonType.img} onClick={() => setMode('FAST')}>
+                    <View className="streak_toolbar_btn"
+                        style={{ backgroundColor: mode == 'FAST' ? getThemeColor('FAST') + '1A' : 'transparent' }}
+                    >
+                        <Text className={mode == 'FAST' ? 'bold h30' : 'h30'}
+                            style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01, marginRight: 5 }}>Fast</Text>
+                        <Text className="h20" style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01 }}> {currentCount('FAST')}</Text>
+                    </View>
+                </NewButton>
+                <NewButton type={NewButtonType.img} onClick={() => setMode('SLEEP')}>
+                    <View className="streak_toolbar_btn"
+                        style={{ backgroundColor: mode == 'SLEEP' ? getThemeColor('SLEEP') + '1A' : 'transparent' }}
+                    >
+                        <Text className={mode == 'SLEEP' ? 'bold h30' : 'h30'}
+                            style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01, marginRight: 5 }}>Sleep</Text>
+                        <Text className="h20" style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01 }}> {currentCount('SLEEP')}</Text>
+                    </View>
+                </NewButton>
+                <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
+            </ScrollView>
+            <View style={{ flex: 1, backgroundColor: '#fff', marginTop: rpxToPx(36) }}>
+                <Calendar year={year} month={month} mode={mode} />
+            </View>
 
-        {/* {
+            {/* {
             content()
         } */}
-    </View>
+        </View>
+    }
+
+    return <Layout children={detail()}
+        // title={router.params.title}
+
+        secondPage={true}
+        titleColor={'#fff'}
+        title={t('health.streaks')}
+        type={TemplateType.customHeader}
+        // refresh={() => { refresh() }}
+        // triggered={triggered}
+        // more={() => { more() }}
+        titleShowStyle={NaviBarTitleShowType.scrollToShow}
+    />
 }

+ 45 - 28
src/_health/pages/streak_weekly.tsx

@@ -8,6 +8,8 @@ import { useState } from "react";
 import { useTranslation } from "react-i18next";
 import '../../pages/clock/Clock2.scss'
 import NewButton, { NewButtonType } from "../base/new_button";
+import Layout from "@/components/layout/layout";
+import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
 
 let GradientText
 if (process.env.TARO_ENV == 'rn') {
@@ -31,39 +33,54 @@ export default function StreakWeekly() {
             </View>
         </View>
     }
-    
-    return <View>
-        <View style={{ display: 'flex', flexDirection: 'column' }}>
-            <View className="index_section">
-                <Text className="index_section_title">{t('health.windows')}</Text>
-            </View>
-            <WeekCalendar isFastSleep={true} />
-            <View style={{marginTop:30}}>
-                <NewButton 
-                    type={NewButtonType.link}
-                    title={t('feature.track_time_duration.weekly.show_eating_window')}
-                    onClick={() => setShowEatCalendar(true)}
-                />
-            </View>
-            {/* <View className="vip_calendar" onClick={() => setShowEatCalendar(true)}>
+
+    function detail() {
+
+        return <View>
+            <View style={{ display: 'flex', flexDirection: 'column' }}>
+                <View className="index_section">
+                    <Text className="index_section_title">{t('health.windows')}</Text>
+                </View>
+                <WeekCalendar isFastSleep={true} />
+                <View style={{ marginTop: 30 }}>
+                    <NewButton
+                        type={NewButtonType.link}
+                        title={t('feature.track_time_duration.weekly.show_eating_window')}
+                        onClick={() => setShowEatCalendar(true)}
+                    />
+                </View>
+                {/* <View className="vip_calendar" onClick={() => setShowEatCalendar(true)}>
                 {
                     process.env.TARO_ENV == 'weapp' ? <Text className="eat_calendar_text">{t('feature.track_time_duration.weekly.show_eating_window')}</Text> :
                         <GradientText style={{ fontSize: rpxToPx(28), color: 'black', fontWeight: 'bold' }} colors={[ColorType.food, ColorType.activity]}>{t('feature.track_time_duration.weekly.show_eating_window')}</GradientText>
                 }
 
             </View> */}
+            </View>
+            {
+                showEatCalendar && <Modal
+                    testInfo={null}
+                    dismiss={() => {
+                        setShowEatCalendar(false)
+                    }}
+                    confirm={() => { }}>
+                    {
+                        eatCalendarContent()
+                    }
+                </Modal>
+            }
         </View>
-        {
-            showEatCalendar && <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowEatCalendar(false)
-                }}
-                confirm={() => { }}>
-                {
-                    eatCalendarContent()
-                }
-            </Modal>
-        }
-    </View>
+    }
+    return <Layout children={detail()}
+        // title={router.params.title}
+
+        secondPage={true}
+        titleColor={'#fff'}
+        title={t('health.windows')}
+        type={TemplateType.customHeader}
+        // refresh={() => { refresh() }}
+        // triggered={triggered}
+        // more={() => { more() }}
+        titleShowStyle={NaviBarTitleShowType.scrollToShow}
+    />
 }

+ 3 - 1
src/_health/pages/timeline_detail.tsx

@@ -39,6 +39,8 @@ if (process.env.TARO_ENV == 'rn') {
     useRoute = require("@react-navigation/native").useRoute
     useNavigation = require("@react-navigation/native").useNavigation
 }
+
+const enterTimestmap = new Date().getTime()
 export default function TimelineDetail() {
     let showActionSheetWithOptions;
     const health = useSelector((state: any) => state.health);
@@ -259,7 +261,7 @@ export default function TimelineDetail() {
             })
             return
         }
-        var dt = new Date(selDate + ' ' + time + ':00')
+        var dt = new Date(selDate + ' ' + time + ':'+dayjs(enterTimestmap).format('ss'))
         var params: any = {
             schedule_id: schedule_id,
             description: desc,

+ 62 - 29
src/features/health/MainConsole.tsx

@@ -8,7 +8,7 @@ import { jumpPage } from "../trackTimeDuration/hooks/Common";
 import Modal from "@/components/layout/Modal.weapp";
 import { MainColorType } from "@/context/themes/color";
 import ConsolePicker from "../trackTimeDuration/components/ConsolePicker";
-import { clockTimes, delRecord, makeDone, updateEventDuration, updateFast, updateSchedule, updateTarget } from "@/services/health";
+import { clockTimes, delRecord, getLabelsEvent, makeDone, updateEventDuration, updateFast, updateSchedule, updateTarget } from "@/services/health";
 import TimePicker from "../common/TimePicker";
 import showActionSheet from "@/components/basic/ActionSheet";
 import { rpxToPx } from "@/utils/tools";
@@ -28,6 +28,7 @@ import Cell from "@/_health/base/cell";
 import ConsoleCell from "@/_health/components/console_cell";
 import IconTitleCell from "@/_health/components/icon_title_cell";
 import StatusIndicator, { StatusType } from "@/_health/base/status_indicator";
+import AddLabel from "@/_health/components/add_label";
 
 let useNavigation;
 let min = 0
@@ -36,6 +37,7 @@ let defaultTimestamp = 0
 
 let lastFastSleepStatus = ''
 
+
 if (process.env.TARO_ENV == 'rn') {
     useNavigation = require("@react-navigation/native").useNavigation
 }
@@ -48,6 +50,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 [labels, setLabels] = useState<any>([])
+    const [showModal, setShowModal] = useState(false)
+
 
     const [hideEatArchiveTip, setHideEatArchiveTip] = useState(false)
     const [hideActiveArchiveTip, setHideActiveArchiveTip] = useState(false)
@@ -59,6 +64,12 @@ export default function MainConsole(props: { type: WindowType }) {
         navigation = useNavigation()
     }
 
+    useEffect(() => {
+        getLabelsEvent({ window: 'ACTIVE' }).then(res => {
+            setLabels((res as any).labels)
+        })
+    }, [])
+
     useEffect(() => {
         if (health.fast_with_sleep.status == 'OG2_MISALIGNED' || health.fast_with_sleep.status == 'OG2_NO1') {
             if (lastFastSleepStatus != health.fast_with_sleep.status) {
@@ -73,8 +84,8 @@ export default function MainConsole(props: { type: WindowType }) {
         chooseLocation()
     }
 
-    global.postMementSuccess = ()=>{
-        if (health.mode == 'ACTIVE'){
+    global.postMementSuccess = () => {
+        if (health.mode == 'ACTIVE') {
             setHideActiveArchiveTip(false)
             global.hideActiveArchiveTip = false
         }
@@ -107,7 +118,7 @@ export default function MainConsole(props: { type: WindowType }) {
             return
         }
 
-        if (item.event == 'FAST_START' && health.long_fast.status == 'OG') {
+        if ((item.event == 'FAST_START' || item.event == 'FAST_END') && health.long_fast.status == 'OG') {
             showAlert({
                 title: '长断食进行中',
                 content: '当前有一个正在进行的长断食记录,要转换为间歇性断食吗?',
@@ -276,25 +287,6 @@ export default function MainConsole(props: { type: WindowType }) {
         jumpPage(`/_health/pages/timeline_detail?event_id=${item.event_id}&schedule_id=${item.schedule_id}`)
     }
 
-    function getIconColor(index) {
-        var color = getThemeColor(health.mode)
-        const time = new Date().getTime()
-        const scenario = getScenario(health.windows, health.mode)
-        const timeline = scenario.timeline[index]
-        if (health.mode == 'DAY' || health.mode == 'NIGHT') {
-            if (time > timeline.target.timestamp) {
-                return MainColorType.g03
-            }
-        }
-        if (timeline.real) {
-            return MainColorType.g03
-        }
-        if (timeline.target.timestamp < new Date().getTime()) {
-            return MainColorType.error
-        }
-        return color
-    }
-
     function processIcon(index) {
         const time = new Date().getTime()
         const scenario = getScenario(health.windows, health.mode)
@@ -657,7 +649,21 @@ export default function MainConsole(props: { type: WindowType }) {
                                 jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
                                 return
                             }
-                            jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
+                            if (!health.finish_setup) {
+                                showAlert({
+                                    title: '',
+                                    content: '在整个日程中,创建您的活动安排',
+                                    showCancel: true,
+                                    cancelText: '稍后',
+                                    confirmText: '立即设置',
+                                    confirm: () => {
+                                        tapGuide()
+                                    }
+                                })
+                                return
+                            }
+                            setShowModal(true)
+                            // jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
                         }}
                     />
                 }
@@ -882,11 +888,11 @@ export default function MainConsole(props: { type: WindowType }) {
         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')})
+            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')})
+                strTitle = t('health.tomorrow_at', { time: dayjs(scenario.archive_timestamp).format('HH:mm') })
             }
         }
 
@@ -895,13 +901,13 @@ export default function MainConsole(props: { type: WindowType }) {
         }}>
             <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>
+                <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'){
+                if (health.mode == 'EAT') {
                     setHideEatArchiveTip(true)
                 }
                 else {
@@ -1064,5 +1070,32 @@ export default function MainConsole(props: { type: WindowType }) {
                     setDurationPicker(false)
                 }} time={getScenario(health.windows, health.mode).target.duration} />
         }
+
+        {
+            showModal && <AddLabel labels={labels}
+                window='ACTIVE'
+                disMiss={() => setShowModal(false)}
+                op_page='SCHEDULE_ACTIVE_SLEEP'
+                // onlyCheck={true}
+                // schedules={[]}
+                confirm={(res) => {
+                    setShowModal(false)
+                    if ((res as any).result) {
+                        global.refreshWindow()
+                        // dispatch(setSchedules((res as any).schedules))
+                        // dispatch(setFooter((res as any).footer))
+                        // setList((res as any).schedules)
+                        // setErrors([])
+                    }
+                    else {
+                        jumpPage('/_health/pages/schedules?mode=' + health.mode+'&error='+JSON.stringify(res))
+                        // setList((res as any).schedules)
+                        // dispatch(setFooter((res as any).footer))
+                        // setErrors((res as any).error_messages ? (res as any).error_messages : [])
+                    }
+
+                }}
+                color={MainColorType.active} />
+        }
     </View >
 }

+ 40 - 24
src/pages/account/Album.tsx

@@ -17,6 +17,7 @@ import CoverList from "@/_health/components/cover_list";
 import { TimeFormatter } from "@/utils/time_format";
 import { useTranslation } from "react-i18next";
 import RightArrowRow from "@/_health/components/right_arrow_row";
+import NoRecord from "@/_health/components/no_record";
 
 let myScrollTop = 0
 export default function Album() {
@@ -31,6 +32,7 @@ export default function Album() {
     const [page, setPage] = useState(1)
     const [total, setTotal] = useState(0)
     const [loading, setLoading] = useState(false)
+    const [loaded,setLoaded] = useState(false)
     const { t } = useTranslation()
 
     useEffect(() => {
@@ -71,6 +73,7 @@ export default function Album() {
             }
             setIsPulling(false)
             setLoading(false)
+            setLoaded(true)
 
         }).catch(e => {
             setLoading(false)
@@ -294,24 +297,28 @@ export default function Album() {
             <RightArrowRow title={t('health.photo_wall')} onClick={() => {
                 jumpPage('/pages/account/PhotoWall?window=' + window)
             }} />
-            {
-                medias.map((item, index) => {
-                    return <View key={index} id={`history-${index}`} style={{ display: 'flex', flexDirection: 'column', paddingTop: rpxToPx(6), backgroundColor: '#fff' }}>
-                        {
-                            historyYear(index)
-                        }
-                        <View className="history_item2" style={{ paddingRight: rpxToPx(30) }}>
-                            <View className="cell_date" >
-                                <View className="h42 bold" style={{ lineHeight: rpxToPx(60) + 'px' }}>{historyDate(item, index)}</View>
-                                <View className="h24 bold" style={{ marginLeft: rpxToPx(6), marginTop: rpxToPx(13), lineHeight: rpxToPx(47) + 'px' }}>{historyMonth(item, index)}</View>
-                            </View>
-                            {/* <Text className="cell_date">{(item.date + '').substring(6, 9)}</Text> */}
-                            <View style={{ display: 'flex', flex: 1 }}>
-                                <CoverList
-                                    imgs={item.images}
-                                    count={item.images.length}
-                                />
-                                {/* <View className="media" style={{ marginRight: item.images.length == 4 ? 80 : 0 }}>
+            <View style={{
+                backgroundColor: '#fff',
+                minHeight: '100vh'
+            }}>
+                {
+                    medias.map((item, index) => {
+                        return <View key={index} id={`history-${index}`} style={{ display: 'flex', flexDirection: 'column', paddingTop: rpxToPx(6), backgroundColor: '#fff' }}>
+                            {
+                                historyYear(index)
+                            }
+                            <View className="history_item2" style={{ paddingRight: rpxToPx(30) }}>
+                                <View className="cell_date" >
+                                    <View className="h42 bold" style={{ lineHeight: rpxToPx(60) + 'px' }}>{historyDate(item, index)}</View>
+                                    <View className="h24 bold" style={{ marginLeft: rpxToPx(6), marginTop: rpxToPx(13), lineHeight: rpxToPx(47) + 'px' }}>{historyMonth(item, index)}</View>
+                                </View>
+                                {/* <Text className="cell_date">{(item.date + '').substring(6, 9)}</Text> */}
+                                <View style={{ display: 'flex', flex: 1 }}>
+                                    <CoverList
+                                        imgs={item.images}
+                                        count={item.images.length}
+                                    />
+                                    {/* <View className="media" style={{ marginRight: item.images.length == 4 ? 80 : 0 }}>
                                     {
                                         item.images.map((photo, i) => {
                                             return <Image onClick={() => {
@@ -323,14 +330,23 @@ export default function Album() {
                                         })
                                     }
                                 </View> */}
+                                </View>
+                                {/* <View className="border_footer_line" /> */}
                             </View>
-                            {/* <View className="border_footer_line" /> */}
                         </View>
-                    </View>
-                })
-            }
-            <View style={{ height: rpxToPx(40), flexShrink: 0, backgroundColor: '#fff' }} />
-            <ListFooter noMore={(medias.length > 0) && (total == medias.length)} />
+                    })
+                }
+                {
+                    medias.length > 0 && <View style={{ height: rpxToPx(40), flexShrink: 0, backgroundColor: '#fff' }} />
+                }
+
+                <ListFooter noMore={(medias.length > 0) && (total == medias.length)} />
+
+                {
+                    loaded && medias.length == 0 && <NoRecord />
+                }
+
+            </View>
         </View>
     </StickyDateList>
 }

+ 4 - 4
src/pages/account/ChooseAuth.tsx

@@ -45,11 +45,11 @@ export default function Page() {
                 console.log('new user')
                 if (user.scenario_select_count == 0) {
                     console.log('new')
-                    Taro.redirectTo({
-                        url: '/pages/clock/ChooseScenario?trigger_event=SETUP_UPON_ACCOUNT_CREATION'
-                    })
+                    // Taro.redirectTo({
+                    //     url: '/pages/clock/ChooseScenario?trigger_event=SETUP_UPON_ACCOUNT_CREATION'
+                    // })
                     setTimeout(() => {
-                        Taro.navigateTo({
+                        Taro.redirectTo({
                             url: '/pages/account/ProfileSetting?newuser=1'
                         })
                     }, 100)

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

@@ -19,6 +19,7 @@ import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks
 import { useSelector } from "react-redux";
 import { IconClose } from "@/components/basic/Icons";
 import TargetProgress from "@/_health/components/target_progress";
+import NoRecord from "@/_health/components/no_record";
 
 let myScrollTop = 0
 let useRoute;
@@ -532,50 +533,55 @@ export default function Journal() {
                     <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
                 </ScrollView>
             } */}
-            {
-                journals.map((item, index) => {
-                    // if (index>0) return <View key={index}/>
-                    return <View key={index}>
-                        {
-                            historyYear(index)
-                        }
-                        <View className="history_item2" id={`history-${index}`} onClick={() => {
-                            if (index == 0) {
-                                setTimeout(() => { setShowBadge(false) }, 1000)
+            <View style={{minHeight:'100vh',backgroundColor:'#fff'}}>
+                {
+                    journals.map((item, index) => {
+                        // if (index>0) return <View key={index}/>
+                        return <View key={index}>
+                            {
+                                historyYear(index)
                             }
-                            jumpPage('/pages/account/JournalDetail?date=' + item.date + '&window=' + window) //JSON.stringify(item))
-                        }}>
-
-                            <View className="cell_date" >
-                                <View className="h42 bold" style={{ lineHeight: rpxToPx(60) + 'px' }}>{historyDate(item, index)}</View>
-                                <View className="h24 bold" style={{ marginLeft: rpxToPx(6), marginTop: rpxToPx(13), lineHeight: rpxToPx(47) + 'px' }}>{historyMonth(item, index)}</View>
-                                {
-                                    index == 0 && showBadge && <View style={{
-                                        position:'absolute',
-                                        backgroundColor: MainColorType.error,
-                                        width: rpxToPx(12),
-                                        height: rpxToPx(12),
-                                        borderRadius: rpxToPx(6),
-                                        right:10,
-                                        top:0
-                                    }} />
+                            <View className="history_item2" id={`history-${index}`} onClick={() => {
+                                if (index == 0) {
+                                    setTimeout(() => { setShowBadge(false) }, 1000)
                                 }
-                            </View>
-                            <View style={{ display: 'flex', flexDirection: 'column', flex: 1, paddingTop: rpxToPx(4) }}>
-                                {/* {
+                                jumpPage('/pages/account/JournalDetail?date=' + item.date + '&window=' + window) //JSON.stringify(item))
+                            }}>
+
+                                <View className="cell_date" >
+                                    <View className="h42 bold" style={{ lineHeight: rpxToPx(60) + 'px' }}>{historyDate(item, index)}</View>
+                                    <View className="h24 bold" style={{ marginLeft: rpxToPx(6), marginTop: rpxToPx(13), lineHeight: rpxToPx(47) + 'px' }}>{historyMonth(item, index)}</View>
+                                    {
+                                        index == 0 && showBadge && <View style={{
+                                            position: 'absolute',
+                                            backgroundColor: MainColorType.error,
+                                            width: rpxToPx(12),
+                                            height: rpxToPx(12),
+                                            borderRadius: rpxToPx(6),
+                                            right: 10,
+                                            top: 0
+                                        }} />
+                                    }
+                                </View>
+                                <View style={{ display: 'flex', flexDirection: 'column', flex: 1, paddingTop: rpxToPx(4) }}>
+                                    {/* {
                                     item.windows.map((window, i) => {
                                         return journalItem(window, i)
                                     })
                                 } */}
-                                {
-                                    journalCell(item, index)
-                                }
-                            </View>
-                            {/* <View className="border_footer_line" /> */}
-                        </View></View>
-                })
-            }
-            <View style={{ height: rpxToPx(40), flexShrink: 0, backgroundColor: '#fff' }} />
+                                    {
+                                        journalCell(item, index)
+                                    }
+                                </View>
+                                {/* <View className="border_footer_line" /> */}
+                            </View></View>
+                    })
+                }
+                {
+                    loaded && journals.length==0 && <NoRecord />
+                }
+                <View style={{ height: rpxToPx(40), flexShrink: 0, backgroundColor: '#fff' }} />
+            </View>
             <ListFooter noMore={(journals.length > 0) && (total == journals.length)} />
         </View></StickyDateList>
 }

+ 6 - 5
src/pages/account/PhotoWall.tsx

@@ -136,17 +136,18 @@ export default function PhotoWall() {
                             style={{ width: itemWidth, height: itemWidth, backgroundColor: '#f5f5f5', marginBottom: space }} />
                     })
                 }
-                <View style={{ width: itemWidth, height: itemWidth }} />
-                <View style={{ width: itemWidth, height: itemWidth }} />
+                <View style={{ width: itemWidth, height: 0 }} />
+                <View style={{ width: itemWidth, height: 0 }} />
             </View>
             {
-                loaded && pageIndex*pageSize >= total && <ListFooter noMore={true} />
+                loaded && pageIndex*pageSize >= total &&  total>0&& <ListFooter noMore={true} />
             }
 
         </View>
     }
 
-    return <View style={{ position: 'relative' }}>
+    return <View style={{ position: 'relative',backgroundColor:'#fff',minHeight:'100vh' }}>
+        
         <Layout children={detail()}
             // title={router.params.title}
             
@@ -158,7 +159,7 @@ export default function PhotoWall() {
             refresh={() => { refresh() }}
             triggered={triggered}
             more={() => { more() }}
-            titleShowStyle={NaviBarTitleShowType.scrollToShow}
+            titleShowStyle={NaviBarTitleShowType.alwayShow}
         />
         {
             loaded && list.length == 0 && <NoRecord />

+ 2 - 1
src/pages/account/ProfileSetting.config.ts

@@ -3,5 +3,6 @@ export default definePageConfig({
         // 'ec-canvas': '../../lib/ec-canvas/ec-canvas',
         // 'demo':'../../components/demo'
     },
-    "navigationBarTitleText": ""
+    "navigationBarTitleText": "",
+    "navigationBarBackgroundColor":"#f5f5f5"
 })

+ 34 - 3
src/pages/account/ProfileSetting.tsx

@@ -13,8 +13,10 @@ import TableCell from "@/components/layout/TableCell";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import Footer from "@/components/layout/Footer";
 import { ChooseScenarioBtn } from "@/features/common/SpecBtns";
-import { ColorType } from "@/context/themes/color";
+import { ColorType, MainColorType } from "@/context/themes/color";
 import { checkAuthorized } from "@/utils/check_authorized";
+import NewButton, { NewButtonType } from "@/_health/base/new_button";
+import { rpxToPx } from "@/utils/tools";
 
 let useNavigation;
 if (process.env.TARO_ENV == 'rn') {
@@ -129,6 +131,22 @@ export default function Page() {
         })
     }
 
+    function tapDone() {
+        if (process.env.TARO_ENV == 'weapp') {
+            // Taro.navigateBack()
+            // console.log('profile setting navi back')
+            if (router.params.newuser == '1'){
+                // jumpPage('')
+                Taro.redirectTo({
+                    url:'/_health/pages/guide_begin'
+                })
+            }
+        }
+        else {
+            navigation.goBack()
+        }
+    }
+
     return <View className="container" style={{ flex: 1 }}>
         <View className="avatar_row">
             <View className="avatar_bg">
@@ -149,6 +167,7 @@ export default function Page() {
         </View>
 
 
+
         <View onClick={editNickname}>
             <TableCell onClick={editNickname} title={t('page.user_profile.nickname')} showArrow={true} showMarginBottom={true}>
                 <Text style={{ opacity: 0.8, color: '#fff' }}>{router.params.newuser == '1' ? (user.nickname == name ? '取个名字' : user.nickname) : user.nickname}</Text>
@@ -156,7 +175,19 @@ export default function Page() {
         </View>
         <View style={{ flex: 1 }} />
 
-        <Footer>
+        <View className="main_footer">
+            <NewButton
+                color={MainColorType.blue}
+                type={NewButtonType.fill}
+                title={t('feature.common.picker_confirm_btn')}
+                width={rpxToPx(646)}
+                height={rpxToPx(96)}
+                disable={router.params.newuser == '1' && (user.avatar == header || user.nickname == name)}
+                bold={true}
+                onClick={() => tapDone()} />
+        </View>
+
+        {/* <Footer>
             <ChooseScenarioBtn disable={router.params.newuser == '1' && (user.avatar == header || user.nickname == name)} title={t('feature.common.picker_confirm_btn')} onClick={() => {
                 if (process.env.TARO_ENV == 'weapp') {
                     Taro.navigateBack()
@@ -167,7 +198,7 @@ export default function Page() {
                 }
             }} background={ColorType.fast} />
         </Footer>
-        <View style={{ height: 40 }} />
+        <View style={{ height: 40 }} /> */}
 
 
     </View>

+ 4 - 4
src/utils/time_format.ts

@@ -623,9 +623,9 @@ export class TimeFormatter {
   static getSecondsUnit = (seconds, isFull?: boolean) => {
     if (global.language == 'en') {
       if (isFull) {
-        return seconds > 1 ? ' seconds ' : ' second '
+        return seconds != 1 ? ' seconds ' : ' second '
       }
-      return seconds > 1 ? ' secs ' : ' sec '
+      return seconds != 1 ? ' secs ' : ' sec '
     }
     return '秒'
   }
@@ -633,9 +633,9 @@ export class TimeFormatter {
   static getMinutesUnit = (minutes, isFull?: boolean) => {
     if (global.language == 'en') {
       if (isFull) {
-        return minutes > 1 ? ' minutes ' : ' minute '
+        return minutes != 1 ? ' minutes ' : ' minute '
       }
-      return minutes > 1 ? ' mins ' : ' min '
+      return minutes != 1 ? ' mins ' : ' min '
     }
     return '分钟'
   }