leon 1 năm trước cách đây
mục cha
commit
b0fa756ba1

+ 41 - 2
src/_health/base/new_button.tsx

@@ -2,6 +2,8 @@ import { View, Text } from '@tarojs/components'
 import './new_button.scss'
 import { rpxToPx } from '@/utils/tools';
 import { useState } from 'react';
+import { IconMore } from '@/components/basic/Icons';
+import { MainColorType } from '@/context/themes/color';
 
 export enum NewButtonType {
     fill = 'fill', //主题实色
@@ -11,6 +13,7 @@ export enum NewButtonType {
     text = 'text', //纯文本
     link = 'link',  //超链接(有可能带icon)
     label = 'label',
+    more = 'more'
 }
 
 function hexToHSL(hex) {
@@ -70,6 +73,7 @@ export default function NewButton(props: {
     fontSize?: number,
     bold?: boolean,
     labelBorder?: boolean,
+    btnStyle?: any,
 }) {
 
     const [isTouched, setIsTouched] = useState(false)
@@ -126,8 +130,8 @@ export default function NewButton(props: {
             style = {
                 height: props.height ?? rpxToPx(72),
                 minWidth: props.width ?? rpxToPx(198),
-                paddingLeft:15,
-                paddingRight:15,
+                paddingLeft: 15,
+                paddingRight: 15,
                 borderRadius: props.height ? props.height / 4 : rpxToPx(72 / 4),
                 backgroundColor: isTouched ? '#b2b2b240' : '#b2b2b210',
                 color: props.disable ? '#b2b2b2' : '#000000',
@@ -195,6 +199,41 @@ export default function NewButton(props: {
                 color: '#5C7099'
             }
             break
+        case NewButtonType.more:
+            return <View style={{
+                ...props.btnStyle,
+                width: rpxToPx(74),
+                height: rpxToPx(44),
+                display: 'flex',
+                alignItems: 'center',
+                justifyContent: 'center',
+                borderRadius: rpxToPx(11),
+                backgroundColor: isTouched ? '#b2b2b24d' : '#b2b2b21a'
+            }}
+                catchMove
+                onClick={(e) => {
+                    if (process.env.TARO_ENV == 'weapp') {
+                        e.stopPropagation()
+                    }
+                    if (props.disable) return
+                    props.onClick()
+                }}
+                onTouchStart={(e) => {
+                    if (process.env.TARO_ENV == 'weapp') {
+                        e.stopPropagation()
+                    }
+                    if (props.disable) return
+                    setIsTouched(true)
+                }}
+                onTouchEnd={(e) => {
+                    if (process.env.TARO_ENV == 'weapp') {
+                        e.stopPropagation()
+                    }
+                    setIsTouched(false)
+                }}
+            >
+                <IconMore color={MainColorType.link} width={rpxToPx(34)} />
+            </View>
     }
 
     return <View

+ 32 - 18
src/_health/components/fast_sleep_console.tsx

@@ -8,6 +8,7 @@ import dayjs from "dayjs";
 import { MainColorType } from "@/context/themes/color";
 import showAlert from "@/components/basic/Alert";
 import { delRecord } from "@/services/trackTimeDuration";
+import { IconCellArrow, IconNotification, IconNotificationOff } from "@/components/basic/Icons";
 
 export default function FastSleepConsole(props: { step: number, data: any }) {
 
@@ -85,7 +86,7 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
     function delConfirm() {
         const { fast, sleep } = props.data
         let array: any = []
-        if (fast.window_id){
+        if (fast.window_id) {
             array.push(fast.window_id)
         }
         if (sleep.window_id) {
@@ -106,7 +107,7 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
     }
 
     function getIconColor(index: number, finish: boolean) {
-        var color = '#D9D9D9'
+        var color = MainColorType.g03
         if (index == 1 || index == 2) {
             color = MainColorType.sleep
         }
@@ -114,7 +115,7 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
             color = MainColorType.fast
         }
         if (finish) {
-            color = '#D9D9D9'
+            color = MainColorType.g03
         }
 
         return color;
@@ -138,7 +139,7 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
                         showBtn = false;
                         finish = true;
                     }
-                    time = dayjs(fast.target.start_timestamp).format('HH:mm')
+                    time = dayjs(fast.target.start_timestamp).format('MM-DD HH:mm')
                 }
                 break;
             case 1:
@@ -151,10 +152,10 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
                         finish = true;
                     }
                     if (status == 'OG3') {
-                        time = dayjs(sleep.real.start_timestamp).format('HH:mm')
+                        time = dayjs(sleep.real.start_timestamp).format('MM-DD HH:mm')
                     }
                     else {
-                        time = dayjs(sleep.target.start_timestamp).format('HH:mm')
+                        time = dayjs(sleep.target.start_timestamp).format('MM-DD HH:mm')
                     }
 
                 }
@@ -164,11 +165,11 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
                     if (status == 'OG3') {
                         showBtn = false
                         finish = true;
-                        time = dayjs(sleep.real.end_timestamp).format('HH:mm')
+                        time = dayjs(sleep.real.end_timestamp).format('MM-DD HH:mm')
                     }
                     else {
                         showBtn = true
-                        time = dayjs(sleep.target.end_timestamp).format('HH:mm')
+                        time = dayjs(sleep.target.end_timestamp).format('MM-DD HH:mm')
                     }
 
                 }
@@ -176,7 +177,7 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
             case 3:
                 {
                     showBtn = true
-                    time = dayjs(fast.target.end_timestamp).format('HH:mm')
+                    time = dayjs(fast.target.end_timestamp).format('MM-DD HH:mm')
                 }
                 break;
         }
@@ -194,16 +195,19 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
                 <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
                     <View style={{
                         flexShrink: 0,
-                        width: rpxToPx(28),
-                        height: rpxToPx(28),
-                        borderRadius: rpxToPx(14),
+                        width: rpxToPx(26),
+                        height: rpxToPx(26),
+                        borderRadius: rpxToPx(13),
                         marginRight: rpxToPx(8),
                         display: 'flex',
                         alignItems: 'center',
                         justifyContent: 'center',
                         backgroundColor: getIconColor(index, finish)
                     }}>
-                        <Image style={{ width: rpxToPx(20), height: rpxToPx(20) }} src={finish ? require('@assets/_health/checked.png') : require('@assets/_health/ring.png')} />
+                        {
+                            finish ? <Image style={{ width: rpxToPx(20), height: rpxToPx(20) }} src={require('@assets/_health/checked.png')} /> :
+                                item.timeline.reminder ? <IconNotification color="#fff" width={rpxToPx(20)} /> : <IconNotificationOff color="#fff" width={rpxToPx(20)} />
+                        }
                     </View>
                     <Text className="timeline_time">{time}</Text>
                 </View>
@@ -243,9 +247,11 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
                     bold={true}
                     onClick={() => {
                         tapLogBtn(index)
-                        // 
                     }} />
             }
+            {
+                item.action == 'POST_MOMENT' && item.timeline.real && <IconCellArrow color='#B2B2B2' width={rpxToPx(34)} />
+            }
             <View className="seperate_line" style={{ left: count - 1 == index ? -rpxToPx(52) : rpxToPx(52) }} />
         </View>
     }
@@ -256,7 +262,9 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
                 title: 'Start Fast',
                 mode: 'FAST',
                 is_start: true,
-                moment: props.data.fast.timeline[0].moment
+                action: props.data.fast.timeline[0].action,
+                moment: props.data.fast.timeline[0].moment,
+                timeline:props.data.fast.timeline[0]
             }, 0, 4)
         }
         {
@@ -264,21 +272,27 @@ export default function FastSleepConsole(props: { step: number, data: any }) {
                 title: 'Go to bed',
                 mode: 'SLEEP',
                 is_start: true,
-                moment: props.data.sleep.timeline[0].moment
+                action: props.data.fast.timeline[0].action,
+                moment: props.data.sleep.timeline[0].moment,
+                timeline:props.data.sleep.timeline[0]
             }, 1, 4)
         }
         {
             props.step != 1 && timelineItem({
                 title: 'Wake up',
                 mode: 'SLEEP',
-                is_start: false
+                is_start: false,
+                moment: props.data.sleep.timeline[1].moment,
+                timeline:props.data.sleep.timeline[1]
             }, 2, 4)
         }
         {
             props.step != 1 && props.step != 2 && timelineItem({
                 title: 'End Fast',
                 mode: 'FAST',
-                is_start: false
+                is_start: false,
+                moment: props.data.fast.timeline[1].moment,
+                timeline:props.data.fast.timeline[1]
             }, 3, 4)
         }
         {

+ 73 - 11
src/_health/components/post_moment_time.tsx

@@ -8,6 +8,8 @@ import { rpxToPx } from '@/utils/tools';
 import NewTimePicker from '../base/new_timepicker';
 import { IconCalendar, IconTarget } from '@/components/basic/Icons';
 import NewDurationPicker from '../base/new_durationpicker';
+import NewButton, { NewButtonType } from '../base/new_button';
+import dayjs from 'dayjs';
 
 export default function PostMomentTime(props: {
     title?: string,
@@ -37,32 +39,79 @@ export default function PostMomentTime(props: {
         return str
     }
 
+    function endTime() {
+        var now = new Date()
+        var hour = parseInt(time.split(':')[0] + '')
+        var minute = parseInt(time.split(':')[1] + '')
+        now.setHours(hour)
+        now.setMinutes(minute)
+        var timestamp = now.getTime()
+        if (isYesterday) {
+            timestamp = timestamp - 24 * 3600 * 1000
+        }
+        timestamp = timestamp + minutes * 60 * 1000
+
+        const today = dayjs();
+        const dt = dayjs(timestamp);
+        var strTime = dt.format('HH:mm ')
+        const yesterday = today.subtract(1, 'day');
+        const tomorrow = today.subtract(-1, 'day');
+
+        if (dt.isSame(today, 'day')) {
+            return strTime + 'Today';
+        } else if (dt.isSame(yesterday, 'day')) {
+            return strTime + 'Yesterday';
+        }else if (dt.isSame(tomorrow, 'day')) {
+            return strTime + 'Tomorrow';
+        } else {
+            return strTime + dt.format('MM-DD');
+        }
+    }
+
     function durationContent() {
         return <View className='picker_time_card'>
             <View className='picker_time_card_header'>
+                <View style={{ width: rpxToPx(52) }} />
                 <Text>Duration</Text>
-                <View className='time_btn' onClick={() => setShowDurationPicker(true)}>{durationTime()}</View>
+                <View style={{ flex: 1 }} />
+                <NewButton
+                    type={showDurationPicker ? NewButtonType.alpha : NewButtonType.gray}
+                    color={getThemeColor(health.mode)}
+                    title={durationTime()}
+                    height={rpxToPx(84)}
+                    onClick={() => {
+                        setShowDurationPicker(true)
+                    }}
+                />
+                <View style={{ width: rpxToPx(40) }} />
             </View>
             {
-                showDurationPicker && <NewDurationPicker value={minutes} color={getThemeColor(health.mode)} onChange={(v) => {
-                    setMinutes(v)
-                }} />
+                showDurationPicker && <NewDurationPicker
+                    value={minutes}
+                    color={getThemeColor(health.mode)}
+                    onChange={(v) => {
+                        setMinutes(v)
+                    }} />
             }
 
             <View className='picker_time_card_footer'>
                 <IconTarget width={rpxToPx(24)} color='#5C7099' />
-                <Text style={{ color: '#5C7099', marginLeft: rpxToPx(12), fontSize: rpxToPx(26) }}>Scheduled for xxx today</Text>
+                <Text style={{ color: '#5C7099', marginLeft: rpxToPx(12), fontSize: rpxToPx(26) }}>Expect to finish at {endTime()}</Text>
 
             </View>
         </View>
     }
+    /*
+    type={expandIndex == index ? NewButtonType.alpha : NewButtonType.gray}
+                    color={iFast ? MainColorType.fast : MainColorType.sleep}
+    */
     return <NewModal
         title='开始时间'
         dismiss={props.dismiss}
         confirm={() => {
             props.onChange({
-                time:time,
-                duration:minutes
+                time: time,
+                duration: minutes
             })
         }}
         themeColor={getThemeColor(health.mode)}>
@@ -71,11 +120,24 @@ export default function PostMomentTime(props: {
             <View className='picker_time_card'>
                 <View className='picker_time_card_header'>
                     <View style={{ flex: 1 }} />
-                    <View className='time_btn'>Yesterday</View>
+                    <NewButton
+                        type={NewButtonType.gray}
+                        title={isYesterday ? 'Yesterday' : 'Today'}
+                        height={rpxToPx(84)}
+                        onClick={() => {
+                            setIsYesterday(!isYesterday)
+                        }}
+                    />
                     <View style={{ width: rpxToPx(12) }} />
-                    <View className='time_btn' onClick={() => {
-                        setShowDurationPicker(false)
-                    }}>{time}</View>
+                    <NewButton
+                        type={!showDurationPicker ? NewButtonType.alpha : NewButtonType.gray}
+                        color={getThemeColor(health.mode)}
+                        title={time}
+                        height={rpxToPx(84)}
+                        onClick={() => {
+                            setShowDurationPicker(false)
+                        }}
+                    />
                     <View style={{ flex: 1 }} />
                     {
                         !showDurationPicker && <View className='border_footer_line' />

+ 6 - 10
src/_health/pages/add_moment.scss

@@ -1,16 +1,14 @@
 
 
 .textarea{
-    height: 400px;
+    height: 225px;
+    font-size: 50px;
+    margin-top: 16px;
 }
 
 .save{
-    background-color: #FF751A;
-    color:#fff;
-    width: 360px;
-    left: 195px;
-    height: 96px;
-    border-radius: 28px;
+    display: flex;
+    width: 750px;
     align-items: center;
     justify-content: center;
     display: flex;
@@ -22,7 +20,6 @@
     display: flex;
     flex-direction: column;
     background-color: #fff;
-    padding: 40px;
 }
 
 .cover{
@@ -41,10 +38,9 @@
 }
 
 .addmoment_header{
-    height: 128px;
+    height: 90px;
     display: flex;
     flex-direction: row;
-    border-bottom: solid 1px #B2B2B299;
     background-color: #fff;
     align-items: center;
 }

+ 86 - 58
src/_health/pages/add_moment.tsx

@@ -20,6 +20,8 @@ import NewModal from "../base/new_modal";
 import PostMomentTime from "../components/post_moment_time";
 import AddLabel from "../components/add_label";
 import showAlert from "@/components/basic/Alert";
+import NewButton, { NewButtonType } from "../base/new_button";
+import { rpxToPx } from "@/utils/tools";
 
 
 let useRoute;
@@ -70,9 +72,9 @@ export default function AddMoment() {
 
     useEffect(() => {
         global.set_time = new Date().getTime()
-        
-        
-        getLabelsEvent({ window: health.mode,use:is_temp?'ONE_RECORD':'' }).then(res => {
+
+
+        getLabelsEvent({ window: health.mode, use: is_temp ? 'ONE_RECORD' : '' }).then(res => {
             setLabels((res as any).labels)
             if (is_temp && title == '') {
                 setShowTitlePicker(true)
@@ -127,8 +129,8 @@ export default function AddMoment() {
             return
         }
         var date = new Date(timestamp)
-        var hour = parseInt(time.split(':')[0]+'')
-        var minute = parseInt(time.split(':')[1]+'')
+        var hour = parseInt(time.split(':')[0] + '')
+        var minute = parseInt(time.split(':')[1] + '')
         date.setHours(hour)
         date.setMinutes(minute)
 
@@ -150,21 +152,21 @@ export default function AddMoment() {
                 source: 'album'
             }]
         }
-        if (event_id) {
+        if (event_id && event_id != 'undefined') {
             params.event_id = event_id
         }
 
-        if (is_temp){
-            params.event = health.mode == 'EAT'?'EAT_CUSTOM':'ACTIVE_CUSTOM'
+        if (is_temp) {
+            params.event = health.mode == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM'
         }
         // if (moment.target && moment.target.duration) {
         //     params.duration = durationT//moment.target.duration
         // }
 
-        if (durationT){
-            params.duration = durationT*60*1000
+        if (durationT) {
+            params.duration = durationT * 60 * 1000
         }
-        
+
 
         params.extra = {
             set_time: global.set_time ? global.set_time : new Date().getTime(),
@@ -174,7 +176,7 @@ export default function AddMoment() {
             if (process.env.TARO_ENV == 'weapp') {
                 // Taro.navigateBack();
                 Taro.redirectTo({
-                    url:'/_health/pages/post_result?data=' + JSON.stringify(res)
+                    url: '/_health/pages/post_result?data=' + JSON.stringify(res)
                 })
             }
 
@@ -312,45 +314,71 @@ export default function AddMoment() {
             </View>
         } */}
 
-        <View className="addmoment_header">
-            <Text onClick={() => {
-                setShowTimePicker(true)
-            }} style={{ marginLeft: 20, color: '#5C7099' }}>{time}</Text>
-            <Text
-                onClick={() => {
-                    setShowTitlePicker(true)
-                }}
-                style={{ marginLeft: 20, color: '#5C7099' }}>{title}</Text>
-        </View>
+        <View style={{
+            display: 'flex',
+            backgroundColor: '#fff',
+            padding: rpxToPx(40),
+            flexDirection: 'column',
+            height: rpxToPx(550),
+            width: rpxToPx(750),
+            boxSizing: 'border-box'
 
-        <View className="form">
-            <View>
-                {
-                    (health.mode == 'FAST' || health.mode == 'SLEEP') &&
-                    <Input className="input_title" placeholder="标题文字" onInput={(e: any) => {
-                        setTitle(e.target.value)
+        }}>
+            <View className="addmoment_header">
+                <Text onClick={() => {
+                    setShowTimePicker(true)
+                }} style={{ marginRight: 20, color: '#5C7099' }}>{time}</Text>
+                <Text
+                    onClick={() => {
+                        setShowTitlePicker(true)
+                    }}
+                    style={{ marginRight: 20, color: '#5C7099' }}>{title}</Text>
+            </View>
+
+            <View className="form">
+                <View>
+                    {
+                        (health.mode == 'FAST' || health.mode == 'SLEEP') &&
+                        <Input className="input_title" placeholder="标题文字" onInput={(e: any) => {
+                            setTitle(e.target.value)
+                        }} />
+                    }
+                    <Textarea placeholder="简单描述(选填)" className="textarea"
+                    placeholder-style="color:#B2B2B2"
+                    onInput={e => {
+                        setDesc(e.detail.value)
                     }} />
+                </View>
+                {
+                    imgUrl.length > 0 ? <Image src={imgUrl} mode="aspectFill" className="cover" onClick={addImage} /> :
+                        <View className="cover" onClick={addImage}>
+                            <Image src={require('@assets/images/add3.png')} style={{ width: 24, height: 24 }} />
+                        </View>
                 }
-                <Textarea placeholder="简单描述(选填)" className="textarea" onInput={e => {
-                    setDesc(e.detail.value)
-                }} />
+
             </View>
-            {
-                imgUrl.length > 0 ? <Image src={imgUrl} mode="aspectFill" className="cover" onClick={addImage} /> :
-                    <View className="cover" onClick={addImage}>
-                        <Image src={require('@assets/images/add3.png')} style={{ width: 24, height: 24 }} />
-                    </View>
-            }
+        </View>
+
 
+        <View className="save">
+            <NewButton
+                type={NewButtonType.fill}
+                color={getThemeColor(health.mode)}
+                width={rpxToPx(670)}
+                height={rpxToPx(96)}
+                title="发布"
+                onClick={save}
+            />
         </View>
 
-        <View className="save" style={{ backgroundColor: getThemeColor(health.mode) }} onClick={save}>Save</View>
+
+        {/* <View className="save" style={{ backgroundColor: getThemeColor(health.mode) }} onClick={save}>Save</View> */}
         {
             showPicker && timeContent()
         }
         {
             showTimePicker && <PostMomentTime time={time} onChange={(e) => {
-                const {duration,time} = e;
+                const { duration, time } = e;
                 setTime(time)
                 setDurationT(duration)
                 setShowTimePicker(false)
@@ -364,25 +392,25 @@ export default function AddMoment() {
                 dismiss={() => {
                 }}
                 confirm={() => { }}>
-                <AddLabel labels={labels} 
-                defaultValue={title}
-                justLabel={true}
-                confirm={e=>{
-                    setTitle(e)
-                    if (e.length==0){
-                        showAlert({
-                            title:'提示',
-                            content:'请输入标题',
-                            showCancel:false
-                        })
-                        return
-                    }
-                    setShowTitlePicker(false)
-                }}
-                disMiss={() => {
-                    debugger
-                    // setShowTitlePicker(false)
-                }} />
+                <AddLabel labels={labels}
+                    defaultValue={title}
+                    justLabel={true}
+                    confirm={e => {
+                        setTitle(e)
+                        if (e.length == 0) {
+                            showAlert({
+                                title: '提示',
+                                content: '请输入标题',
+                                showCancel: false
+                            })
+                            return
+                        }
+                        setShowTitlePicker(false)
+                    }}
+                    disMiss={() => {
+                        debugger
+                        // setShowTitlePicker(false)
+                    }} />
             </Modal>
         }
 

+ 16 - 6
src/_health/pages/log_time.tsx

@@ -37,6 +37,7 @@ export default function LogTime() {
     else {
         router = useRouter()
     }
+    const enterTime = new Date().getTime()
 
     const isSingle = router.params.single == '1'
     const isFast = router.params.window == 'FAST'
@@ -324,12 +325,21 @@ export default function LogTime() {
             check_items: list,
             op_page: isFastWithSleep ? 'FAST_WITH_SLEEP' : null
         }).then(res => {
-            global.refreshWindow()
-            if (global.refreshFastSleep)
-                global.refreshFastSleep()
-            Taro.redirectTo({
-                url: './post_result?data='+JSON.stringify(res)
-            })
+            if ((res as any).result){
+                global.refreshWindow()
+                if (global.refreshFastSleep)
+                    global.refreshFastSleep()
+                Taro.redirectTo({
+                    url: './post_result?data=' + JSON.stringify(res)
+                })
+            }
+            else {
+                showAlert({
+                    title:'error',
+                    content:(res as any).error_messages[0]
+                })
+            }
+            
             // Taro.navigateBack({
             //     delta: 1
             // })

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

@@ -176,7 +176,8 @@ export default function Move() {
                 //     title: '上报成功',
                 //     icon: 'none'
                 // })
-                console.log(res)
+                // console.log(res)
+                // console.log('move result')
                 jumpPage('./post_result?data='+JSON.stringify((res as any).post_result))
                 getMovesCurrent()
                 getMovesHistory()

+ 64 - 35
src/_health/pages/post_result.tsx

@@ -4,7 +4,7 @@ import './post_result.scss'
 import { getThemeColor } from "@/features/health/hooks/health_hooks";
 import { rpxToPx } from "@/utils/tools";
 import NewButton, { NewButtonType } from "../base/new_button";
-import { IconCheck, IconNotificationOff } from "@/components/basic/Icons";
+import { IconCheck, IconNotification, IconNotificationOff } from "@/components/basic/Icons";
 import { MainColorType } from "@/context/themes/color";
 import { useState } from "react";
 import dayjs from "dayjs";
@@ -12,6 +12,7 @@ import { useDispatch } from "react-redux";
 import { setMode } from "@/store/health";
 import NewModal from "../base/new_modal";
 import Card from "../components/card";
+import { updateReminder } from "@/services/health";
 
 let useRoute;
 let useNavigation;
@@ -39,28 +40,32 @@ export default function PostResult() {
     console.log(JSON.parse(router.params.data))
 
     function getMainColor() {
+        if (data.scenario == 'MOVE' && data.extra.move_status == 'SEDENTARY') {
+            return MainColorType.g02
+        }
         return getThemeColor(data.window)
     }
 
     function nextTitle() {
-        const today = dayjs();
-
-        var timestamp = data.next.timestamp
-        const dt = dayjs(timestamp);
-        const yesterday = today.subtract(1, 'day');
-        const tomorrow = today.subtract(-1, 'day');
-        var date = ''
-        var time = dt.format('HH:mm')
-        if (dt.isSame(today, 'day')) {
-            date = '今天';
-        } else if (dt.isSame(yesterday, 'day')) {
-            date = '昨天';
-        } else if (dt.isSame(tomorrow, 'day')) {
-            date = '明天';
-        } else {
-            date = dt.format('MM-DD');
-        }
-        return date + ' ' + time + ' ' + data.next.title
+        return data.next.content
+        // const today = dayjs();
+
+        // var timestamp = data.next.timestamp
+        // const dt = dayjs(timestamp);
+        // const yesterday = today.subtract(1, 'day');
+        // const tomorrow = today.subtract(-1, 'day');
+        // var date = ''
+        // var time = dt.format('HH:mm')
+        // if (dt.isSame(today, 'day')) {
+        //     date = '今天';
+        // } else if (dt.isSame(yesterday, 'day')) {
+        //     date = '昨天';
+        // } else if (dt.isSame(tomorrow, 'day')) {
+        //     date = '明天';
+        // } else {
+        //     date = dt.format('MM-DD');
+        // }
+        // return date + ' ' + time + ' ' + data.next.title
     }
 
     function showSwitchBtn() {
@@ -68,6 +73,14 @@ export default function PostResult() {
         return data.schedule_completed
     }
 
+    function changeReminder(e){
+        updateReminder({reminder:e.detail.value},data.next.schedule_id).then((res)=>{
+            var detail = JSON.parse(JSON.stringify(data))
+            detail.next.reminder = e.detail.value
+            setData(detail)
+        })
+    }
+
     function swithBtnText() {
         switch (data.window) {
             case 'FAST':
@@ -101,7 +114,7 @@ export default function PostResult() {
     }
 
     function headerIcon() {
-        if (data.images) {
+        if (data.images && data.images.length > 0) {
             return <View className="result_icon_bg">
                 <Image className="result_icon_bg" mode="aspectFill" src={data.images[0]} />
                 <View className="result_icon_small" style={{ backgroundColor: getMainColor() }}>
@@ -111,20 +124,32 @@ export default function PostResult() {
         }
 
         if (data.scenario == 'MOVE') {
-            return <Image className="result_icon_bg" mode="aspectFill" src={require('@assets/_health/sit.png')} />
+            return <Image className="result_icon_bg" mode="aspectFill" src={data.extra.move_status == 'ACTIVE' ? require('@assets/_health/walk2.png') : require('@assets/_health/sit.png')} />
         }
         return <View className="result_icon_bg" style={{ backgroundColor: getMainColor() }}>
             <IconCheck color="#fff" width={rpxToPx(40)} height={rpxToPx(40)} />
         </View>
     }
 
+    function headerDesc() {
+        if (data.scenario == 'MOVE') {
+            if (data.extra.move_status == 'SEDENTARY') {
+                return 'Sedentary Hour'
+            }
+            else {
+                return 'Active Hour'
+            }
+        }
+        return data.description
+    }
+
     return <View className="post_result_container">
         {
             headerIcon()
         }
 
         <View className="h50 bold" style={{ color: getMainColor(), marginTop: rpxToPx(30) }}>{data.title}</View>
-        <View className="h30" style={{ marginTop: rpxToPx(12) }}>{data.description}</View>
+        <View className="h30" style={{ marginTop: rpxToPx(12) }}>{headerDesc()}</View>
         {
             data.next && <View className="result_next">
                 <View className="result_top_line" />
@@ -136,7 +161,11 @@ export default function PostResult() {
                             setShowSetting(true)
                         }}
                     >
-                        <IconNotificationOff color={MainColorType.link} width={rpxToPx(26)} />
+                        {
+                            data.next.reminder ? <IconNotification color={MainColorType.link} width={rpxToPx(26)} /> :
+                                <IconNotificationOff color={MainColorType.link} width={rpxToPx(26)} />
+                        }
+
                     </NewButton>
                 </View>
             </View>
@@ -167,21 +196,21 @@ export default function PostResult() {
         </View>
         {
             showSetting && <NewModal
-                themeColor={getMainColor()}
+                themeColor={getThemeColor(data.window)}
                 title='开启提醒'
-                dismiss={()=>setShowSetting(false)}
-                confirm={()=>setShowSetting(false)}
+                dismiss={() => setShowSetting(false)}
+                confirm={() => setShowSetting(false)}
             >
-                <View style={{marginBottom:rpxToPx(72)}}>
-                <Card>
-                    <View className="setting_item">
-                        <View style={{flex:1}}>
-                            <View className="h24" style={{color:MainColorType.g01}}>{dayjs(data.next.timestamp).format('HH:mm')}</View>
-                            <View className="h34">{data.next.title}</View>
+                <View style={{ marginBottom: rpxToPx(72) }}>
+                    <Card>
+                        <View className="setting_item">
+                            <View style={{ flex: 1 }}>
+                                <View className="h24" style={{ color: MainColorType.g01 }}>{data.next.time}</View>
+                                <View className="h34">{data.next.title}</View>
+                            </View>
+                            <Switch color={getThemeColor(data.window)} checked={data.next.reminder} onChange={changeReminder}/>
                         </View>
-                        <Switch color={getMainColor()}/>
-                    </View>
-                </Card>
+                    </Card>
                 </View>
             </NewModal>
         }

+ 5 - 0
src/app.scss

@@ -490,4 +490,9 @@ page {
 
 .bold {
     font-weight: bold;
+}
+
+.main_column_space{
+    flex-shrink: 0;
+    height: 36px;
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 1
src/components/basic/Icons.tsx


+ 13 - 18
src/features/health/History.scss

@@ -2,14 +2,10 @@
     display: flex;
     flex-direction: row;
     width: 750px;
-    padding-top: 28px;
-    padding-left: 40px;
-    padding-right: 40px;
+    padding: 40px;
     box-sizing: border-box;
-    padding-bottom: 40px;
     position: relative;
     background-color: #fff;
-
 }
 
 .history_ring {
@@ -23,9 +19,9 @@
 }
 
 .history_date {
-    margin-right: 40px;
-    width: 50px;
-    height: 60px;
+    margin-right: 24px;
+    width: 74px;
+    height: 68px;
     align-items: center;
     justify-content: center;
     display: flex;
@@ -37,6 +33,7 @@
 .history_content {
     display: flex;
     flex-direction: column;
+    flex-shrink: 0;
 }
 
 .history_item_duration {
@@ -47,13 +44,15 @@
 
 .history_item_title {
     font-size: 32px;
-    line-height: 44px;
+    line-height: 48px;
     color: #5C7099;
+    vertical-align: top;
+    vertical-align: text-top;
 }
 
 .history_item_desc {
     font-size: 32px;
-    line-height: 44px;
+    line-height: 48px;
     color: #000;
 }
 
@@ -71,6 +70,8 @@
     display: flex;
     flex-direction: row;
     flex-wrap: wrap;
+    margin-bottom: 20px;
+    flex-shrink: 0;
 }
 
 .media_item {
@@ -92,12 +93,6 @@
     align-items: center;
 }
 
-.recent_text{
-    font-weight: bold;
-    color: #000;
-    font-size: 26px;
-}
-
 .history_duration_bg{
     display: flex;
     flex-direction: row;
@@ -118,8 +113,8 @@
     background-color: #B2B2B21A;
     height: 68px;
     border-radius: 34px;
-    padding-left: 44px;
-    padding-right:30px;
+    padding-left: 48px;
+    padding-right:24px;
     display: flex;
     align-items: center;
     flex-direction: row;

+ 39 - 27
src/features/health/HistoryItem.tsx

@@ -12,6 +12,8 @@ import { IconMore } from "@/components/basic/Icons";
 import showActionSheet from "@/components/basic/ActionSheet";
 import { delRecord, makeDone } from "@/services/health";
 import showAlert from "@/components/basic/Alert";
+import { rpxToPx } from "@/utils/tools";
+import NewButton, { NewButtonType } from "@/_health/base/new_button";
 
 export default function HistoryItem(props: {
     data: any,
@@ -70,11 +72,11 @@ export default function HistoryItem(props: {
 
         const realRing = {
             hideBg: true,
-            color: props.mode == 'FAST,SLEEP'?getThemeColor('FAST'):getThemeColor(health.mode),
+            color: props.mode == 'FAST,SLEEP' ? getThemeColor('FAST') : getThemeColor(health.mode),
             startArc: startArc(props.data.window_range.start_timestamp),
             durationArc: durationArc(props.data.window_range.start_timestamp, props.data.window_range.end_timestamp)
         }
-        const canvasId = props.mode == 'FAST,SLEEP'?'history_fast_sleep' + props.index:'history_' + props.index
+        const canvasId = props.mode == 'FAST,SLEEP' ? 'history_fast_sleep' + props.index : 'history_' + props.index
         return <Rings common={common} bgRing={bgRing} realRing={realRing} canvasId={canvasId} />
     }
 
@@ -98,7 +100,7 @@ export default function HistoryItem(props: {
             durationArc: durationArc(props.data.events[1].time.timestamp, props.data.events[2].time.timestamp)
         }
 
-        
+
         const canvasId = 'history2_props_mode' + props.index
         return <Rings common={common} bgRing={bgRing} realRing={realRing} canvasId={canvasId} />
     }
@@ -106,9 +108,11 @@ export default function HistoryItem(props: {
     function mediaCount() {
         let count = 0;
         props.data.events.map((item) => {
-            if (item.moment) {
-                item.moment.media.map((obj, j) => {
-                    count++;
+            if (item.moments) {
+                item.moments.map(moment => {
+                    moment.media.map((obj) => {
+                        count++
+                    })
                 })
             }
 
@@ -127,7 +131,7 @@ export default function HistoryItem(props: {
         return dayjs(props.data.window_range.start_timestamp).format('D')
     }
 
-    function tapDel(){
+    function tapDel() {
         showAlert({
             title: '确定要放弃本次断食吗?',
             content: '放弃后断食不会本记录',
@@ -138,11 +142,11 @@ export default function HistoryItem(props: {
                 del()
             }
         })
-        
+
     }
 
-    function del(){
-        const {window_id} = props.data
+    function del() {
+        const { window_id } = props.data
         delRecord(window_id).then(res => {
             global.refreshWindow()
             global.refreshHistory()
@@ -153,11 +157,11 @@ export default function HistoryItem(props: {
         <View className="history_date">{historyDate()}</View>
         <View className="history_content">
 
-            <View style={{ display: 'flex', flexDirection: 'column' }}>
+            <View style={{ display: 'flex', flexDirection: 'column', marginBottom: rpxToPx(12) }}>
                 {
                     props.data.events.map((item, index) => {
                         return <Text key={index}>
-                            <Text className="history_item_title">{item.time && dayjs(item.time.timestamp).format('HH:mm')} {getTitle(item)} </Text>
+                            <Text className="history_item_title">{item.time && dayjs(item.time.timestamp).format('HH:mm')}<Text style={{ fontSize: 9, lineHeight: '20px', fontWeight: 'bold', verticalAlign: 'text-top' }}></Text> {getTitle(item)} </Text>
                             {
                                 item.moments && item.moments.map((moment, i) => {
                                     return <Text className="history_item_desc" key={i * 1000}>{moment.description}</Text>
@@ -167,20 +171,23 @@ export default function HistoryItem(props: {
                     })
                 }
             </View>
-            <View className="media" style={{ marginTop: mediaCount() > 0 ? 9 : -10, marginRight: mediaCount() == 4 ? 80 : 0 }}>
-                {
-                    props.data.events.map((item) => {
-                        if (item.moments) {
-                            return item.moments.map(moment => {
-                                return moment.media.map((obj, j) => {
-                                    return <Image className="media_item" mode="aspectFill" onClick={() => preview(obj)} src={obj.url} key={j * 10} />
+            {
+                mediaCount() > 0 && <View className="media" style={{ marginRight: mediaCount() == 4 ? 80 : 0 }}>
+                    {
+                        props.data.events.map((item) => {
+                            if (item.moments) {
+                                return item.moments.map(moment => {
+                                    return moment.media.map((obj, j) => {
+                                        return <Image className="media_item" mode="aspectFill" onClick={() => preview(obj)} src={obj.url} key={j * 10} />
+                                    })
                                 })
-                            })
-                        }
+                            }
+
+                        })
+                    }
+                </View>
+            }
 
-                    })
-                }
-            </View>
             <View className="history_duration_bg">
                 {
                     props.fast_type != 'LF' && ring()
@@ -190,7 +197,7 @@ export default function HistoryItem(props: {
                 }
             </View>
             {
-                props.mode == 'FAST,SLEEP' && props.data.events.length>2 && <View className="history_duration_bg" style={{marginTop:0}}>
+                props.mode == 'FAST,SLEEP' && props.data.events.length > 2 && <View className="history_duration_bg" style={{ marginTop: 0 }}>
                     {
                         props.fast_type != 'LF' && ring2()
                     }
@@ -230,9 +237,14 @@ export default function HistoryItem(props: {
                     </View>
                 </View>
             }
-            <Text onClick={tapDel}>删除</Text>
+            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center',height:rpxToPx(60) }}>
+                <View style={{ flex: 1 }} />
+                <NewButton type={NewButtonType.more}
+                    onClick={tapDel}
+                />
+            </View>
         </View>
-        
+
         <View className="seperate_light_line" />
     </View>
 }

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

@@ -154,7 +154,7 @@
 }
 
 .main_footer {
-    height: 108px;
+    height: 128px;
     width: 750px;
     background-color: #fff;
     align-items: center;
@@ -192,12 +192,6 @@
     flex-shrink: 0;
 }
 
-.console_active_bg {
-    background-color: #f5f5f5;
-    padding-top: 36px;
-
-}
-
 .console_active {
     background-color: #fff;
     display: flex;
@@ -205,9 +199,10 @@
     align-items: center;
     height: 128px;
     width: 750px;
-    padding-left: 52px;
-    padding-right: 42px;
+    padding-left: 40px;
+    padding-right: 40px;
     box-sizing: border-box;
+    position: relative;
 }
 
 .active_icon {

+ 130 - 61
src/features/health/MainConsole.tsx

@@ -14,7 +14,7 @@ import showActionSheet from "@/components/basic/ActionSheet";
 import { rpxToPx } from "@/utils/tools";
 import { setMode, setShowActionTip } from "@/store/health";
 import { getCountownTime, getDuration, getScenario, getThemeColor, getWindowStatus } from "./hooks/health_hooks";
-import { IconCellArrow, IconMore } from "@/components/basic/Icons";
+import { IconCellArrow, IconMore, IconNotification, IconNotificationOff, IconSwitch } from "@/components/basic/Icons";
 import DurationPicker from "@/_health/components/duration_picker";
 import Taro from "@tarojs/taro";
 import { systemLocation } from "@/services/common";
@@ -107,7 +107,7 @@ export default function MainConsole(props: { type: WindowType }) {
                     // setOperateType('startFast')
                     // setShowTimePicker(true)
 
-                    jumpPage(`/_health/pages/log_time?index=${health.mode=='FAST'?0:1}&single=1&is_start=1&window=${health.mode}`)
+                    jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}`)
                 }
                 return;
             case 'END':
@@ -120,9 +120,9 @@ export default function MainConsole(props: { type: WindowType }) {
                     // setShowTimePicker(true)
                     console.log(item)
 
-                    var sceniaro = getScenario(health.windows,health.mode)
+                    var sceniaro = getScenario(health.windows, health.mode)
 
-                    jumpPage(`/_health/pages/log_time?type=home&index=${health.mode=='FAST'?3:2}&single=${sceniaro.status == 'OG'?1:0}&is_start=0&window=${health.mode}`)
+                    jumpPage(`/_health/pages/log_time?type=home&index=${health.mode == 'FAST' ? 3 : 2}&single=${sceniaro.status == 'OG' ? 1 : 0}&is_start=0&window=${health.mode}`)
                 }
                 return;
             case 'MARK_DONE':
@@ -141,6 +141,10 @@ export default function MainConsole(props: { type: WindowType }) {
                         // }))
                         // setBtnDisable(false)
                         // setShowTimePicker(false)
+                        Taro.showToast({
+                            title: '操作成功',
+                            icon: 'success'
+                        })
                         global.refreshWindow()
                         global.refreshHistory()
                     }).catch(e => {
@@ -231,6 +235,37 @@ 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
+        }
+        return color
+    }
+
+    function processIcon(index) {
+        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 <Image style={{ width: rpxToPx(20), height: rpxToPx(20) }} src={require('@assets/_health/checked.png')} />
+            }
+        }
+        if (timeline.real) {
+            return <Image style={{ width: rpxToPx(20), height: rpxToPx(20) }} src={require('@assets/_health/checked.png')} />
+        }
+        return timeline.reminder?<IconNotification color="#fff" width={rpxToPx(20)}/>:<IconNotificationOff color="#fff" width={rpxToPx(20)}/>
+    }
+
     function timelineItem(item: any, index: number, count: number) {
         var hasDescription = item.moment && item.moment.description
         return <View key={index}
@@ -244,17 +279,22 @@ export default function MainConsole(props: { type: WindowType }) {
                     height: hasDescription ? rpxToPx(28) : rpxToPx(36), flexShrink: 0
                 }} />
                 <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                    {/* {
-                        !item.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
-                    } */}
                     <View style={{
                         flexShrink: 0,
-                        width: rpxToPx(28),
-                        height: rpxToPx(28),
-                        borderRadius: rpxToPx(14),
+                        width: rpxToPx(26),
+                        height: rpxToPx(26),
+                        borderRadius: rpxToPx(13),
                         marginRight: rpxToPx(8),
-                        backgroundColor: 'gray'
-                    }} />
+                        display: 'flex',
+                        alignItems: 'center',
+                        justifyContent: 'center',
+                        backgroundColor: getIconColor(index)
+                    }}>
+                        {
+                            processIcon(index)
+                        }
+                        {/* <Image style={{ width: rpxToPx(20), height: rpxToPx(20) }} src={finish ? require('@assets/_health/checked.png') : require('@assets/_health/ring.png')} /> */}
+                    </View>
                     <Text className="timeline_time">{itemTitle(item)}</Text>
                 </View>
 
@@ -512,7 +552,7 @@ export default function MainConsole(props: { type: WindowType }) {
             setShowTimePicker(false)
             global.refreshWindow()
             global.refreshHistory()
-            jumpPage('/_health/pages/post_result?data='+JSON.stringify(res))
+            jumpPage('/_health/pages/post_result?data=' + JSON.stringify(res))
         }).catch(e => {
             setBtnDisable(false)
         })
@@ -890,7 +930,12 @@ export default function MainConsole(props: { type: WindowType }) {
                 str = 'Fast after Wake Up'
                 break
         }
-        return <View className="h28" style={{ color: MainColorType.g01 }}>{str}</View>
+        return <View className="h26" style={{ color: MainColorType.g01 }}>{str}</View>
+    }
+
+    function longFastStatus() {
+        const { status } = health.long_fast
+        return <View className="h26" style={{ color: MainColorType.g01 }}>{status == 'OG' ? 'In progress' : ''}</View>
     }
 
     return <View className="main-console-bg">
@@ -901,7 +946,7 @@ export default function MainConsole(props: { type: WindowType }) {
                 <View className={timePointClass()}
                     style={{ backgroundColor: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : getThemeColor(health.mode) }} />
             </View>
-            <Text className="main_summary_duration">Total {getDuration(health.windows, health.mode)}</Text>
+            <Text className="main_summary_duration" style={{ color: MainColorType.g01 }}>{getDuration(health.windows, health.mode)}</Text>
             <View className="border_footer_line" />
         </View>
         <View style={{ backgroundColor: '#fff', width: rpxToPx(750) }}>
@@ -916,7 +961,17 @@ export default function MainConsole(props: { type: WindowType }) {
             }
         </View>
         <View className="main_footer">
-            <Text className="main_footer_text" onClick={tapSwitchBtn}>{switchText()}</Text>
+            <View style={{ width: rpxToPx(316), height: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+                <NewButton
+                    type={NewButtonType.link}
+                    title={switchText()}
+                    onClick={tapSwitchBtn}
+                >
+                    <View style={{ marginRight: rpxToPx(8) }}>
+                        <IconSwitch color={MainColorType.link} width={rpxToPx(26)} />
+                    </View>
+                </NewButton>
+            </View>
             {/* {
                 (health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={more}>更多</Text>
             } */}
@@ -926,20 +981,27 @@ export default function MainConsole(props: { type: WindowType }) {
             {
                 (health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={tapClearLocation}>清除位置</Text>
             }
-            <View className="main_footer_more" onClick={more}>
-                <IconMore color="#b2b2b2" width={17} />
-            </View>
+            <NewButton
+                btnStyle={{
+                    position: 'absolute',
+                    top: rpxToPx(42),
+                    right: rpxToPx(40)
+                }}
+                type={NewButtonType.more}
+                onClick={more}
+            />
 
         </View>
         {
-            health.mode == 'ACTIVE' && <View className="console_active_bg" onClick={() => {
-                if (!user.isLogin) {
-                    jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-                    return
-                }
-                jumpPage('/_health/pages/move')
-            }}>
-                <View className="console_active">
+            health.mode == 'ACTIVE' && <View>
+                <View className="main_column_space" />
+                <View className="console_active" onClick={() => {
+                    if (!user.isLogin) {
+                        jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+                        return
+                    }
+                    jumpPage('/_health/pages/move')
+                }}>
                     <Image className="active_icon" src={require('@assets/_health/walk.png')} />
                     <Text className="active_text">Move More</Text>
                     <Image className="cell_arrow" src={require('@assets/_health/cell_arrow.png')} />
@@ -948,54 +1010,61 @@ export default function MainConsole(props: { type: WindowType }) {
             </View>
         }
         {
-            (health.mode == 'FAST' || health.mode == 'SLEEP') && <View className="console_active_bg" onClick={() => {
-                if (!user.isLogin) {
-                    jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-                    return
-                }
-                if (health.long_fast.status == 'OG') {
-                    showAlert({
-                        title: '长断食进行中',
-                        content: '当前有一个正在进行的长断食记录,要转换为间歇性断食吗?',
-                        showCancel: true,
-                        cancelText: '取消',
-                        confirmText: '确定',
-                        confirm: () => {
-                            updateFast({ fast_type: 'IF' }).then(res => {
-                                global.refreshWindow()
-                                jumpPage('/_health/pages/fast_sleep')
-                            })
-                        }
-                    })
-                    return
-                }
-                jumpPage('/_health/pages/fast_sleep')
-            }}>
-                <View className="console_active">
+            (health.mode == 'FAST' || health.mode == 'SLEEP') && <View >
+                <View className="main_column_space" />
+                <View className="console_active" onClick={() => {
+                    if (!user.isLogin) {
+                        jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+                        return
+                    }
+                    if (health.long_fast.status == 'OG') {
+                        showAlert({
+                            title: '长断食进行中',
+                            content: '当前有一个正在进行的长断食记录,要转换为间歇性断食吗?',
+                            showCancel: true,
+                            cancelText: '取消',
+                            confirmText: '确定',
+                            confirm: () => {
+                                updateFast({ fast_type: 'IF' }).then(res => {
+                                    global.refreshWindow()
+                                    jumpPage('/_health/pages/fast_sleep')
+                                })
+                            }
+                        })
+                        return
+                    }
+                    jumpPage('/_health/pages/fast_sleep')
+                }}>
                     <Image className="active_icon" src={require('@assets/_health/fast.png')} />
                     <Text className="h34">Fast with sleep</Text>
                     <View style={{ flex: 1 }} />
                     {
                         fastWithSleepStatus()
                     }
-                    <Image className="cell_arrow" src={require('@assets/_health/cell_arrow.png')} />
+                    <IconCellArrow color='#B2B2B2' width={rpxToPx(34)} />
+                    {
+                        health.mode == 'FAST' && <View className="border_footer_line" style={{ left: rpxToPx(100) }} />
+                    }
                 </View>
 
             </View>
         }
         {
-            health.mode == 'FAST' && <View className="console_active_bg" onClick={() => {
-                if (!user.isLogin) {
-                    jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-                    return
-                }
-                jumpPage('/_health/pages/long_fast')
-            }}>
-                <View className="console_active">
+            health.mode == 'FAST' && <View>
+                <View className="console_active" onClick={() => {
+                    if (!user.isLogin) {
+                        jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+                        return
+                    }
+                    jumpPage('/_health/pages/long_fast')
+                }}>
                     <Image className="active_icon" src={require('@assets/_health/fast.png')} />
                     <Text className="h34">Long fast</Text>
                     <View style={{ flex: 1 }} />
-                    <Image className="cell_arrow" src={require('@assets/_health/cell_arrow.png')} />
+                    {
+                        longFastStatus()
+                    }
+                    <IconCellArrow color='#B2B2B2' width={rpxToPx(34)} />
                 </View>
 
             </View>

+ 7 - 2
src/features/health/MainHistory.tsx

@@ -105,7 +105,7 @@ export default function MainHistory(props: { type?: string, fast_type?: string }
         }} /> */}
         {
             (list.length > 0 || health.mode == 'EAT') && <View className="recent">
-                <Text className="recent_text">Recent</Text>
+                <Text className="h34 bold">Recent</Text>
                 {
                     health.mode == 'EAT' && <View onClick={() => {
                         jumpPage('/_health/pages/archive')
@@ -128,8 +128,13 @@ export default function MainHistory(props: { type?: string, fast_type?: string }
                             return <Image src={item} key={index} className="archived_img" mode="aspectFill" />
                         })
                     }
+                    <Image src={require('@assets/_health/cell_arrow.png')} style={{
+                        width:rpxToPx(24),
+                        height:rpxToPx(24),
+                        marginLeft:rpxToPx(4),
+
+                    }}/>
                 </View>
-                <View className="border_footer_line" />
             </View>
         }
         {

+ 15 - 15
src/features/trackTimeDuration/components/Rings.weapp.tsx

@@ -153,21 +153,21 @@ export default function Rings(props: {
         animationFrameRef.current = requestAnimationFrame(animate2);
     };
 
-    useEffect(() => {
-        // if (props.showCurrentDotAnimation) {
-        //     animate2()
-        // }
-        // else {
-        //     if (animationFrameRef.current) {
-        //         cancelAnimationFrame(animationFrameRef.current as any)
-        //         animationFrameRef.current = null
-        //     }
-        //     dotScale = 1;
-        //     dotAlpha = 1;
-        // }
-    }, [
-        props.showCurrentDotAnimation
-    ])
+    // useEffect(() => {
+    //     // if (props.showCurrentDotAnimation) {
+    //     //     animate2()
+    //     // }
+    //     // else {
+    //     //     if (animationFrameRef.current) {
+    //     //         cancelAnimationFrame(animationFrameRef.current as any)
+    //     //         animationFrameRef.current = null
+    //     //     }
+    //     //     dotScale = 1;
+    //     //     dotAlpha = 1;
+    //     // }
+    // }, [
+    //     props.showCurrentDotAnimation
+    // ])
 
     useReady(() => {
         drawCircle()

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

@@ -180,7 +180,7 @@ export default function ClockNew() {
             </View> */}
 
             <MainHistory />
-            <View style={{ height: 2200 }} />
+            <View style={{ height: 200 }} />
         </ScrollView>
     }
     //https://blog.csdn.net/weixin_43525284/article/details/130182218

+ 13 - 0
src/services/health.tsx

@@ -66,6 +66,19 @@ export const updateSchedule = (params, id) => {
     })
 }
 
+export const updateReminder = (params, id) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: `${API_HEALTH_SCHEDULES}/${id}/reminder`, method: 'PUT', data: { ...params }
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
+    })
+}
+
 export const delSchedule = (code: string) => {
     return new Promise((resolve, reject) => {
         request({

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác