Leon 1 年之前
父节点
当前提交
58a58ea3f8

+ 168 - 0
src/_health/base/new_date_time_picker.tsx

@@ -0,0 +1,168 @@
+import { rpxToPx } from "@/utils/tools";
+import { PickerView, PickerViewColumn, Text, View } from "@tarojs/components";
+import { useEffect, useState } from "react";
+import './new_timepicker.scss'
+import dayjs from "dayjs";
+import { MainColorType } from "@/context/themes/color";
+
+export default function NewDateTimePicker(props: {
+    count?: number, date?: string, time?: string, onChange?: any, color?: string,
+    minTimestamp?: number,
+    maxTimestamp?: number
+}) {
+    const [items, setItems] = useState<any>([[0], [0], [0]])
+    const [values, setValues] = useState<any>([0, 0, 0])
+    const [loaded, setLoaded] = useState(false)
+
+    function longDatas() {
+        let result: any = []
+        var max = props.maxTimestamp ?? new Date().getTime()
+        const currentDate = new Date(max)
+        currentDate.setHours(23)
+        currentDate.setMinutes(59)
+        currentDate.setSeconds(59)
+        const startDate = new Date(props.minTimestamp!)
+        let date = startDate
+
+        const today = dayjs();
+        const yesterday = today.subtract(1, 'day');
+        while (date <= currentDate) {
+            var dt = dayjs(date.getTime())
+            var string = global.language == 'en' ? dt.format('MMM D') : dt.format('MMMD日')
+            if (dt.isSame(today, 'day') && dt.isSame(today, 'month') && dt.isSame(today, 'year')) {
+                string = (global.language == 'en' ? 'Today, ' : '今天 ') + string
+            }
+            else if (dt.isSame(yesterday, 'day') && dt.isSame(yesterday, 'month') && dt.isSame(yesterday, 'year')) {
+                string = (global.language == 'en' ? 'Yesterday, ' : '昨天 ') + string
+            }
+            result.push(string)
+            date.setDate(date.getDate() + 1)
+        }
+        debugger
+        return result
+    }
+
+    function longValues() {
+        if (props.date) {
+            var obj = dayjs(props.date)
+            const startDate = new Date(props.minTimestamp!)
+            let date = startDate
+            for (var i = 0; i < longDatas().length; i++) {
+
+                var dt = dayjs(date.getTime())
+                if (dt.isSame(obj, 'day') && dt.isSame(obj, 'month') && dt.isSame(obj, 'year')) {
+                    return i
+                }
+                date.setDate(date.getDate() + 1)
+            }
+
+
+
+        }
+        return 0
+    }
+
+
+    useEffect(() => {
+        var hours: any = []
+        var tempValues: any = [longValues(), 0, 0]
+        var str = props.time ? props.time : dayjs().format('HH:mm')
+        var tempHour = str.split(':')[0]
+        var tempMinute = str.split(':')[1]
+        for (var i = 0; i <= 23; i++) {
+            var str = (i + '').padStart(2, '0')
+            if (str == tempHour) {
+                tempValues[1] = i
+            }
+            hours.push(str)
+        }
+        var minutes: any = []
+        for (var i = 0; i <= 59; i++) {
+            var str = (i + '').padStart(2, '0')
+            if (str == tempMinute) {
+                tempValues[2] = i
+            }
+            minutes.push(str)
+        }
+        // var dates = ['Today', 'Yesterday', 'Dec 31']
+        setItems([longDatas(), hours, minutes])
+        setValues(tempValues)
+        setLoaded(true)
+    }, [])
+
+    useEffect(() => {
+        var hours: any = []
+        var tempValues: any = [longValues(), 0, 0]
+        var str = props.time ? props.time : dayjs().format('HH:mm')
+        var tempHour = str.split(':')[0]
+        var tempMinute = str.split(':')[1]
+        for (var i = 0; i <= 23; i++) {
+            var str = (i + '').padStart(2, '0')
+            if (str == tempHour) {
+                tempValues[1] = i
+            }
+            hours.push(str)
+        }
+        var minutes: any = []
+        for (var i = 0; i <= 59; i++) {
+            var str = (i + '').padStart(2, '0')
+            if (str == tempMinute) {
+                tempValues[2] = i
+            }
+            minutes.push(str)
+        }
+        setValues(tempValues)
+    }, [props.date, props.time])
+
+    function onPickerChange(e) {
+        setValues(e.detail.value)
+        if (props.onChange) {
+            var list = e.detail.value
+            var timestamp = props.minTimestamp! + list[0] * 24 * 3600 * 1000
+            var strDate = dayjs(timestamp).format('YYYY-MM-DD')
+
+            var strTime = (list[1] + '').padStart(2, '0') + ':' + (list[2] + '').padStart(2, '0')
+            props.onChange([strDate, strTime])
+        }
+    }
+
+    function getColor(i, j) {
+        if (i == 0 && j == values[0]) {
+            return true
+        }
+        if (i == 1 && j == values[1]) {
+            return true
+        }
+        if (i == 2 && j == values[2]) {
+            return true
+        }
+        return false
+    }
+    if (!loaded) return <View />
+
+    const bgStyle = `background-color: ${props.color}1A !important;`
+    return <PickerView
+        value={values}
+        // itemStyle={{ color: '#000' }}
+        style={{ color: '#000', height: rpxToPx(340), width: rpxToPx(618) }}
+        onChange={onPickerChange}
+        indicatorClass="pick_sel_item"
+        indicatorStyle={bgStyle}//""
+        immediateChange={true}
+        className="picker"
+    // maskClass={props.hideTitle?"picker-mask-small":"picker-mask"}
+    >
+        {
+            items.map((item, index) => {
+                return <PickerViewColumn key={index}>
+                    {item.map((obj, j) => {
+                        return (
+                            <Text key={j} style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: getColor(index, j) ? props.color ?? MainColorType.fast : '#000' }}>{obj}</Text>
+                        );
+                    })}
+                </PickerViewColumn>
+            })
+        }
+
+    </PickerView >
+}

+ 44 - 93
src/_health/components/choose_date_time.tsx

@@ -7,6 +7,7 @@ import NewDatePicker, { NewDatePickerType } from "../base/new_date_picker"
 import NewTimePicker from "../base/new_timepicker"
 import { IconCalendar } from "@/components/basic/Icons"
 import dayjs from "dayjs"
+import NewDateTimePicker from "../base/new_date_time_picker"
 
 export default function ChooseDateTime(props: {
     title?: any,
@@ -24,8 +25,9 @@ export default function ChooseDateTime(props: {
     time: string,
     expand: boolean,
     choose?: any,
-    timeChange: any,
-    dateChange: any
+    timeChange?: any,
+    dateChange?: any,
+    change?: any
 }) {
     const [chooseDate, setChooseDate] = useState(false)
     const [count, setCount] = useState(0)
@@ -34,6 +36,7 @@ export default function ChooseDateTime(props: {
         setCount(count => count + 1)
     }, [props.count])
 
+
     function dateTitle() {
         if (props.date == '') return global.language == 'en' ? 'Date' : '日期'
         var today = dayjs()
@@ -64,106 +67,54 @@ export default function ChooseDateTime(props: {
                 props.title ? <View className="h34" style={{ flex: 1, color: '#000' }}>{props.title}</View> :
                     <View style={{ flex: 1 }} />
             }
-
-            <View style={{
-                borderColor: props.showError ? 'red' : (props.expand && chooseDate) ?props.color:'transparent',
-                borderWidth: rpxToPx(2),
-                borderRadius: rpxToPx(88 / 4),
-                borderStyle: 'solid'
-            }}>
-            <NewButton
-                type={(props.expand && chooseDate && !props.showError) ? NewButtonType.alpha : NewButtonType.gray}
-                // type={NewButtonType.gray}
-                color={props.color}
-                title={dateTitle()}
-                fontSize={rpxToPx(34)}
-                width={rpxToPx(196)}
-                height={rpxToPx(84)}
-                disable={props.disable}
-                fontNormal
-                onClick={() => {
-                    setChooseDate(true)
-                    if (props.choose) {
-                        props.choose()
-                    }
-                    // setExpandIndex(index)
-                    // var list = JSON.parse(JSON.stringify(array))
-                    // list[index].today = !list[index].today
-                    // list[index].extra.confirm_time = new Date().getTime()
-                    // setArray(list)
-                }}
-            />
-            </View>
-            <View style={{ width: rpxToPx(12) }} />
-            <View style={{
-                borderColor: props.showError ? 'red' : (props.expand && !chooseDate) ? props.color : 'transparent',
-                borderWidth: rpxToPx(2),
-                borderRadius: rpxToPx(88 / 4),
-                borderStyle: 'solid'
-            }}>
-            <NewButton
-                type={(props.expand && !chooseDate && !props.showError) ? NewButtonType.alpha : NewButtonType.gray}
-                // type={NewButtonType.gray}
-                color={props.color}
-                title={timeTitle()}
-                fontSize={rpxToPx(34)}
-                width={rpxToPx(196)}
-                height={rpxToPx(84)}
-                disable={props.disable}
-                fontNormal
-                onClick={() => {
-                    setChooseDate(false)
-                    if (props.choose) {
-                        props.choose()
-                    }
-                }}
-            />
-            </View>
+            {/* <View className="h34" style={{color:props.color}}>{dateTitle()} {timeTitle()}</View> */}
+            {
+                !props.title ? <View className="h34" style={{ color: props.color }}>{dateTitle()} {timeTitle()}</View> :
+                    <View style={{
+                        borderColor: props.showError ? 'red' : (props.expand && !chooseDate) ? props.color : 'transparent',
+                        borderWidth: rpxToPx(2),
+                        borderRadius: rpxToPx(88 / 4),
+                        borderStyle: 'solid'
+                    }}>
+                        <NewButton
+                            type={(props.expand && !chooseDate && !props.showError) ? NewButtonType.alpha : NewButtonType.gray}
+                            color={props.color}
+                            title={dateTitle() + ' ' + timeTitle()}
+                            fontSize={rpxToPx(34)}
+                            width={rpxToPx(296)}
+                            height={rpxToPx(84)}
+                            disable={props.disable}
+                            fontNormal
+                            onClick={() => {
+                                setChooseDate(false)
+                                if (props.choose) {
+                                    props.choose()
+                                }
+                            }}
+                        />
+                    </View>
+            }
             {
                 !props.title && <View style={{ flex: 1 }} />
             }
             <View className='border_footer_line' style={{ left: rpxToPx(66) }} />
         </View>
+
         {
-            props.expand && chooseDate && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: rpxToPx(698), height: rpxToPx(340) }}>
-                {/* <NewDatePicker
-                        type={NewDatePickerType.normal}
-                        isToday={array[index].today}
-                        onChange={(e) => {
-                            var list = JSON.parse(JSON.stringify(array))
-                            list[index].today = e==1
-                            list[index].extra.confirm_time = new Date().getTime()
-                            setArray(list)
-                        }}
-                        color={iFast ? MainColorType.fast : MainColorType.sleep} /> */}
-                <NewDatePicker
-                    type={NewDatePickerType.date}
+            props.expand && !chooseDate && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: rpxToPx(698), height: rpxToPx(340) }}>
+                {/* <NewTimePicker time={props.time} onChange={(e) => {
+                    props.timeChange(e)
+                }} color={props.color} /> */}
+                <NewDateTimePicker date={props.date} count={props.count} time={props.time}
                     minTimestamp={props.minTimestamp ? props.minTimestamp : new Date().getTime() - 24 * 3600 * 1000}
                     maxTimestamp={props.maxTimestamp ?? new Date().getTime()}
-                    value={props.date}
-                    count={props.count}
                     onChange={(e) => {
-                        // var list = JSON.parse(JSON.stringify(array))
-                        // list[index].today = e == 1
-                        // list[index].extra.confirm_time = new Date().getTime()
-                        // setArray(list)
-                        props.dateChange(e)
-                    }}
-                    color={props.color} />
-            </View>
-        }
-        {
-            props.expand && chooseDate && !props.hideFooter && <View className='card_footer' />
-        }
-        {
-            props.expand && !chooseDate && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: rpxToPx(698), height: rpxToPx(340) }}>
-                <NewTimePicker time={props.time} onChange={(e) => {
-                    // var list = JSON.parse(JSON.stringify(array))
-                    // list[index].time = e
-                    // list[index].extra.confirm_time = new Date().getTime()
-                    // setArray(list)
-                    props.timeChange(e)
-                }} color={props.color} />
+                        if (props.dateChange)
+                            props.dateChange(e[0])
+                        if (props.timeChange)
+                            props.timeChange(e[1])
+                        props.change(e)
+                    }} color={props.color} />
             </View>
         }
 

+ 190 - 0
src/_health/components/choose_date_time_副本.tsx

@@ -0,0 +1,190 @@
+import { View, Image } from "@tarojs/components"
+import './choose_date_time.scss'
+import { rpxToPx } from "@/utils/tools"
+import NewButton, { NewButtonType } from "../base/new_button"
+import { useEffect, useState } from "react"
+import NewDatePicker, { NewDatePickerType } from "../base/new_date_picker"
+import NewTimePicker from "../base/new_timepicker"
+import { IconCalendar } from "@/components/basic/Icons"
+import dayjs from "dayjs"
+import NewDateTimePicker from "../base/new_date_time_picker"
+
+export default function ChooseDateTime(props: {
+    title?: any,
+    disable?: boolean,
+    showError?: boolean,
+    showLine?: boolean,
+    minTimestamp?: number,
+    maxTimestamp?: number,
+    hideFooter?: boolean,
+    footerTitle?: string,
+    tapFooter?: any,
+    count?: number,
+    color: string,
+    date: string,
+    time: string,
+    expand: boolean,
+    choose?: any,
+    timeChange: any,
+    dateChange: any
+}) {
+    const [chooseDate, setChooseDate] = useState(false)
+    const [count, setCount] = useState(0)
+
+    useEffect(() => {
+        setCount(count => count + 1)
+    }, [props.count])
+
+    function dateTitle() {
+        if (props.date == '') return global.language == 'en' ? 'Date' : '日期'
+        var today = dayjs()
+        const yesterday = today.subtract(1, 'day');
+        var date = dayjs(props.date)
+
+        if (today.format('YYYY-MM-DD') == date.format('YYYY-MM-DD')) {
+            return global.language == 'en' ? 'Today' : '今天'
+        }
+        if (yesterday.format('YYYY-MM-DD') == date.format('YYYY-MM-DD')) {
+            return global.language == 'en' ? 'Yesterday' : '昨天'
+        }
+        else {
+            return global.language == 'en' ? date.format('MMM D') : date.format('MMMD日')
+        }
+    }
+
+    function timeTitle() {
+        if (props.time == '')
+            return global.language == 'en' ? 'Time' : '时间'
+        return props.time
+
+    }
+
+    return <View style={{ position: 'relative' }}>
+        <View className="card_header">
+            {
+                props.title ? <View className="h34" style={{ flex: 1, color: '#000' }}>{props.title}</View> :
+                    <View style={{ flex: 1 }} />
+            }
+
+            <View style={{
+                borderColor: props.showError ? 'red' : (props.expand && chooseDate) ? props.color : 'transparent',
+                borderWidth: rpxToPx(2),
+                borderRadius: rpxToPx(88 / 4),
+                borderStyle: 'solid'
+            }}>
+                <NewButton
+                    type={(props.expand && chooseDate && !props.showError) ? NewButtonType.alpha : NewButtonType.gray}
+                    // type={NewButtonType.gray}
+                    color={props.color}
+                    title={dateTitle()}
+                    fontSize={rpxToPx(34)}
+                    width={rpxToPx(196)}
+                    height={rpxToPx(84)}
+                    disable={props.disable}
+                    fontNormal
+                    onClick={() => {
+                        setChooseDate(true)
+                        if (props.choose) {
+                            props.choose()
+                        }
+                        // setExpandIndex(index)
+                        // var list = JSON.parse(JSON.stringify(array))
+                        // list[index].today = !list[index].today
+                        // list[index].extra.confirm_time = new Date().getTime()
+                        // setArray(list)
+                    }}
+                />
+            </View>
+            <View style={{ width: rpxToPx(12) }} />
+            <View style={{
+                borderColor: props.showError ? 'red' : (props.expand && !chooseDate) ? props.color : 'transparent',
+                borderWidth: rpxToPx(2),
+                borderRadius: rpxToPx(88 / 4),
+                borderStyle: 'solid'
+            }}>
+                <NewButton
+                    type={(props.expand && !chooseDate && !props.showError) ? NewButtonType.alpha : NewButtonType.gray}
+                    // type={NewButtonType.gray}
+                    color={props.color}
+                    title={timeTitle()}
+                    fontSize={rpxToPx(34)}
+                    width={rpxToPx(196)}
+                    height={rpxToPx(84)}
+                    disable={props.disable}
+                    fontNormal
+                    onClick={() => {
+                        setChooseDate(false)
+                        if (props.choose) {
+                            props.choose()
+                        }
+                    }}
+                />
+            </View>
+            {
+                !props.title && <View style={{ flex: 1 }} />
+            }
+            <View className='border_footer_line' style={{ left: rpxToPx(66) }} />
+        </View>
+        {
+            props.expand && chooseDate && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: rpxToPx(698), height: rpxToPx(340) }}>
+                {/* <NewDatePicker
+                        type={NewDatePickerType.normal}
+                        isToday={array[index].today}
+                        onChange={(e) => {
+                            var list = JSON.parse(JSON.stringify(array))
+                            list[index].today = e==1
+                            list[index].extra.confirm_time = new Date().getTime()
+                            setArray(list)
+                        }}
+                        color={iFast ? MainColorType.fast : MainColorType.sleep} /> */}
+                <NewDatePicker
+                    type={NewDatePickerType.date}
+                    minTimestamp={props.minTimestamp ? props.minTimestamp : new Date().getTime() - 24 * 3600 * 1000}
+                    maxTimestamp={props.maxTimestamp ?? new Date().getTime()}
+                    value={props.date}
+                    count={props.count}
+                    onChange={(e) => {
+                        // var list = JSON.parse(JSON.stringify(array))
+                        // list[index].today = e == 1
+                        // list[index].extra.confirm_time = new Date().getTime()
+                        // setArray(list)
+                        props.dateChange(e)
+                    }}
+                    color={props.color} />
+            </View>
+        }
+        {
+            props.expand && chooseDate && !props.hideFooter && <View className='card_footer' />
+        }
+        {
+            props.expand && !chooseDate && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', width: rpxToPx(698), height: rpxToPx(340) }}>
+                {/* <NewTimePicker time={props.time} onChange={(e) => {
+                    props.timeChange(e)
+                }} color={props.color} /> */}
+                <NewDateTimePicker date={props.date} count={props.count} time={props.time}
+                    minTimestamp={props.minTimestamp ? props.minTimestamp : new Date().getTime() - 24 * 3600 * 1000}
+                    maxTimestamp={props.maxTimestamp ?? new Date().getTime()}
+                    onChange={(e) => {
+                        props.dateChange(e[0])
+                        props.timeChange(e[1])
+                    }} color={props.color} />
+            </View>
+        }
+
+        {
+            props.expand && !chooseDate && !props.hideFooter && <View className='card_footer'>
+                <NewButton type={NewButtonType.link}
+                    title={props.footerTitle}
+                    onClick={props.tapFooter}
+                >
+                    <View style={{ marginRight: rpxToPx(12), display: 'flex' }}>
+                        <IconCalendar width={rpxToPx(24)} color='#5C7099' />
+                    </View>
+                </NewButton>
+            </View>
+        }
+        {
+            props.showLine && <View className="border_footer_line" style={{ left: rpxToPx(66) }} />
+        }
+    </View>
+}

+ 9 - 5
src/_health/components/post_moment_time.tsx

@@ -179,9 +179,9 @@ export default function PostMomentTime(props: {
                     setShowDurationPicker(false)
                 }}
                 time={time}
-                timeChange={(e) => {
-                    setTime(e)
-                }}
+                // timeChange={(e) => {
+                //     setTime(e)
+                // }}
                 minTimestamp={getMinTimestamp()}
 
                 footerTitle={scheduleTime()}
@@ -197,9 +197,13 @@ export default function PostMomentTime(props: {
 
                 }}
                 date={selDate}
-                dateChange={(e) => {
-                    setSelDate(e)
+                change={(e)=>{
+                    setSelDate(e[0])
+                    setTime(e[1])
                 }}
+                // dateChange={(e) => {
+                //     setSelDate(e)
+                // }}
             />
         </Card>
         {/* <Card>

+ 1 - 1
src/_health/pages/add_moment.tsx

@@ -105,7 +105,7 @@ export default function AddMoment() {
         }
         else {
             Taro.enableAlertBeforeUnload({
-                message: 'hhh',
+                message: t('health.quit_tip'),
                 success(res) {
 
                 },

+ 27 - 24
src/_health/pages/guide_eat.tsx

@@ -65,30 +65,31 @@ export default function GuideEat() {
 
     }, [])
 
-    useEffect(() => {
-
-
-        var temps: any = []
-        list.map(item => {
-            if (item.id) {
-                var isFind = false
-                health.schedules.map(obj => {
-                    if (obj.id == item.id) {
-                        isFind = true
-                    }
-                })
-                if (!isFind) {
-                    temps.push(item)
-                }
-            }
-
-        })
-        var array = JSON.parse(JSON.stringify(list))
-        var filterArray = array.filter(item => !temps.some(itemA => itemA.id == item.id))
-        setList(filterArray)
-
-
-    }, [health.schedules])
+    // useEffect(() => {
+
+
+    //     var temps: any = []
+    //     list.map(item => {
+    //         if (item.id) {
+    //             var isFind = false
+    //             health.schedules.map(obj => {
+    //                 if (obj.id == item.id) {
+    //                     isFind = true
+    //                 }
+    //             })
+    //             if (!isFind) {
+    //                 temps.push(item)
+    //             }
+    //         }
+
+    //     })
+    //     debugger
+    //     var array = JSON.parse(JSON.stringify(list))
+    //     var filterArray = array.filter(item => !temps.some(itemA => itemA.id == item.id))
+    //     setList(filterArray)
+    //     debugger
+
+    // }, [health.schedules])
 
     function check(array, tapDone = false) {
         if (tapDone) {
@@ -104,6 +105,7 @@ export default function GuideEat() {
         }).then(res => {
 
             if ((res as any).result) {
+                debugger
                 dispatch(setSchedules((res as any).schedules))
                 dispatch(setFooter((res as any).footer))
                 setList((res as any).schedules)
@@ -296,6 +298,7 @@ export default function GuideEat() {
             }
         </Card>
     }
+
     return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
         <View style={{ height: navigationBarHeight, backgroundColor: MainColorType.g05, flexShrink: 0 }} />
         <View className="navi-bar" style={{ height: navigationBarHeight, zIndex: 1000, backgroundColor: MainColorType.g05 }}>

+ 19 - 19
src/_health/pages/guide_sleep.tsx

@@ -41,30 +41,30 @@ export default function GuideSleep() {
         }, 2000)
     }, [])
 
-    useEffect(() => {
+    // useEffect(() => {
 
 
-        var temps: any = []
-        list.map(item => {
-            if (item.id) {
-                var isFind = false
-                health.schedules.map(obj => {
-                    if (obj.id == item.id) {
-                        isFind = true
-                    }
-                })
-                if (!isFind) {
-                    temps.push(item)
-                }
-            }
+    //     var temps: any = []
+    //     list.map(item => {
+    //         if (item.id) {
+    //             var isFind = false
+    //             health.schedules.map(obj => {
+    //                 if (obj.id == item.id) {
+    //                     isFind = true
+    //                 }
+    //             })
+    //             if (!isFind) {
+    //                 temps.push(item)
+    //             }
+    //         }
 
-        })
-        var array = JSON.parse(JSON.stringify(list))
-        var filterArray = array.filter(item => !temps.some(itemA => itemA.id == item.id))
-        setList(filterArray)
+    //     })
+    //     var array = JSON.parse(JSON.stringify(list))
+    //     var filterArray = array.filter(item => !temps.some(itemA => itemA.id == item.id))
+    //     setList(filterArray)
 
 
-    }, [health.schedules])
+    // }, [health.schedules])
 
     function check(array, tapDone = false) {
         if (tapDone) {

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

@@ -46,6 +46,7 @@ export default function LogTime() {
         router = useRouter()
     }
     const [enterTime] = useState(new Date().getTime())
+    const [requestId,setRequestId]= useState(new Date().getTime())
 
     const isSingle = router.params.single == '1'
     const isFast = router.params.window == 'FAST'
@@ -537,8 +538,16 @@ export default function LogTime() {
         // console.log(params)
 
         // return
+        if (onlyCheck){
+            var dt = new Date().getTime()
+            params.requestId = dt
+            setRequestId(dt)
+        }
+        else {
+            params.requestId = requestId
+        }
 
-        params.requestId = enterTime
+        
 
         if (posting) return
         setPosting(true)
@@ -843,18 +852,27 @@ export default function LogTime() {
             choose={() => {
                 setExpandIndex(index)
             }}
-            dateChange={(e) => {
-                var list = JSON.parse(JSON.stringify(array))
-                list[index].date = e
-                list[index].extra.confirm_time = new Date().getTime()
-                setArray(list)
-            }}
-            timeChange={(e) => {
+            change={(e)=>{
                 var list = JSON.parse(JSON.stringify(array))
-                list[index].time = e
+                list[index].date = e[0]
+                list[index].time = e[1]
                 list[index].extra.confirm_time = new Date().getTime()
                 setArray(list)
             }}
+            // dateChange={(e) => {
+            //     debugger
+            //     var list = JSON.parse(JSON.stringify(array))
+            //     list[index].date = e
+            //     list[index].extra.confirm_time = new Date().getTime()
+            //     setArray(list)
+            // }}
+            // timeChange={(e) => {
+            //     debugger
+            //     var list = JSON.parse(JSON.stringify(array))
+            //     list[index].time = e
+            //     list[index].extra.confirm_time = new Date().getTime()
+            //     setArray(list)
+            // }}
         />
     }
 

+ 9 - 5
src/_health/pages/timeline_detail.tsx

@@ -796,14 +796,18 @@ export default function TimelineDetail() {
                         expand={true}
                         time={time}
                         hideFooter={true}
-                        timeChange={(e) => {
-                            setSelTime(e)
-                        }}
+                        // timeChange={(e) => {
+                        //     setSelTime(e)
+                        // }}
                         minTimestamp={new Date().getTime()}
                         date={selDate}
-                        dateChange={(e) => {
-                            setSelDate(e)
+                        change={e=>{
+                            setSelDate(e[0])
+                            setSelTime(e[1])
                         }}
+                        // dateChange={(e) => {
+                        //     setSelDate(e)
+                        // }}
                     />
                 </Card>
             </NewModal>

+ 12 - 10
src/components/layout/layout.tsx

@@ -29,6 +29,7 @@ export default function Layout(props: {
     isFastSleepTheme?: boolean,
     titleShowStyle: NaviBarTitleShowType,
     showPullToRefresh?: boolean,
+    updateTitle?: any
     // ref?: any
 }) {
     const { children, type, triggered } = props;
@@ -53,6 +54,8 @@ export default function Layout(props: {
                 headerTitle: showTitle ? props.title ? props.title : '' : '',
             });
         }
+        if (props.updateTitle)
+            props.updateTitle(showTitle ? props.title : '')
         // setTimeout(() => {
         //     if (process.env.TARO_ENV == 'rn') {
         //         setScrollTop(100)
@@ -74,12 +77,12 @@ export default function Layout(props: {
     }
 
     function onScroll(e) {
-        if (global.dimissSel){
+        if (global.dimissSel) {
             global.dimissSel()
         }
         if (props.titleShowStyle == NaviBarTitleShowType.scrollToShow) {
-            if (e.nativeEvent){
-                const {contentOffset} = e.nativeEvent
+            if (e.nativeEvent) {
+                const { contentOffset } = e.nativeEvent
                 if (contentOffset.y > 70) {
                     setShowTitle(true)
                 }
@@ -95,23 +98,22 @@ export default function Layout(props: {
                     setShowTitle(false)
                 }
             }
-            
+
         }
-        if (e.nativeEvent){
-            console.log('ssssss')
+        if (e.nativeEvent) {
             const { contentSize, contentOffset, layoutMeasurement } = e.nativeEvent;
             const isAtTheBottom =
                 contentSize.height - contentOffset.y <= layoutMeasurement.height;
-            if (isAtTheBottom && props.more){
+            if (isAtTheBottom && props.more) {
                 props.more()
             }
         }
-        
+
 
     }
 
     usePageScroll((e) => {
-        if (global.dimissSel){
+        if (global.dimissSel) {
             global.dimissSel()
         }
         if (props.titleShowStyle == NaviBarTitleShowType.scrollToShow) {
@@ -186,7 +188,7 @@ export default function Layout(props: {
                     scrollEventThrottle={400}
                     // scrollTop={scrollTop}
                     // scrollWithAnimation
-                    style={{ minHeight: Taro.getSystemInfoSync().screenHeight,backgroundColor:'#f5f5f5' }}
+                    style={{ minHeight: Taro.getSystemInfoSync().screenHeight, backgroundColor: '#f5f5f5' }}
                     refreshControl={
                         props.showPullToRefresh ? <RefreshControl
                             tintColor='black'

+ 1 - 1
src/context/locales/en.js

@@ -1020,6 +1020,6 @@ export default {
         me:'Me',
 
         edit_time:'Edit Time',
-        
+        quit_tip:'Your check-in will not be saved upon exit.',
     }
 }

+ 1 - 0
src/context/locales/zh.js

@@ -1021,5 +1021,6 @@ export default {
         this_week:'本周',
         me:'我',
         edit_time:'编辑时间',
+        quit_tip:'退出后不会保存打卡',
     }
 }

+ 1 - 1
src/features/health/HistoryItem.tsx

@@ -762,7 +762,7 @@ export default function HistoryItem(props: {
             }
 
             {
-                props.type == 'FAST,SLEEP' && <TargetProgress
+                props.type == 'FAST,SLEEP' && props.data.windows.length>=2 && <TargetProgress
                     showRing={true}
                     doubleRing={true}
                     first={props.data.windows[0]}

+ 31 - 6
src/features/health/MainHistory.tsx

@@ -19,6 +19,7 @@ import { useTranslation } from "react-i18next";
 import { setActiveTip, setEatTip, setFirstActiveId, setFirstEatId } from "@/store/health";
 import RightArrowRow from "@/_health/components/right_arrow_row";
 import NewButton, { NewButtonType } from "@/_health/base/new_button";
+import TimelineDate from "@/_health/components/timeline_date";
 
 let lastMode = ''
 let myScrollTop = 0
@@ -787,14 +788,38 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
             list.length > 0 && <View style={{ minHeight: rpxToPx(464), backgroundColor: '#fff', paddingTop: rpxToPx(60) }}>
                 {
                     list.map((item, index) => {
-                        if (itemLayouts.length >= index + 1 && index > 5) {
-                            if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
-                                return <View style={{ height: itemHeights[index] }} id={`history-${index}`} key={index}>
-                                    {
-                                        historyMonth(index)
-                                    }
+                        if (itemLayouts.length >= index + 1) {
+                            // if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
+                            //     return <View style={{ height: itemHeights[index] }} id={`history-${index}`} key={index}>
+                            //         {
+                            //             historyMonth(index)
+                            //         }
+                            //     </View>
+                            // }
+                            if (Math.abs(itemLayouts[index] - pageTop) > 3000) {
+                                return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
+                                    {/* {index} */}
+                                </View>
+                            }
+                            if (Math.abs(itemLayouts[index] - pageTop) > 1500) {
+                                return <View style={{
+                                    height: itemHeights[index], display: 'flex',
+                                    paddingLeft: rpxToPx(40),
+                                    paddingRight: rpxToPx(40),
+                                    boxSizing: 'border-box',
+                                    flexDirection: 'row'
+                                }} id={`history-${index}`}>
+                                    <TimelineDate timestamp={item.window_range.start_timestamp}
+                                        pre_timestamp={index>0 ? list[index - 1].window_range.start_timestamp : null}
+                                    />
+                                    <View style={{
+                                        display: 'flex', flexDirection: 'column', flex: 1,
+                                        width: rpxToPx(552), height: itemHeights[index] - rpxToPx(60), backgroundColor: '#fafafa'
+                                    }}>
+                                    </View>
                                 </View>
                             }
+
                         }
 
                         return <View id={`history-${index}`} key={index}>

+ 31 - 6
src/features/health/MainHistory2.tsx

@@ -18,6 +18,7 @@ import ListFooter from "@/_health/components/list_footer";
 import { useTranslation } from "react-i18next";
 import { setActiveTip, setEatTip, setFirstActiveId, setFirstEatId } from "@/store/health";
 import RightArrowRow from "@/_health/components/right_arrow_row";
+import TimelineDate from "@/_health/components/timeline_date";
 
 let lastMode = ''
 let myScrollTop = 0
@@ -741,14 +742,38 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
             list.length > 0 && <View style={{ minHeight: rpxToPx(464), backgroundColor: '#fff', paddingTop: rpxToPx(60) }}>
                 {
                     list.map((item, index) => {
-                        if (itemLayouts.length >= index + 1 && index > 5) {
-                            if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
-                                return <View style={{ height: itemHeights[index] }} id={`history-${index}`} key={index}>
-                                    {
-                                        historyMonth(index)
-                                    }
+                        if (itemLayouts.length >= index + 1) {
+                            // if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
+                            //     return <View style={{ height: itemHeights[index] }} id={`history-${index}`} key={index}>
+                            //         {
+                            //             historyMonth(index)
+                            //         }
+                            //     </View>
+                            // }
+                            if (Math.abs(itemLayouts[index] - pageTop) > 3000) {
+                                return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
+                                    {/* {index} */}
+                                </View>
+                            }
+                            if (Math.abs(itemLayouts[index] - pageTop) > 1500) {
+                                return <View style={{
+                                    height: itemHeights[index], display: 'flex',
+                                    paddingLeft: rpxToPx(40),
+                                    paddingRight: rpxToPx(40),
+                                    boxSizing: 'border-box',
+                                    flexDirection: 'row'
+                                }} id={`history-${index}`}>
+                                    <TimelineDate timestamp={item.window_range.start_timestamp}
+                                        pre_timestamp={index>0 ? list[index - 1].window_range.start_timestamp : null}
+                                    />
+                                    <View style={{
+                                        display: 'flex', flexDirection: 'column', flex: 1,
+                                        width: rpxToPx(552), height: itemHeights[index] - rpxToPx(60), backgroundColor: '#fafafa'
+                                    }}>
+                                    </View>
                                 </View>
                             }
+                            
                         }
                         return <View id={`history-${index}`} key={index}>
                             {

+ 28 - 108
src/pages/account/Journal.tsx

@@ -139,7 +139,10 @@ export default function Journal() {
     function measureItemLayouts() {
         const query = Taro.createSelectorQuery()
         journals.forEach((item, index) => {
-            query.select(`#history-${index}`).boundingClientRect()
+            if (index >= itemLayouts.length) {
+                query.select(`#history-${index}`).boundingClientRect()
+            }
+
         });
         query.exec((res) => {
 
@@ -151,8 +154,8 @@ export default function Journal() {
                     heights[index] = rect.height
                 }
             });
-            setItemLayouts(layouts)
-            setItemHeights(heights)
+            setItemLayouts([...itemLayouts, ...layouts])
+            setItemHeights([...itemHeights, ...heights])
         })
     }
 
@@ -305,106 +308,8 @@ export default function Journal() {
         return <View />
     }
 
-    function historyDate(item, index) {
-        if (index == 0) {
-            if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
-                return '今天'
-            }
-            if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
-                return '昨天'
-            }
-            return dayjs(item.timestamp).format('DD')
-        }
-        if (dayjs(item.timestamp).format('MM-DD') ==
-            dayjs(journals[index - 1].timestamp).format('MM-DD')) {
-            return ''
-        }
-        if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
-            return '今天'
-        }
-        if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
-            return '昨天'
-        }
-        return dayjs(item.timestamp).format('DD')
-    }
-
-    function historyMonth(item, index) {
-        if (index == 0) {
-            if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
-                return ''
-            }
-            if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
-                return ''
-            }
-            return dayjs(item.timestamp).format('MMM')
-        }
-        if (dayjs(item.timestamp).format('MM-DD') ==
-            dayjs(journals[index - 1].timestamp).format('MM-DD')) {
-            return ''
-        }
-        if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
-            return ''
-        }
-        if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
-            return ''
-        }
-        return dayjs(item.timestamp).format('MMM')
-    }
-
-    function journalCellText(index) {
-        var windows = journals[index].windows
-        var array: any = []
-        windows.map(window => {
-            window.events.map(event => {
-                event.moments && event.moments.map(moment => {
-                    array.push({
-                        title: moment.title,
-                        description: moment.description
-                    })
-                })
-            })
-
-        })
-        return array
-        if (array.length > 0) {
-            return <View style={{ display: 'flex', flexDirection: 'column' }}>
-                {
-                    array.map((item, index) => {
-                        if (index >= 3) return <View key={index * 10000} />
-                        return <TimeTitleDesc key={index * 10000}
-                            time=''
-                            title={item.title}
-                            desc={item.description}
-                        />
-                    })
-                }
-            </View>
-        }
-        return <View />
-    }
 
     function journalCell(item, index) {
-        // if (item.show_ring) {
-        //     if (item.windows) {
-        //         return <View key={index}>{
-        //             item.windows.map((temp, i) => {
-        //                 return <TargetProgress key={i * 1000} showLine={i < item.windows.length - 1 ? true : false}
-        //                     color={getThemeColor(temp.window)}
-        //                     showRing={true}
-        //                     desc={temp.description}
-        //                     icon={
-        //                         null
-        //                     }
-        //                     canvasId={`${temp.window}${temp.window_range.start_timestamp}${index}`}
-        //                     startTimestamp={temp.window_range.start_timestamp}
-        //                     endTimerstamp={temp.window_range.end_timestamp}
-        //                 />
-        //             })
-        //         }</View>
-
-        //     }
-        //     return <View key={index} />
-        // }
         return <View style={{ display: 'flex', flexDirection: 'column' }}>
             {
                 (item.pics.length > 0 || item.texts.length > 0) && <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), overflow: 'hidden', flexShrink: 0 }} key={index}>
@@ -447,11 +352,6 @@ export default function Journal() {
                                 />
                             })
                         }
-                        {/* <Text style={{backgroundColor:'pink'}}>...</Text> */}
-
-
-
-
                     </View>
 
 
@@ -593,12 +493,32 @@ export default function Journal() {
     // </recycle-view>
 
     function itemData(index, item) {
-        if (itemLayouts.length >= index + 1 && index > 5) {
-            if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
+        if (itemLayouts.length >= index + 1) {
+            if (Math.abs(itemLayouts[index] - pageTop) > 3000) {
                 return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
                     {/* {index} */}
                 </View>
             }
+            if (Math.abs(itemLayouts[index] - pageTop) > 1500) {
+                return <View style={{
+                    height: itemHeights[index], display: 'flex',
+                    paddingLeft: rpxToPx(40),
+                    paddingRight: rpxToPx(40),
+                    boxSizing: 'border-box',
+                    flexDirection: 'row'
+                }} id={`history-${index}`}>
+                    <TimelineDate
+                        timestamp={item.timestamp}
+                        pre_timestamp={index > 0 ? journals[index - 1].timestamp : null}
+                        isJournal
+                    />
+                    <View style={{
+                        display: 'flex', flexDirection: 'column', flex: 1,
+                        width: rpxToPx(552), height: itemHeights[index] - rpxToPx(60), backgroundColor: '#fafafa'
+                    }}>
+                    </View>
+                </View>
+            }
         }
         return <View className="history_item2" id={`history-${index}`} onClick={() => {
             jumpPage('/pages/account/JournalDetail?date=' + item.date + '&window=' + window) //JSON.stringify(item))

+ 7 - 5
src/pages/account/Profile.tsx

@@ -38,7 +38,7 @@ export default function Page() {
     const [memberAlert, setMemberAlert] = useState(global.memberAlert)
     const [baseDeviceTime, setBaseDeviceTime] = useState(false)
     const accessObj = useSelector((state: any) => state.access);
-    const [didShow,setDidShow] = useState(false)
+    const [naviTitle,setNaviTitle] = useState('')
 
     let navigation;
     if (useNavigation) {
@@ -46,10 +46,9 @@ export default function Page() {
     }
 
     useDidShow(()=>{
-        setDidShow(true)
-        setTimeout(()=>{
-            setDidShow(false)
-        },1000)
+        Taro.setNavigationBarTitle({
+            title:naviTitle
+        })
     })
 
     useEffect(() => {
@@ -467,6 +466,9 @@ export default function Page() {
             triggered={triggered}
             refresh={refresh}
             showPullToRefresh={true}
+            updateTitle={(title)=>{
+                setNaviTitle(title)
+            }}
         >
             {
                 detail()

+ 1 - 0
src/pages/clock/ClockNew.tsx

@@ -261,6 +261,7 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
         if (!user.isLogin) {
             return
         }
+        return
 
 
         const showAlert1 = await getStorage('148alert') || false;