Leon 1 éve
szülő
commit
459faae272

+ 23 - 3
src/_health/components/fast_sleep_card.tsx

@@ -114,7 +114,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
 
     function target3BigRing() {
         const { fast, sleep, status } = props.data
-        if (status == 'OG2_NO1'||sleep.status == 'WFS') {
+        if (status == 'OG2_NO1' || sleep.status == 'WFS') {
             var time1 = fast.period.end_time
             var time2 = sleep.period.end_time
             var duration = 0
@@ -226,7 +226,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
         }
     }
     function real3BigRing() {
-        const { fast, sleep,status } = props.data
+        const { fast, sleep, status } = props.data
         if (status == 'WFS') {
             if (sleep.target.end_timestamp <= new Date().getTime() && new Date().getTime() < fast.target.end_timestamp) {
                 return {
@@ -251,7 +251,7 @@ export default function FastSleepCard(props: { step: number, data: any }) {
     function currentDot(mode, outRange?: boolean) {
         return {
             color: outRange ? '#B2B2B2' : getThemeColor(mode),
-            fillColor:outRange ?MainColorType.g03:'#ffffff00',
+            fillColor: outRange ? MainColorType.g03 : '#ffffff00',
             lineWidth: 4,
             borderColor: '#ffffff',
             offset: 0
@@ -362,6 +362,26 @@ export default function FastSleepCard(props: { step: number, data: any }) {
             outRange = false
         }
 
+        if (status == 'OG3') {
+            outRange = false
+        }
+        else if (status == 'OG2_NO1' || sleep.status == 'WFS') {
+            var time1 = fast.period.end_time
+            var time2 = sleep.period.end_time
+            var duration = 0
+
+            var t1 = parseInt(time1.split(':')[0]) * 60 + parseInt(time1.split(':')[1])
+            var t2 = parseInt(time2.split(':')[0]) * 60 + parseInt(time2.split(':')[1])
+            duration = t1 - t2 >= 0 ? (t1 - t2) * 60 * 1000 : (t1 - t2) * 60 * 1000 + 24 * 3600 * 1000
+
+            if (new Date().getTime() <= fast.target.end_timestamp && fast.target.end_timestamp - duration <= new Date().getTime()) {
+                outRange = false
+            }
+            else {
+                outRange = true
+            }
+        }
+
         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()}

+ 11 - 0
src/_health/components/fast_sleep_popup.scss

@@ -57,4 +57,15 @@
     flex-direction: column;
     align-items: flex-start;
     margin-bottom: 36px;
+}
+
+.pop_step_content{
+    margin-top: 12px;
+    display: flex;
+    flex-direction: row;
+}
+
+.pop_step_right{
+    margin-left: 10px;
+    margin-top: 14px;
 }

+ 29 - 14
src/_health/components/fast_sleep_popup.tsx

@@ -21,28 +21,43 @@ export default function FastSleepPopup(props: { close: any, data: any }) {
     }
 
     function total1() {
-        const { fast, sleep } = props.data
-        return diffentTime(fast.period.start_time, sleep.period.start_time)
+        const { fast, sleep, status } = props.data
+        if (status == 'WFS') return ''
+        var str = ' / ' + diffentTime(fast.period.start_time, sleep.period.start_time)
+        if (status == 'OG2_NO1') {
+            return <View className="h24 bold pop_step_right" style={{ color: MainColorType.error }}>{str}</View>
+        }
+        return <View className="h24 bold pop_step_right" style={{ color: MainColorType.fast }}>{str}</View>
     }
 
     function total2() {
-        const { sleep } = props.data
-        return diffentTime(sleep.period.start_time, sleep.period.end_time)
+        const { sleep, status } = props.data
+        if (status == 'WFS') return ''
+        var str = ' / ' + diffentTime(sleep.period.start_time, sleep.period.end_time)
+        if (status == 'OG2' || status == 'OG2_NO1'||status == 'OG3') {
+            return <View className="h24 bold pop_step_right" style={{ color: MainColorType.sleep }}>{str}</View>
+        }
+        return <View className="h24 bold pop_step_right" style={{ color: MainColorType.g02 }}>{str}</View>
     }
 
     function total3() {
-        const { fast, sleep } = props.data
-        return diffentTime(sleep.period.end_time, fast.period.end_time)
+        const { fast, sleep, status } = props.data
+        if (status == 'WFS') return ''
+        var str = ' / ' + diffentTime(sleep.period.end_time, fast.period.end_time)
+        if (status == 'OG3') {
+            return <View className="h24 bold pop_step_right" style={{ color: MainColorType.fast }}>{str}</View>
+        }
+        return <View className="h24 bold pop_step_right" style={{ color: MainColorType.g02 }}>{str}</View>
     }
 
     function step1() {
-        
+
         const { fast, sleep, status } = props.data
         if (status == 'OG2_NO1') {
             return <View className="time_count h30 bold" style={{ backgroundColor: MainColorType.error }}>00:00:00</View>
         }
         if (status == 'WFS') {
-            return ('')
+            return <View className="g02 h24 bold">{TimeFormatter.calculateTimeDifference(fast.target.start_timestamp, sleep.target.start_timestamp)}</View>
         }
         else if (status == 'OG1') {
             return <View className="time_count h30 bold" style={{ backgroundColor: MainColorType.fast }}>{TimeFormatter.countdown(fast.real.start_timestamp)}</View>
@@ -50,13 +65,13 @@ export default function FastSleepPopup(props: { close: any, data: any }) {
         else if (status == 'OG2_NO1') {
             return ('')
         }
-        return TimeFormatter.calculateTimeDifference(fast.real.start_timestamp, sleep.real.start_timestamp)
+        return <View className="h30 bold" style={{ color: MainColorType.fast }}>{TimeFormatter.calculateTimeDifference(fast.real.start_timestamp, sleep.real.start_timestamp)}</View>
     }
 
     function step2() {
         const { fast, sleep, status } = props.data
         if (status == 'WFS') {
-            return ''
+            return <View className="g02 h24 bold">{TimeFormatter.calculateTimeDifference(sleep.target.start_timestamp, sleep.target.end_timestamp)}</View>
         }
         if (status == 'OG1') {
             return <View className="time_count h30 bold" style={{ backgroundColor: MainColorType.g03 }}>00:00:00</View>
@@ -66,17 +81,17 @@ export default function FastSleepPopup(props: { close: any, data: any }) {
             return <View className="time_count h30 bold" style={{ backgroundColor: MainColorType.sleep }}>{TimeFormatter.countdown(sleep.real.start_timestamp)}</View>
         }
         else if (status == 'OG3') {
-            return TimeFormatter.calculateTimeDifference(sleep.real.start_timestamp, sleep.real.end_timestamp)
+            return <View className="h30 bold" style={{ color: MainColorType.sleep }}>{TimeFormatter.calculateTimeDifference(sleep.real.start_timestamp, sleep.real.end_timestamp)}</View>
         }
-        return TimeFormatter.calculateTimeDifference(sleep.target.start_timestamp, sleep.target.end_timestamp)
+        return <View className="h30 bold" style={{ color: MainColorType.sleep }}>{TimeFormatter.calculateTimeDifference(sleep.target.start_timestamp, sleep.target.end_timestamp)}</View>
     }
 
     function step3() {
         const { fast, sleep, status } = props.data
         if (status == 'WFS') {
-            return ''
+            return <View className="g02 h24 bold">{TimeFormatter.calculateTimeDifference(sleep.target.end_timestamp, fast.target.end_timestamp)}</View>
         }
-        if (status == 'OG1' || status == 'OG2_NO1' || status == 'OG2'){
+        if (status == 'OG1' || status == 'OG2_NO1' || status == 'OG2') {
             return <View className="time_count h30 bold" style={{ backgroundColor: MainColorType.g03 }}>00:00:00</View>
         }
         if (status == 'OG3') {

+ 30 - 12
src/_health/components/fast_sleep_popup_content.tsx

@@ -14,9 +14,9 @@ export default function FastSleepPopupContent(props: {
     afterStatus: StatusType,
     showStep: boolean,
     total: string,
-    total1: string,
-    total2: string,
-    total3: string,
+    total1?: any,
+    total2?: any,
+    total3?: any,
     step1?: any,
     step2?: any,
     step3?: any,
@@ -89,39 +89,57 @@ export default function FastSleepPopupContent(props: {
                 }
                 <View style={{ display: 'flex', flexDirection: 'row' }}>
                     <View style={{
-                        marginLeft: rpxToPx(12.5),
+                        marginLeft: rpxToPx(10),
                         marginRight: rpxToPx(24),
                         width: 1, height: rpxToPx(103),
                         backgroundColor: (props.sleepStatus == StatusType.ing || props.afterStatus == StatusType.ing) ? MainColorType.g01 : MainColorType.g03
                     }} />
-                    <View className="bold h24"
-                        style={{ marginTop: rpxToPx(12), color: props.beforeStatus == StatusType.ing ? MainColorType.fast : '#000', display: 'flex', flexDirection: 'row', alignItems: 'center' }}><View className="h34">{props.step1 ?? ''}</View>{props.showStep && ' / '}{props.total1}</View>
+                    <View className="pop_step_content">
+                        {
+                            props.step1
+                        }
+                        {
+                            props.total1
+                        }
+                    </View>
                 </View>
                 {
                     sleeping()
                 }
                 <View style={{ display: 'flex', flexDirection: 'row' }}>
                     <View style={{
-                        marginLeft: rpxToPx(12.5),
+                        marginLeft: rpxToPx(10),
                         marginRight: rpxToPx(24),
                         width: 1, height: rpxToPx(103),
                         backgroundColor: props.afterStatus == StatusType.ing ? MainColorType.g01 : MainColorType.g03
                     }} />
-                    <View className="bold h24"
-                        style={{ marginTop: rpxToPx(12), color: props.sleepStatus == StatusType.ing ? MainColorType.sleep : '#000', display: 'flex', flexDirection: 'row', alignItems: 'center' }}><View className="h34">{props.step2 ?? ''}</View>{props.showStep && ' / '}{props.total2}</View>
+                    <View className="pop_step_content">
+                        {
+                            props.step2
+                        }
+                        {
+                            props.total2
+                        }
+                    </View>
                 </View>
                 {
                     afterSleep()
                 }
                 <View style={{ display: 'flex', flexDirection: 'row' }}>
                     <View style={{
-                        marginLeft: rpxToPx(12.5),
+                        marginLeft: rpxToPx(10),
                         marginRight: rpxToPx(24.5),
                         width: 1, height: rpxToPx(103),
                         backgroundColor: 'transparent'
                     }} />
-                    <View className="bold h24"
-                        style={{ marginTop: rpxToPx(12), color: props.afterStatus == StatusType.ing ? MainColorType.fast : '#000', display: 'flex', flexDirection: 'row', alignItems: 'center' }}><View className="h34">{props.step3 ?? ''}</View>{props.showStep && ' / '}{props.total3}</View>
+                    <View className="pop_step_content">
+                        {
+                            props.step3
+                        }
+                        {
+                            props.total3
+                        }
+                    </View>
                 </View>
             </View>
             <NewButton

+ 53 - 0
src/_health/components/move_list.scss

@@ -0,0 +1,53 @@
+.drag_item{
+    // background-color: gray;
+    border-radius: 20px;
+    margin-left: 20px;
+    margin-right: 20px;
+    width: 710px;
+}
+
+.last_item{
+    // background-color: ;
+    color: #fff;
+}
+
+.demo_item{
+    // width: 750px;
+    // background-color: #000;
+}
+
+.modal_order_item{
+    display: flex;
+    flex-direction: row;
+    width: '100%';
+    align-items: center;
+    justify-content: space-between;
+    // position: relative;
+    // background-color: pink;
+    // border-bottom: solid 2px #999999;
+    margin-left: 46px;
+    margin-right: 46px;
+    box-sizing: border-box;
+}
+
+.modal_sel_item{
+    display: flex;
+    flex-direction: row;
+    width: '100%';
+    align-items: center;
+    justify-content: space-between;
+    // background-color: pink;
+    // border-bottom: solid 2px #999999;
+    margin-left: 26px;
+    margin-right: 26px;
+}
+
+.seperate{
+    display: flex;
+    height: 2px;
+    background-color: #fff;
+    opacity: 0.1;
+    -webkit-transform: scaleY(0.5);
+    transform: scaleY(0.5);
+    width: 100%;
+}

+ 195 - 0
src/_health/components/move_list.tsx

@@ -0,0 +1,195 @@
+import { MovableArea, MovableView, View, ScrollView, Text, Image } from '@tarojs/components'
+import './move_list.scss'
+import { useEffect, useRef, useState } from 'react';
+import { ColorType } from '@/context/themes/color';
+import Taro from '@tarojs/taro';
+import { IconDrag } from '@/components/basic/Icons';
+import { rpxToPx } from '@/utils/tools';
+
+export default function MoveList(props: { array: any,components:any, itemHeight: number, color?: string, update: Function }) {
+    const [list, setList] = useState(props.array)
+    const [components,setComponents] = useState(props.components)
+    const [movaleViewY, setMovaleViewY] = useState(0)
+    const [dragElement, setDragElement] = useState(null)
+    const [lastTarget, setLastTarget] = useState(null)
+    const [startOffsetY, setStartOffsetY] = useState(0)
+    const [startPageY, setStartPageY] = useState(0)
+    const [dragIndex, setDragIndex] = useState(-1)
+    const [scrollThreshold, setScrollThreshold] = useState(0.5)
+    const upperThreshold = 100
+    const lowThreshold = 100
+    const [canScroll, setCanScroll] = useState(true)
+    const [changedIndex, setChangedIndex] = useState(-1)
+    const [hiddenContent, setHiddenContent] = useState(false)
+
+    const [scrollTop, setScrollTop] = useState(0)
+    const [contentY, setContentY] = useState(0)
+    const [contentHeight, setContentHeight] = useState(0)
+    const ref = useRef(null)
+
+    useEffect(() => {
+        if (process.env.TARO_ENV == 'weapp') {
+            const query = Taro.createSelectorQuery();
+            query.select('#myScrollView').boundingClientRect();
+            query.exec((res) => {
+                setContentY(res[0].top)
+                setContentHeight(res[0].height)
+            })
+        }
+        else {
+
+        }
+
+    }, [])
+
+    function longPress(e, index) {
+        setChangedIndex(index)
+        setStartOffsetY(e.target.offsetTop)
+        setStartPageY(e.touches[0].pageY)
+        setDragIndex(index)
+        setDragElement(components[index])
+        setMovaleViewY(e.target.offsetTop)
+        setCanScroll(false)
+    }
+
+    function touchMove(e) {
+        if (dragElement) {
+            let clientY = e.touches[0].clientY;
+            pageScroll(clientY);
+            let pageY = e.touches[0].pageY;
+            let targetMoveDistance = pageY - startPageY
+            let movaleViewY2 = startOffsetY + targetMoveDistance
+
+            let targetIndex = computeFutureIndex(targetMoveDistance, dragIndex)
+            if (targetIndex !== false && targetIndex != changedIndex) {
+                var temps = swapListItems(list, targetIndex, changedIndex)
+                setList(temps)
+
+                var temps2 = swapListItems(components, targetIndex, changedIndex)
+                setComponents(temps2)
+                setChangedIndex(targetIndex)
+
+            }
+
+            if (targetIndex === false && targetIndex != changedIndex) {
+                var temps = swapListItems(list, dragIndex, changedIndex)
+                setList(temps)
+
+                var temps2 = swapListItems(components, dragIndex, changedIndex)
+                setComponents(temps2)
+                setChangedIndex(dragIndex)
+            }
+
+            setMovaleViewY(movaleViewY2)
+            setLastTarget(targetIndex as any)
+            setHiddenContent(true)
+        }
+    }
+
+    function pageScroll(clientY) {
+        return
+    }
+
+    function swapListItems<T>(list: T[], index1: number, index2: number): T[] {
+        const newList = [...list];
+        const temp = newList[index1];
+        newList[index1] = newList[index2];
+        newList[index2] = temp;
+
+        return newList;
+    }
+
+
+    function touchEnd(e) {
+        if (dragElement) {
+            setDragElement(null)
+            setLastTarget(null)
+            setDragIndex(-1)
+
+        }
+        setChangedIndex(-1)
+        setCanScroll(true)
+        setHiddenContent(false)
+        setMovaleViewY(-100)
+
+        props.update(list)
+    }
+
+    function computeFutureIndex(targetMoveDistance, dragElementIndex) {
+        let willInsertAfter = getSwapDirection(targetMoveDistance);
+        if (willInsertAfter !== false) {
+            /** 偏移索引 */
+            let offsetElementIndex = dragElementIndex + willInsertAfter;
+            /** 移动步数 */
+            let step = targetMoveDistance / props.itemHeight;
+            /** 步数补偿,当只有移动距离超过单项 _scrollThreshold 时才算有效 */
+            if (step <= -1) {
+                step += scrollThreshold;
+            } else if (step >= 1) {
+                step -= scrollThreshold;
+            }
+            /** 目标索引 */
+            let futureIndex = parseInt(step) + offsetElementIndex;
+
+            // 避免越界
+            if (futureIndex < 0) {
+                futureIndex = 0;
+            } else if (futureIndex > components.length - 1) {
+                futureIndex = components.length - 1;
+            }
+
+            return futureIndex;
+        } else {
+            return willInsertAfter;
+        }
+    }
+
+    function getSwapDirection(targetMoveDistance) {
+        if (Math.abs(targetMoveDistance) < props.itemHeight / 2) {
+            // 轻轻拂动,滑动距离小于1/2单项高度
+            return false;
+        } else if (targetMoveDistance >= props.itemHeight / 2) {
+            // console.log('[_getSwapDirection] 👇👇👇');
+            return 1;  // 下滑
+        } else if (targetMoveDistance <= props.itemHeight / -2) {
+            // console.log('[_getSwapDirection] 👆👆👆');
+            return -1;  // 上滑
+        }
+    }
+    return <View id="myScrollView" ref={ref} style={{ height: '100%', overflow: canScroll ? 'scroll' : 'hidden' }} catchMove>
+        <MovableArea style={{ height: components.length * props.itemHeight, width: rpxToPx(700) }}>
+            <View>
+                {
+                    components.map((item, index) => {
+                        return <View key={index} style={{ opacity: changedIndex == index && hiddenContent ? 0 : 1, height: props.itemHeight, width: rpxToPx(700) }}
+                            onLongPress={(e) => longPress(e, index)}
+                            onTouchMove={(e) => touchMove(e)}
+                            onTouchEnd={(e) => touchEnd(e)}
+                        >
+                            {
+                                item
+                            }
+                        </View>
+                    })
+                }
+
+                <MovableView style={{ height: changedIndex >= 0 ? props.itemHeight : 0, width: rpxToPx(700) }}
+                    direction='vertical'
+                    disabled
+                    animation={false}
+                    y={movaleViewY}
+                >
+                    <View className='drag_item' style={{ backgroundColor: props.color }}>
+                        {
+                            dragIndex >= 0 && <View className='modal_sel_item' style={{ height: props.itemHeight, border: 'none' }}>
+                                {
+                                    components[dragIndex]
+                                }
+                            </View>
+                        }
+                    </View>
+                </MovableView>
+            </View>
+        </MovableArea>
+    </View>
+}

+ 7 - 3
src/_health/pages/guide_sleep.tsx

@@ -170,6 +170,10 @@ export default function GuideSleep() {
         }
     }
 
+    function totalDetail(str){
+        return <View className="g02 h24 bold">{str}</View>
+    }
+
     return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
         <View style={{ height: navigationBarHeight, backgroundColor: MainColorType.g05 }} />
         <View className="navi-bar" style={{ height: navigationBarHeight, zIndex: 1000, backgroundColor: MainColorType.g05 }}>
@@ -243,9 +247,9 @@ export default function GuideSleep() {
                 sleepStatus={StatusType.normal}
                 afterStatus={StatusType.normal}
                 total={calculateTimeDifference(getTime('FAST_START'), getTime('FAST_END'))}
-                total1={calculateTimeDifference(getTime('FAST_START'), getTime('SLEEP_BEDTIME'))}
-                total2={calculateTimeDifference(getTime('SLEEP_BEDTIME'), getTime('SLEEP_WAKE_UP'))}
-                total3={calculateTimeDifference(getTime('SLEEP_WAKE_UP'), getTime('FAST_END'))}
+                total1={totalDetail(calculateTimeDifference(getTime('FAST_START'), getTime('SLEEP_BEDTIME')))}
+                total2={totalDetail(calculateTimeDifference(getTime('SLEEP_BEDTIME'), getTime('SLEEP_WAKE_UP')))}
+                total3={totalDetail(calculateTimeDifference(getTime('SLEEP_WAKE_UP'), getTime('FAST_END')))}
                 showStep={false}
             />
         }

+ 77 - 3
src/_health/pages/schedules_order.tsx

@@ -1,10 +1,19 @@
-import { View } from "@tarojs/components";
+import { View, Text } from "@tarojs/components";
 import { useSelector } from "react-redux";
+import './schedules_edit.scss'
 import './edit.scss'
 import { useState } from "react";
 import { useRouter } from "@tarojs/taro";
 import MoveOrderList from '@/features/trackSomething/components/MoveOrderList'
 import { MainColorType } from "@/context/themes/color";
+import MoveList from "../components/move_list";
+import NewButton, { NewButtonType } from "../base/new_button";
+import { rpxToPx } from "@/utils/tools";
+import NewHeader, { NewHeaderType } from "../components/new_header";
+import StatusIndicator, { StatusType } from "../base/status_indicator";
+import Card from "../components/card";
+import { orderSchedules } from "@/services/health";
+import Taro from "@tarojs/taro";
 
 let useRoute;
 let useNavigation;
@@ -27,11 +36,76 @@ export default function SchedulesOrder() {
     else {
         router = useRouter()
     }
-    
+
     const health = useSelector((state: any) => state.health);
     const [list, setList] = useState(JSON.parse(router.params.list))
+
+    function items() {
+        var array: any = []
+        for (var i = 0; i < list.length; i++) {
+            var obj = list[i]
+            array.push(
+                <View className='schedule_item' style={{ width: rpxToPx(700), height: rpxToPx(128), boxSizing: 'border-box' }}>
+                    <View style={{ display: 'flex', flexDirection: 'column', justifyContent: 'flex-start', flex: 1 }}>
+                        <View className='item_left2'>
+                            <StatusIndicator type={StatusType.normal} color={MainColorType.active} text={obj.title} fontSize={rpxToPx(34)} />
+                        </View>
+                        <View className="h22" style={{ color: MainColorType.g02, marginLeft: rpxToPx(26),marginTop:rpxToPx(10) }}>{obj.time_label}</View>
+                    </View>
+                    {/* {
+                        router.params.type == 'reminder' ? reminder(obj) : editName(item, obj, index, i)
+                    } */}
+
+                    {/* {router.params.type == 'reminder' && (obj.specific_time || health.mode == 'DAY' || health.mode == 'NIGHT') && <Switch checked={obj.reminder}
+                                                color={getThemeColor(obj.window)}
+                                                onChange={e => {
+                                                    if (process.env.TARO_ENV == 'weapp') {
+                                                        e.stopPropagation()
+                                                    }
+
+                                                    obj.reminder = e.detail.value;
+                                                    setList([...list])
+                                                }} />} */}
+                    <View className='border_footer_line' style={{ left: rpxToPx(66), flexShrink: 0 }} />
+
+                </View>
+            )
+        }
+        return array
+    }
+
+    function tapDone() {
+        var array:any = []
+        list.map((item)=>{
+            array.push(item.id)
+        })
+        orderSchedules({ids:array}).then(res=>{
+            global.refreshWindow()
+            if (global.tempRefresh){
+                global.tempRefresh()
+            }
+            Taro.navigateBack()
+        })
+    }
+
     return <View >
+        <NewHeader title="日程设置" type={NewHeaderType.left} />
+        <Card>
+            <MoveList itemHeight={rpxToPx(128)} components={items()} array={list} color="#fff" update={array => {
+                setList(array)
+            }} />
+        </Card>
+        <View className="main_footer">
+            <NewButton
+                type={NewButtonType.fill}
+                title="完成"
+                color={MainColorType.active}
+                width={rpxToPx(670)}
+                height={rpxToPx(96)}
+                onClick={tapDone}
+            />
+        </View>
         {/* <View>hell owl</View> */}
-        <MoveOrderList itemHeight={40} array={list} color={MainColorType.active} update={(temps: any)=>{setList(temps)}}/>
+        {/* <MoveOrderList itemHeight={40} array={list} color={MainColorType.active} update={(temps: any)=>{setList(temps)}}/> */}
     </View>
 }

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

@@ -252,7 +252,7 @@ export default function HistoryItem(props: {
                 paddingBottom: !hasImage ? rpxToPx(12) : 0
             }}>
                 <TimeTitleDesc
-                className={hasImage?'line3':'line2'}
+                    className={hasImage ? 'line3' : 'line2'}
                     timeObj={moment.time}
                     time=''
                     // time={moment.time && dayjs(moment.time.timestamp).format('HH:mm')}
@@ -272,6 +272,62 @@ export default function HistoryItem(props: {
         </View>
         <View className="history_content" style={{ paddingTop: rpxToPx(4) }}>
             {
+                props.data.dataArray.map((content, i) => {
+                    return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i}>
+                        {
+                            content.type == 'TEXT' && <View style={{
+                                display: 'flex',
+                                flex: 1,
+                                flexShrink: 0,
+                                flexDirection: 'column',
+                                backgroundColor: '#fafafa',
+                                paddingLeft: rpxToPx(20),
+                                paddingRight: rpxToPx(20),
+                                paddingTop: rpxToPx(12),
+                                paddingBottom: rpxToPx(12)
+                            }}>{content.data.map((detail, j) => {
+                                return <TimeTitleDesc
+                                    key={j * 100}
+                                    className={'line2'}
+                                    time=''
+                                    title={detail.title}
+                                    desc={detail.description}
+                                />
+                            })}</View>
+                        }
+                        {
+                            content.type == 'PIC' && <CoverList imgs={content.data} count={content.data.length}/>
+                        }
+                        {
+                            content.type == 'PIC_TEXT' && <Image
+                                style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
+                                src={content.data[0].url}
+                                mode="aspectFill" />
+                        }
+                        {
+                            content.type == 'PIC_TEXT' && <View style={{
+                                display: 'flex',
+                                flex: 1,
+                                flexShrink: 0,
+                                flexDirection: 'column',
+                                backgroundColor: 'transparent',
+                                paddingLeft: rpxToPx(17),
+                                paddingRight: 0,
+                                paddingTop: 0,
+                                paddingBottom:  0
+                            }}>
+                                <TimeTitleDesc
+                                    className={'line3'}
+                                    time=''
+                                    title={content.data[0].title}
+                                    desc={content.data[0].description}
+                                />
+                            </View>
+                        }
+                    </View>
+                })
+            }
+            {/* {
                 props.data.events.map((event, i) => {
                     return event.moments && event.moments.map((moment, j) => {
                         return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i * 100 + j}>
@@ -287,7 +343,7 @@ export default function HistoryItem(props: {
                         </View>
                     })
                 })
-            }
+            } */}
 
             {/* <View style={{ display: 'flex', flexDirection: 'column', marginBottom: rpxToPx(12), flex: 1, paddingTop: rpxToPx(4) }}>
                 {

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

@@ -34,6 +34,8 @@ let min = 0
 let max = 0
 let defaultTimestamp = 0
 
+let lastFastSleepStatus = ''
+
 if (process.env.TARO_ENV == 'rn') {
     useNavigation = require("@react-navigation/native").useNavigation
 }
@@ -45,6 +47,7 @@ export default function MainConsole(props: { type: WindowType }) {
     const [btnDisable, setBtnDisable] = useState(false)
     const [selItem, setSelItem] = useState<any>(null)
     const [hideGuideTip, setHideGuideTip] = useState(false)
+    const [hideErrorTip, setHideErrorTip] = useState(false)
     const { t } = useTranslation()
     const dispatch = useDispatch()
 
@@ -58,6 +61,17 @@ export default function MainConsole(props: { type: WindowType }) {
 
     }, [props.type])
 
+    //
+    useEffect(() => {
+        if (health.fast_with_sleep.status == 'OG2_MISALIGNED' || health.fast_with_sleep.status == 'OG2_NO1') {
+            if (lastFastSleepStatus != health.fast_with_sleep.status) {
+                setHideErrorTip(false)
+            }
+        }
+        lastFastSleepStatus = health.fast_with_sleep.status
+
+    }, [health.fast_with_sleep.status])
+
     global.chooseLocation = () => {
         chooseLocation()
     }
@@ -793,6 +807,21 @@ export default function MainConsole(props: { type: WindowType }) {
         return '#000'
     }
 
+    function polarCheck() {
+        const scenario = getScenario(health.windows, health.mode)
+        if (health.mode == 'DAY' && scenario.extra && scenario.extra.is_polar_day) {
+            return <View className="console_tag_bg" style={{ backgroundColor: getThemeColor(health.mode) }}>
+                <Image src={global.language == 'en' ? require('@assets/_health/tag_polar.png') : require('@assets/_health/tag_polar_day.png')} className="console_tag_img" />
+            </View>
+        }
+        if (health.mode == 'NIGHT' && scenario.extra && scenario.extra.is_polar_night) {
+            return <View className="console_tag_bg" style={{ backgroundColor: getThemeColor(health.mode) }}>
+                <Image src={global.language == 'en' ? require('@assets/_health/tag_polar.png') : require('@assets/_health/tag_polar_night.png')} className="console_tag_img" />
+            </View>
+        }
+
+    }
+
     function ogTime() {
         return <View className="time_count h30 bold" style={{
             backgroundColor: getThemeColor(health.mode)
@@ -812,7 +841,9 @@ export default function MainConsole(props: { type: WindowType }) {
             <View className="main_summary_time h30 bold" style={{
                 marginTop: rpxToPx(14),
                 // color: getTitleColor()
-            }} >{getScenario(health.windows, health.mode).status == 'OG' ? ogTime() : getDuration(health.windows, health.mode)}
+            }} >
+                {polarCheck()}
+                {getScenario(health.windows, health.mode).status == 'OG' ? ogTime() : getDuration(health.windows, health.mode)}
             </View>
             <Text className="main_summary_duration g01"
                 style={{
@@ -910,6 +941,10 @@ export default function MainConsole(props: { type: WindowType }) {
                             })
                             return
                         }
+                        setTimeout(() => {
+                            setHideErrorTip(true)
+                        }, 1000)
+
                         jumpPage('/_health/pages/fast_sleep')
                     }}
                     showLine={health.mode == 'FAST'}
@@ -920,7 +955,7 @@ export default function MainConsole(props: { type: WindowType }) {
                             fastWithSleepStatus()
                         }
                         {
-                            (health.fast_with_sleep.status == 'OG2_MISALIGNED' || health.fast_with_sleep.status == 'OG2_NO1') && <View style={{
+                            !hideErrorTip && (health.fast_with_sleep.status == 'OG2_MISALIGNED' || health.fast_with_sleep.status == 'OG2_NO1') && <View style={{
                                 backgroundColor: MainColorType.error,
                                 width: rpxToPx(12),
                                 height: rpxToPx(12),

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

@@ -145,17 +145,107 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
         setPage(index)
         setLoading(true)
         records(params).then(res => {
+            var array = (res as any).data
+
+            array.map(item => {
+                var temps: any = []
+                var lastType = ''
+                var lastTextArray: any = []
+                var lastImageArray: any = []
+                item.events.map(event => {
+                    event.moments && event.moments.map(moment => {
+                        switch (moment.type) {
+                            case 'TEXT':
+                                {
+                                    lastTextArray.push({
+                                        title: moment.title,
+                                        description: moment.description
+                                    })
+                                    if (lastType == 'PIC') {
+                                        temps.push({
+                                            type: 'PIC',
+                                            data: JSON.parse(JSON.stringify(lastImageArray))
+                                        })
+                                        lastImageArray = []
+                                    }
+                                    lastType = 'TEXT'
+                                }
+                                break;
+                            case 'PIC':
+                                {
+                                    lastImageArray.push(moment.media[0].url)
+                                    if (lastType == 'TEXT') {
+                                        temps.push({
+                                            type: 'TEXT',
+                                            data: JSON.parse(JSON.stringify(lastTextArray))
+                                        })
+                                        lastTextArray = []
+                                    }
+                                    lastType = 'PIC'
+                                }
+                                break;
+                            case 'PIC_TEXT':
+                                if (lastType == 'PIC') {
+                                    temps.push({
+                                        type: 'PIC',
+                                        data: JSON.parse(JSON.stringify(lastImageArray))
+                                    })
+                                    lastImageArray = []
+                                }
+                                if (lastType == 'TEXT') {
+                                    temps.push({
+                                        type: 'TEXT',
+                                        data: JSON.parse(JSON.stringify(lastTextArray))
+                                    })
+                                    lastTextArray = []
+                                }
+                                temps.push({
+                                    type: 'PIC_TEXT',
+                                    data: [
+                                        {
+                                            title: moment.title,
+                                            description: moment.description,
+                                            url: moment.media[0].url
+                                        }
+                                    ]
+                                })
+                                lastType = 'PIC_TEXT'
+                                break;
+                        }
+                    })
+                })
+
+                if (lastType == 'PIC') {
+                    temps.push({
+                        type: 'PIC',
+                        data: JSON.parse(JSON.stringify(lastImageArray))
+                    })
+                    lastImageArray = []
+                }
+                if (lastType == 'TEXT') {
+                    temps.push({
+                        type: 'TEXT',
+                        data: JSON.parse(JSON.stringify(lastTextArray))
+                    })
+                    lastTextArray = []
+                }
+
+                item.dataArray = temps;
+            })
+
+            debugger
+
             setLoading(false)
             setLoaded(true)
             if (index == 1) {
-                setList((res as any).data)
+                setList(array)
                 setTotal((res as any).total)
                 if (props.refreshSuccess) {
                     props.refreshSuccess()
                 }
             }
             else {
-                setList([...list, ...(res as any).data])
+                setList([...list, ...array])
             }
 
             // if ((res as any).data.length > 0) {
@@ -207,6 +297,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
         return <View />
     }
 
+
     function hideLine(index) {
         var currentDate = dayjs(list[index].window_range.start_timestamp).format('YYYY年M月D日')
         if (list.length > index + 1) {

+ 1 - 1
src/features/journal/components/journal_cover.tsx

@@ -6,7 +6,7 @@ import { rpxToPx } from '@/utils/tools'
 
 export default function JournalCover(props: { imgs: any }) {
 
-    const scale = '?x-oss-process=image/resize,w_100,limit_0'
+    const scale = '?x-oss-process=image/resize,w_200,limit_0'
 
     function content() {
         switch (props.imgs.length) {

+ 14 - 1
src/services/health.tsx

@@ -1,4 +1,4 @@
-import { API_ACTIVE_MOVES, API_ACTIVE_MOVES_CURRENT, API_ACTIVE_MOVES_SCHEDULES, API_HEALTH_ARCHIVED, API_HEALTH_CLOCK, API_HEALTH_EVENTS, API_HEALTH_FAST_SLEEP, API_HEALTH_LABELS_EVENT, API_HEALTH_LABELS_TIME, API_HEALTH_MOMENT, API_HEALTH_RECORD, API_HEALTH_SCHEDULES, API_HEALTH_STREAKS, API_HEALTH_WINDOWS, API_HEALTH_FAST, API_ME_ALBUMS, API_ME_ALBUMS_STAT, API_ME_JOURNALS } from "./http/api";
+import { API_ACTIVE_MOVES, API_ACTIVE_MOVES_CURRENT, API_ACTIVE_MOVES_SCHEDULES, API_HEALTH_ARCHIVED, API_HEALTH_CLOCK, API_HEALTH_EVENTS, API_HEALTH_FAST_SLEEP, API_HEALTH_LABELS_EVENT, API_HEALTH_LABELS_TIME, API_HEALTH_MOMENT, API_HEALTH_RECORD, API_HEALTH_SCHEDULES, API_HEALTH_STREAKS, API_HEALTH_WINDOWS, API_HEALTH_FAST, API_ME_ALBUMS, API_ME_ALBUMS_STAT, API_ME_JOURNALS, API_HEALTH_SCHEDULES_ORDERS } from "./http/api";
 import { request } from "./http/request";
 
 export const getLabelsEvent = (params) => {
@@ -53,6 +53,19 @@ export const createSchedule = (params) => {
     })
 }
 
+export const orderSchedules = (params) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_HEALTH_SCHEDULES_ORDERS, method: 'POST', data: { ...params }
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
+    })
+}
+
 export const updateSchedule = (params, id) => {
     return new Promise((resolve, reject) => {
         request({

+ 1 - 0
src/services/http/api.js

@@ -98,6 +98,7 @@ export const API_SET_SCHEDULE = `${baseUrl}/api/fast/schedules`
 export const API_HEALTH_FAST_SLEEP = `${baseUrl}/api/health/fast-with-sleep`
 export const API_HEALTH_MOMENT = `${baseUrl}/api/health/moments`
 export const API_HEALTH_SCHEDULES = `${baseUrl}/api/health/schedules`
+export const API_HEALTH_SCHEDULES_ORDERS = `${baseUrl}/api/health/schedules/batch/sort`
 export const API_HEALTH_LABELS_EVENT = `${baseUrl}/api/health/labels/event`
 export const API_HEALTH_LABELS_TIME = `${baseUrl}/api/health/labels/time`
 export const API_HEALTH_RECORD = `${baseUrl}/api/health/records`