leon 1 سال پیش
والد
کامیت
c4fcdf81db

+ 3 - 2
src/_health/base/new_modal.scss

@@ -142,8 +142,8 @@
 
 
 .modal_title {
-    font-size: 34px;
-    height: 128px;
+    font-size: 30px;
+    height: 108px;
     font-weight: 500;
     width: 750px;
     display: flex;
@@ -153,6 +153,7 @@
 }
 
 .modal_footer {
+    margin-top: 72px;
     padding-bottom: 128px;
     display: flex;
     flex-direction: column;

+ 5 - 4
src/_health/components/fast_sleep_card.tsx

@@ -223,7 +223,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
     }
 
     function circle1() {
-        return <View style={{ display: 'flex', marginTop: rpxToPx(107), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 114, height: 114, position: 'relative' }}> <Rings common={common3}
+        return <View style={{ display: 'flex', marginTop: rpxToPx(100), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 96, height: 96, position: 'relative' }}> <Rings common={common3}
             bgRing={bgRing}
             targetRing={target1BigRing()}
             realRing={real1BigRing()}
@@ -233,7 +233,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
     }
 
     function circle2() {
-        return <View style={{ display: 'flex', marginTop: rpxToPx(107), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 114, height: 114, position: 'relative' }}> <Rings common={common3}
+        return <View style={{ display: 'flex', marginTop: rpxToPx(100), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 96, height: 96, position: 'relative' }}> <Rings common={common3}
             bgRing={bgRing}
             targetRing={target2BigRing()}
             realRing={real2BigRing()}
@@ -244,7 +244,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
     }
 
     function circle3() {
-        return <View style={{ display: 'flex', marginTop: rpxToPx(107), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 114, height: 114, position: 'relative' }}> <Rings common={common3}
+        return <View style={{ display: 'flex', marginTop: rpxToPx(100), marginLeft: rpxToPx(70), alignItems: 'center', justifyContent: 'center', width: 96, height: 96, position: 'relative' }}> <Rings common={common3}
             bgRing={bgRing}
             targetRing={target3BigRing()}
             realRing={real3BigRing()}
@@ -480,7 +480,8 @@ export default function FastSleepCard(props: { step: number, data: any }) {
             circleContent()
         }
         <View style={{
-            marginLeft: rpxToPx(36), height: 114, marginTop: props.step == 0 ? rpxToPx(86) : rpxToPx(107),
+            marginLeft: rpxToPx(36), height: props.step == 0 ?114:96, 
+            marginTop: props.step == 0 ? rpxToPx(86) : rpxToPx(100),
             display: 'flex',
             flexDirection: 'row',
             alignItems: 'center'

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

@@ -101,7 +101,7 @@ export default function FastSleepConsole(props: { step: number, data: any, del:
             content: '确认删除此记录?',
             showCancel: true,
             confirm: () => {
-                delRecord(array[0], { ids: array.join(',') }).then(res => {
+                delRecord(array[0], { ids: array }).then(res => {
                     global.refreshWindow()
                     props.del()
                 })

+ 98 - 93
src/_health/components/post_moment_time.tsx

@@ -10,6 +10,7 @@ import { IconCalendar, IconTarget } from '@/components/basic/Icons';
 import NewDurationPicker from '../base/new_durationpicker';
 import NewButton, { NewButtonType } from '../base/new_button';
 import dayjs from 'dayjs';
+import Card from './card';
 
 let isYesterdayTarget = false
 export default function PostMomentTime(props: {
@@ -73,37 +74,39 @@ export default function PostMomentTime(props: {
     }
 
     function durationContent() {
-        return <View className='picker_time_card'>
-            <View className='picker_time_card_header'>
-                <View style={{ width: rpxToPx(52) }} />
-                <Text>Duration</Text>
-                <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)
-                    }} />
-            }
+        return <Card>
+            <View style={{display:'flex',flexDirection:'column',alignItems:'center'}}>
+                <View className='picker_time_card_header'>
+                    <View style={{ width: rpxToPx(52) }} />
+                    <Text>Duration</Text>
+                    <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)
+                        }} />
+                }
 
-            <View className='picker_time_card_footer'>
-                <IconTarget width={rpxToPx(24)} color='#5C7099' />
-                <Text style={{ color: '#5C7099', marginLeft: rpxToPx(12), fontSize: rpxToPx(26) }}>Expect to finish at {endTime()}</Text>
+                <View className='picker_time_card_footer'>
+                    <IconTarget width={rpxToPx(24)} color='#5C7099' />
+                    <Text style={{ color: '#5C7099', marginLeft: rpxToPx(12), fontSize: rpxToPx(26) }}>Expect to finish at {endTime()}</Text>
 
+                </View>
             </View>
-        </View>
+        </Card>
     }
 
     function scheduleTime() {
@@ -111,7 +114,7 @@ export default function PostMomentTime(props: {
             var timestamp = props.moment.target.timestamp
             var time1 = parseInt(dayjs(timestamp).format('HHmm'))
             var now = parseInt(dayjs().format('HHmm'))
-            if (time == dayjs(timestamp).format('HH:mm')){
+            if (time == dayjs(timestamp).format('HH:mm')) {
                 return `Check in:Today ${dayjs(global.set_time).format('HH:mm')}`
             }
             if (time1 > now) {
@@ -138,77 +141,79 @@ export default function PostMomentTime(props: {
             })
         }}
         themeColor={getThemeColor(health.mode)}>
-        <View style={{ flexDirection: 'column', display: 'flex', alignItems: 'center' }}>
-
-            <View className='picker_time_card'>
-                <View className='picker_time_card_header'>
-                    <View style={{ flex: 1 }} />
-                    <NewButton
-                        type={NewButtonType.gray}
-                        title={isYesterday ? 'Yesterday' : 'Today'}
-                        height={rpxToPx(84)}
-                        onClick={() => {
-                            setIsYesterday(!isYesterday)
-                        }}
-                    />
-                    <View style={{ width: rpxToPx(12) }} />
-                    <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' />
-                    }
-                </View>
-                {
-                    !showDurationPicker && <NewTimePicker time={time} onChange={(e) => {
-                        setTime(e)
-                    }} color={getThemeColor(health.mode)} />
-                }
-                {
-                    !props.isTemp && !showDurationPicker && <View className='picker_time_card_footer' onClick={() => {
-                        if (time == dayjs(props.moment.target.timestamp).format('HH:mm')){
-                            setIsYesterday(false)
-                            setTime(dayjs(global.set_time).format('HH:mm'))
-                        }
-                        else {
-                            setIsYesterday(isYesterdayTarget)
-                            setTime(dayjs(props.moment.target.timestamp).format('HH:mm'))
+        <Card>
+            <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
+                <View className='picker_time_card'>
+                    <View className='picker_time_card_header'>
+                        <View style={{ flex: 1 }} />
+                        <NewButton
+                            type={NewButtonType.gray}
+                            title={isYesterday ? 'Yesterday' : 'Today'}
+                            height={rpxToPx(84)}
+                            onClick={() => {
+                                setIsYesterday(!isYesterday)
+                            }}
+                        />
+                        <View style={{ width: rpxToPx(12) }} />
+                        <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' />
                         }
-                        
-                    }}>
-                        <IconCalendar width={rpxToPx(24)} color='#5C7099' />
-                        <Text style={{ color: '#5C7099', marginLeft: rpxToPx(12), fontSize: rpxToPx(26) }}>{scheduleTime()}</Text>
                     </View>
-                }
+                    {
+                        !showDurationPicker && <NewTimePicker time={time} onChange={(e) => {
+                            setTime(e)
+                        }} color={getThemeColor(health.mode)} />
+                    }
+                    {
+                        !props.isTemp && !showDurationPicker && <View className='picker_time_card_footer' onClick={() => {
+                            if (time == dayjs(props.moment.target.timestamp).format('HH:mm')) {
+                                setIsYesterday(false)
+                                setTime(dayjs(global.set_time).format('HH:mm'))
+                            }
+                            else {
+                                setIsYesterday(isYesterdayTarget)
+                                setTime(dayjs(props.moment.target.timestamp).format('HH:mm'))
+                            }
 
-            </View>
-            <View style={{ marginBottom: rpxToPx(72), marginTop: rpxToPx(36) }}>
-                {
-                    showMore ? durationContent() :
-                        <View
-                            onClick={() => setShowMore(true)}
-                            style={{
-                                flexDirection: 'row',
-                                width: rpxToPx(142),
-                                height: rpxToPx(72),
-                                display: 'flex',
-                                alignItems: 'center',
-                                justifyContent: 'center'
-                            }}>
-                            <Image style={{ width: rpxToPx(26), height: rpxToPx(26) }} src={require('@assets/_health/setting.png')} />
-                            <Text style={{ color: '#5C7099', marginLeft: rpxToPx(10) }}>More</Text>
+                        }}>
+                            <IconCalendar width={rpxToPx(24)} color='#5C7099' />
+                            <Text style={{ color: '#5C7099', marginLeft: rpxToPx(12), fontSize: rpxToPx(26) }}>{scheduleTime()}</Text>
                         </View>
-                }
+                    }
+
+                </View>
 
             </View>
 
+        </Card>
+        <View style={{ marginTop: rpxToPx(36), display: 'flex', flexDirection: 'column', alignItems: showMore?'flex-start':'center' }}>
+            {
+                showMore ? durationContent() :
+                    <View
+                        onClick={() => setShowMore(true)}
+                        style={{
+                            flexDirection: 'row',
+                            width: rpxToPx(142),
+                            height: rpxToPx(72),
+                            display: 'flex',
+                            alignItems: 'center',
+                            justifyContent: 'center'
+                        }}>
+                        <Image style={{ width: rpxToPx(26), height: rpxToPx(26) }} src={require('@assets/_health/setting.png')} />
+                        <Text style={{ color: '#5C7099', marginLeft: rpxToPx(10) }}>More</Text>
+                    </View>
+            }
+
         </View>
     </NewModal>
 

+ 3 - 3
src/_health/pages/fast_sleep.tsx

@@ -76,9 +76,9 @@ export default function FastSleep() {
             subtitle={health.fast_with_sleep.status != 'OG2_MISALIGNED'?'Tune Into Your Circadian Rhythm ':''}
         />
         {
-            health.fast_with_sleep.status != 'OG2_MISALIGNED' && <Swiper indicatorColor='#999'
-                indicatorActiveColor='#333'
-                style={{ height: rpxToPx(444), marginBottom: rpxToPx(24), flexShrink: 0 }}
+            health.fast_with_sleep.status != 'OG2_MISALIGNED' && <Swiper indicatorColor='#59595933'
+                indicatorActiveColor='#59595999'
+                style={{ height: rpxToPx(460), marginBottom: rpxToPx(24), flexShrink: 0 }}
                 onChange={e => setCurrent(e.detail.current)}
                 current={current}
                 indicatorDots>

+ 116 - 23
src/_health/pages/log_time.tsx

@@ -53,7 +53,7 @@ export default function LogTime() {
     const [expandIndex, setExpandIndex] = useState(router.params.initIndex ? router.params.initIndex : tapIndex)
     const [array, setArray] = useState<any>([])
     const [errors, setErrors] = useState<any>([])
-    const [showSuccess,setShowSuccess] = useState(false)
+    const [showSuccess, setShowSuccess] = useState(false)
     const [conflicts, setConflicts] = useState<any>([])
     const [loaded, setLoaded] = useState(false)
     const [autoCheck, setAutoCheck] = useState(false)
@@ -362,27 +362,9 @@ export default function LogTime() {
             }
         }
 
-        //检查断食时间是否超过24小时
-        const { fast } = data
-        if (fast.real) {
-            var t = fast.real.start_timestamp
-            var schedule_id = fast.timeline[1].schedule_id
-            if (list[list.length - 1].schedule_id == schedule_id && list[list.length - 1].timestamp - t > 24 * 3600 * 1000) {
-                showAlert({
-                    title: 'Saving as Long Fast',
-                    content: 'Fasting that lasts more than 24 hours will be saved as Long Fast. ',
-                    showCancel: true,
-                    cancelText: '取消',
-                    confirmText: '保存',
-                    cancel: () => {
-                    },
-                    confirm: () => {
-                        commit(list, onlyCheck)
-                    }
-                })
-                return;
-            }
-        }
+
+
+
 
         if (firstCheck && parseInt(router.params.initIndex) == 1) {
             var temps = [list[1], list[0]]
@@ -720,6 +702,117 @@ export default function LogTime() {
         return <View style={{ position: 'relative' }}></View>
     }
 
+    function tapFooterBtn(onlyCheck, firstCheck = false) {
+
+        var list: any = []
+        if (isSingle) {
+            var obj = array[0]
+            var timestamp = getTimestamp(obj)
+            var params: any = {
+                schedule_id: obj.schedule_id,
+                event_id: obj.event_id ? obj.event_id : null,
+                extra: obj.extra,
+                date: dayjs(timestamp).format('YYYYMMDD'),
+                timestamp: timestamp,
+            }
+            if (isStart) {
+                params.duration = isFast ? data.fast.target.duration : data.sleep.target.duration
+            }
+            list.push(params)
+        }
+        else {
+            if (type == 'home') {
+                if (parseInt(tapIndex + '') == 2) {
+                    var obj = array[1]
+                    var timestamp = getTimestamp(obj)
+                    list.push({
+                        schedule_id: obj.schedule_id,
+                        event_id: obj.event_id ? obj.event_id : null,
+                        extra: obj.extra,
+                        date: dayjs(timestamp).format('YYYYMMDD'),
+                        timestamp: timestamp,
+                    })
+
+                    var obj2 = array[2]
+                    var timestamp2 = getTimestamp(obj2)
+                    list.push({
+                        schedule_id: obj2.schedule_id,
+                        event_id: obj.event_id ? obj.event_id : null,
+                        extra: obj2.extra,
+                        date: dayjs(timestamp2).format('YYYYMMDD'),
+                        timestamp: timestamp2,
+                    })
+                }
+                if (parseInt(tapIndex + '') == 3) {
+                    var obj = array[0]
+                    var timestamp = getTimestamp(obj)
+                    list.push({
+                        schedule_id: obj.schedule_id,
+                        event_id: obj.event_id ? obj.event_id : null,
+                        extra: obj.extra,
+                        date: dayjs(timestamp).format('YYYYMMDD'),
+                        timestamp: timestamp,
+                    })
+
+                    var obj2 = array[3]
+                    var timestamp2 = getTimestamp(obj2)
+                    list.push({
+                        schedule_id: obj2.schedule_id,
+                        event_id: obj.event_id ? obj.event_id : null,
+                        extra: obj2.extra,
+                        date: dayjs(timestamp2).format('YYYYMMDD'),
+                        timestamp: timestamp2,
+                    })
+                }
+            }
+            else {
+
+
+                // const { status } = data
+                for (var i = 0; i <= tapIndex; i++) {
+                    if (firstCheck && i > 1) {
+
+                    }
+                    else {
+                        var obj = array[i]
+                        var timestamp = getTimestamp(obj)
+                        list.push({
+                            schedule_id: obj.schedule_id,
+                            event_id: obj.event_id ? obj.event_id : null,
+                            extra: obj.extra,
+                            date: dayjs(timestamp).format('YYYYMMDD'),
+                            timestamp: timestamp,
+                        })
+                    }
+                }
+            }
+        }
+
+        //检查断食时间是否超过24小时
+        const { fast } = data
+        if (fast.real) {
+            var t = fast.real.start_timestamp
+            var schedule_id = fast.timeline[1].schedule_id
+            if (list[list.length - 1].schedule_id == schedule_id && list[list.length - 1].timestamp - t > 24 * 3600 * 1000) {
+                showAlert({
+                    title: 'Saving as Long Fast',
+                    content: 'Fasting that lasts more than 24 hours will be saved as Long Fast. ',
+                    showCancel: true,
+                    cancelText: '取消',
+                    confirmText: '保存',
+                    cancel: () => {
+                    },
+                    confirm: () => {
+                        tapCommit(false)
+                    }
+                })
+                return;
+            }
+        }
+
+        tapCommit(false)
+    }
+
     if (!loaded) return <View />
 
     return <View className="page_container">
@@ -807,7 +900,7 @@ export default function LogTime() {
                 width={rpxToPx(646)}
                 height={rpxToPx(96)}
                 bold={true}
-                onClick={() => tapCommit(false)} />
+                onClick={() => tapFooterBtn(false)} />
         </View>
 
     </View>

+ 1 - 0
src/_health/pages/long_fast_setting.scss

@@ -7,6 +7,7 @@
 }
 
 .long_fast_card_header{
+    position: relative;
     display: flex;
     flex-direction: row;
     padding-left: 52px;

+ 3 - 3
src/_health/pages/long_fast_setting.tsx

@@ -68,7 +68,7 @@ export default function LongFastSetting() {
     }
     return <View className="page_container">
         <Card>
-            <View style={{ position: 'relative' }}>
+            <View style={{ position: 'relative',display:'flex',flexDirection:'column',alignItems:'center' }}>
                 <View className="long_fast_card_header">
                     <View className="h34">Goal</View>
                     <View style={{ flex: 1 }} />
@@ -101,7 +101,7 @@ export default function LongFastSetting() {
         </Card>
         <View style={{ height: rpxToPx(36) }} />
         <Card>
-            <View style={{ position: 'relative' }}>
+            <View style={{ display:'flex',flexDirection:'column',alignItems:'center' }}>
                 <View className="long_fast_card_header">
                     <View className="h34">Starts</View>
                     <View style={{ flex: 1 }} />
@@ -134,7 +134,7 @@ export default function LongFastSetting() {
             </View>
         </Card>
         <View style={{ flex: 1 }} />
-        <View style={{ marginBottom: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+        <View style={{ marginBottom: rpxToPx(128), alignItems: 'center', justifyContent: 'center' }}>
             <NewButton type={NewButtonType.fill}
                 color={MainColorType.fast}
                 width={rpxToPx(670)}

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

@@ -17,6 +17,7 @@ import { IconMore } from "@/components/basic/Icons";
 import NewHeader, { NewHeaderType } from "../components/new_header";
 import NewButton, { NewButtonType } from "../base/new_button";
 import { MainColorType } from "@/context/themes/color";
+import StatusIndicator, { StatusType } from "../base/status_indicator";
 
 let timer
 export default function Move() {
@@ -490,8 +491,15 @@ export default function Move() {
         })
 
         return <View className="summary_status_bg">
-            <View className="summary_status_point" style={{ backgroundColor: selItem.type == 'SLEEP' ? getThemeColor('SLEEP') : getThemeColor('ACTIVE') }} />
-            <Text className="summary_status_text">{selItem.type == 'SLEEP' ? 'SLEEP HOUR ' : 'WAKING HOUR '}{selItem.index}</Text>
+            <StatusIndicator 
+                type={StatusType.normal}
+                color={selItem.type == 'SLEEP' ? getThemeColor('SLEEP') : getThemeColor('ACTIVE')}
+                text={`${selItem.type == 'SLEEP' ? 'SLEEP HOUR ' : 'WAKING HOUR '}${selItem.index}`}
+                // fontSize={}
+                // fontColor={}
+            />
+            {/* <View className="summary_status_point" style={{ backgroundColor: selItem.type == 'SLEEP' ? getThemeColor('SLEEP') : getThemeColor('ACTIVE') }} /> */}
+            {/* <Text className="summary_status_text">{selItem.type == 'SLEEP' ? 'SLEEP HOUR ' : 'WAKING HOUR '}{selItem.index}</Text> */}
         </View>
 
     }

+ 1 - 2
src/_health/pages/post_result.scss

@@ -70,8 +70,7 @@
     flex-direction: row;
     align-items: center;
     box-sizing: border-box;
-    padding-left: 64px;
-    padding-right: 40px;
+    padding-left: 52px;
     padding-top: 40px;
     padding-bottom: 57px;
 }

+ 12 - 10
src/_health/pages/post_result.tsx

@@ -185,7 +185,7 @@ export default function PostResult() {
             </View>
         }
         {
-            data.current_window && <View className="result_next" style={{alignItems:'center'}}>
+            data.current_window && <View className="result_next" style={{ alignItems: 'center' }}>
                 <View className="result_top_line" />
                 <StatusIndicator
                     text={statusText()}
@@ -205,15 +205,15 @@ export default function PostResult() {
                 title="Done"
                 bold
                 onClick={() => {
-                    if (data.current_window){
+                    if (data.current_window) {
                         Taro.navigateBack({
-                            delta:6
+                            delta: 6
                         })
                     }
                     else {
                         Taro.navigateBack()
                     }
-                    
+
                 }}
             />
             {
@@ -235,17 +235,19 @@ export default function PostResult() {
                 dismiss={() => setShowSetting(false)}
                 confirm={() => setShowSetting(false)}
             >
-                <View style={{ marginBottom: rpxToPx(72) }}>
-                    <Card>
-                        <View className="setting_item">
+
+                <Card>
+                    <View style={{display:'flex',flexDirection:'row',alignItems:'center',paddingRight:rpxToPx(40)}}>
+                        <View className="setting_item" style={{ flex: 1 }}>
                             <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>
-                    </Card>
-                </View>
+                        <Switch color={getThemeColor(data.window)} checked={data.next.reminder} onChange={changeReminder} />
+                    </View>
+                </Card>
             </NewModal>
         }
     </View>

+ 73 - 43
src/_health/pages/schedules.tsx

@@ -17,6 +17,7 @@ import showActionSheet from "@/components/basic/ActionSheet";
 import Card from "../components/card";
 import StatusIndicator, { StatusType } from "../base/status_indicator";
 import { MainColorType } from "@/context/themes/color";
+import { AtSwipeAction } from "taro-ui"
 
 let useRoute;
 let useNavigation;
@@ -55,9 +56,6 @@ export default function Schedules() {
     const selMode = router.params.mode;
 
     useEffect(() => {
-        console.log(health.mode)
-        console.log(selMode)
-        console.log('---------------')
         if (selMode == '' && router.params.schedules) {
             setList(JSON.parse(router.params.schedules))
             if (router.params.errors) {
@@ -152,6 +150,7 @@ export default function Schedules() {
                 setShowTimePicker(false)
                 var array = JSON.parse(JSON.stringify(list))
                 array[selIndex].time = e
+                array[selIndex].op_ms = new Date().getTime()
                 setList(array)
                 checkData(array)
                 // confirmPickerTime(e)
@@ -269,9 +268,9 @@ export default function Schedules() {
                 // color: '#FF0000'
                 backgroundColor: '#B2B2B21A',
                 color: '#000',
-                borderWidth:2,
-                borderColor:'#FF0000',
-                borderStyle:'solid'
+                borderWidth: 2,
+                borderColor: '#FF0000',
+                borderStyle: 'solid'
             }
         }
         if (errors.length > 0) {
@@ -352,47 +351,78 @@ export default function Schedules() {
                 }
                 {
                     list.map((obj, i) => {
-                        return <View className='schedule_item' key={i} style={{
+                        return <AtSwipeAction key={i * 100}
+                            isOpened={false}
+                            autoClose
+                            disabled={obj.window != 'EAT' && obj.window != 'ACTIVE'}
+                            options={[
+                                {
+                                    text: '删除',
+                                    style: {
+                                        backgroundColor: '#FF4949'
+                                    }
+                                }
+                            ]}
+                            onClick={() => {
+                                if (obj.window == 'ACTIVE' || obj.window == 'EAT') {
+                                    // if (item.list.length == 1) {
+                                    //     Taro.showToast({
+                                    //         title: '至少保留一项',
+                                    //         icon: 'none'
+                                    //     })
+                                    //     return;
+                                    // }
+                                }
+                                showAlert({
+                                    title: '删除',
+                                    content: '确认删除此计划',
+                                    showCancel: true,
+                                    cancel: () => {
+                                        console.log('cancel')
+                                    },
+                                    confirm: () => {
+                                        // delItem(index, i)
+                                    }
+                                })
+                            }}
+                        ><View className='schedule_item' key={i} style={{
                             width: rpxToPx(700),
                             boxSizing: 'border-box',
                             backgroundColor: (obj.window == selMode && highlight) ? getThemeColor(selMode) + '08' : '#fff'
 
                         }}>
-                            <View className='item_left2'>
-                                {/* <View className='item_index'>
-                                    <View className="index_point" style={{ backgroundColor: getThemeColor(obj.window) }} />
-                                </View>
-                                <Text className='item_name'>{obj.title}</Text> */}
-                                <StatusIndicator
-                                    type={obj.is_conflict?StatusType.img:StatusType.normal}
-                                    text={obj.title}
-                                    fontSize={rpxToPx(34)}
-                                    fontColor="#000"
-                                    color={obj.is_conflict?MainColorType.error:errors.length==0?getThemeColor(obj.window):'transparent'} >
+                                <View className='item_left2'>
+                                    <StatusIndicator
+                                        type={obj.is_conflict ? StatusType.img : StatusType.normal}
+                                        text={obj.title}
+                                        fontSize={rpxToPx(34)}
+                                        fontColor="#000"
+                                        color={obj.is_conflict ? MainColorType.error : errors.length == 0 ? getThemeColor(obj.window) : 'transparent'} >
+                                        {
+                                            obj.is_conflict && <IconError color="#fff" width={rpxToPx(26)} />
+                                        }
+
+                                    </StatusIndicator>
+                                    <View style={{ flex: 1 }} />
                                     {
-                                        obj.is_conflict && <IconError color="#fff" width={rpxToPx(26)} />
+                                        !obj.is_all_day && !obj.reminder && <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
+                                    }
+                                    <View style={{ width: rpxToPx(12) }} />
+                                    {
+                                        !obj.is_all_day && <View className='edit_item_time' onClick={() => {
+                                            setSelIndex(i)
+                                            setSelItem(obj)
+                                            setShowTimePicker(true)
+                                        }} style={itemStyle(obj)}>{obj.time}</View>
                                     }
-                                    
-                                </StatusIndicator>
-                                <View style={{ flex: 1 }} />
-                                {
-                                    !obj.is_all_day && !obj.reminder && <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
-                                }
-                                <View style={{ width: rpxToPx(12) }} />
-                                {
-                                    !obj.is_all_day && <View className='edit_item_time' onClick={() => {
-                                        setSelIndex(i)
-                                        setSelItem(obj)
-                                        setShowTimePicker(true)
-                                    }} style={itemStyle(obj)}>{obj.time}</View>
-                                }
 
 
+                                </View>
+                                {
+                                    i < list.length - 1 && <View className='border_footer_line' style={{ left: rpxToPx(66) }} />
+                                }
                             </View>
-                            {
-                                i < list.length - 1 && <View className='border_footer_line' style={{ left: rpxToPx(66) }} />
-                            }
-                        </View>
+                        </AtSwipeAction>
                     })
                 }
             </Card>
@@ -400,12 +430,12 @@ export default function Schedules() {
             {
                 selMode != '' && selMode != 'DAY' && selMode != 'NIGHT' && <Card><View className='item_add'
                     onClick={() => add()}>
-                        <StatusIndicator type={StatusType.img}
-                            fontColor={getAddColor()}
-                            fontSize={rpxToPx(34)}
-                            text='添加' color={getAddColor()}>
-                            <IconAdd color="#fff" width={rpxToPx(26)} />
-                        </StatusIndicator>
+                    <StatusIndicator type={StatusType.img}
+                        fontColor={getAddColor()}
+                        fontSize={rpxToPx(34)}
+                        text='添加' color={getAddColor()}>
+                        <IconAdd color="#fff" width={rpxToPx(26)} />
+                    </StatusIndicator>
                     {/* <IconAdd color={getAddColor()} width={rpxToPx(34)} />
                     <View className='toolbar_btn' style={{ color: getAddColor() }} >添加</View> */}
                     <View style={{ flex: 1 }} />

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

@@ -76,7 +76,7 @@ export default function SchedulesEdit() {
                 windows = 'DAY,NIGHT';
                 break
             case 'NIGHT':
-                windows = 'ACTIVE,DAY';
+                windows = 'NIGHT,DAY';
                 break
         }
         getSchedules({ window: windows }).then(res => {
@@ -295,6 +295,7 @@ export default function SchedulesEdit() {
                                             })
                                         }}
                                     >
+                                        
                                         <View className='schedule_item' style={{ width: rpxToPx(750), boxSizing: 'border-box' }}>
                                             <View style={{ display: 'flex', flexDirection: 'column', justifyContent: 'flex-start', flex: 1 }}>
                                                 <View className='item_left2'>

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

@@ -195,7 +195,8 @@ export default function TimelineDetail() {
         params.event_id = event_id
         createMoment(params).then(res => {
             getDatas()
-
+            setImgUrl('')
+            setDesc('')
             global.refreshWindow()
             global.refreshHistory()
             setShowPop(false)

+ 1 - 1
src/context/themes/color.tsx

@@ -39,7 +39,7 @@ export enum MainColorType {
     white = '#ffffff',
 
     //gray
-    g01 = '#999999',
+    g01 = '#959595',
     g02 = '#b2b2b2',
     g03 = '#d9d9d9',
     g04 = '#e5e5e5',

+ 1 - 1
src/features/health/History.scss

@@ -85,7 +85,7 @@
     background-color: #fff;
     position: relative;
     height: 108px;
-    padding-left: 52px;
+    padding-left: 40px;
     padding-right: 40px;
     display: flex;
     flex-direction: row;

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

@@ -229,7 +229,7 @@ export default function HistoryItem(props: {
                     }
                 </View>
             }
-            {
+            {/* {
                 props.isArchived && <View className="history_archived_row">
                     <View className="history_archived" onClick={(e) => {
                         if (process.env.TARO_ENV == 'weapp') {
@@ -259,7 +259,7 @@ export default function HistoryItem(props: {
                         <IconMore width={17} color="#b2b2b2" />
                     </View>
                 </View>
-            }
+            } */}
             <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(60), marginTop: rpxToPx(20) }}>
                 <View style={{ flex: 1 }} />
                 <NewButton type={NewButtonType.more}

+ 4 - 2
src/features/health/MainConsole.tsx

@@ -70,7 +70,7 @@ export default function MainConsole(props: { type: WindowType }) {
         }
         console.log(item)
         setSelItem(item)
-        setShowPicker(true)
+        // setShowPicker(true)
     }
 
 
@@ -631,7 +631,9 @@ export default function MainConsole(props: { type: WindowType }) {
                     switch (health.mode) {
                         case 'DAY':
                         case 'NIGHT':
-                            jumpPage('/_health/pages/schedules?mode=' + health.mode)
+                            //var url = `./schedules_edit?type=${res == 0 ? 'reminder' : 'name'}&mode=${selMode}`
+                            jumpPage(`/_health/pages/schedules_edit?type=reminder&mode=${health.mode}`)
+                            // jumpPage('/_health/pages/schedules?mode=' + health.mode)
                             break;
                         case 'FAST':
                         case 'SLEEP':

+ 2 - 3
src/features/health/calendar.scss

@@ -18,7 +18,7 @@
     display: flex;
     flex-direction: column;
     margin-left: 20px;
-    margin-right: 20px;
+    // margin-right: 20px;
     box-sizing: border-box;
     overflow: hidden;
 }
@@ -33,8 +33,7 @@
 }
 
 .week_item {
-    flex: 1;
-    // width: 90px;
+    width: 94px;
     flex-shrink: 0;
     display: flex;
     align-items: center;

+ 1 - 1
src/services/health.tsx

@@ -353,7 +353,7 @@ export const updateFast = (params) => {
 export const delRecord = (id, params={}) => {
     return new Promise((resolve) => {
         request({
-            url: API_HEALTH_WINDOWS + '/' + id, method: 'DELETE'//, data: { ...params }
+            url: API_HEALTH_WINDOWS + '/' + id, method: 'DELETE', data: { ...params }
         }).then(res => {
             resolve(res)
         })