Leon 1 год назад
Родитель
Сommit
08a5e0f38b

+ 22 - 17
src/_health/components/add_label.tsx

@@ -7,10 +7,13 @@ import dayjs from "dayjs";
 import { MainColorType } from "@/context/themes/color";
 import { createSchedule } from "@/services/health";
 import Taro from "@tarojs/taro";
+import { useSelector } from "react-redux";
+import { getThemeColor } from "@/features/health/hooks/health_hooks";
 
 export default function AddLabel(props: { labels: any }) {
-    const [showTimePicker,setShowTimePicker] = useState(false)
-    const [value,setValue] = useState('')
+    const [showTimePicker, setShowTimePicker] = useState(false)
+    const health = useSelector((state: any) => state.health);
+    const [value, setValue] = useState('')
 
     function timeContent() {
         return <Modal
@@ -25,10 +28,10 @@ export default function AddLabel(props: { labels: any }) {
         </Modal>
     }
 
-    function pickerContent(){
+    function pickerContent() {
         const strTime = dayjs().format('HH:mm')
         return <TimePicker time={strTime}
-            color={MainColorType.eat}
+            color={getThemeColor(health.mode)}
             title='开始时间'
             confirm={(e) => {
                 confirmPickerTime(e)
@@ -38,36 +41,38 @@ export default function AddLabel(props: { labels: any }) {
             }} />
     }
 
-    function confirmPickerTime(e){
+    function confirmPickerTime(e) {
         console.log(e)
         createSchedule({
-            
-            event:'EAT_CUSTOM',
-            title:value,
-            time:e,is_all_day:false
-        }).then(res=>{
+
+            schedules: [{
+                event: health.mode == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM',
+                title: value,
+                time: e, is_all_day: false
+            }]
+        }).then(res => {
             global.refreshWindow()
-            if (process.env.TARO_ENV=='weapp'){
+            if (process.env.TARO_ENV == 'weapp') {
                 Taro.navigateBack()
             }
         })
     }
-    
+
     return <View>
         <View className="header1">标记为</View>
         <View className="body1">
-            <Input className="input_lb" placeholder="选择或输入标签" value={value} onInput={(e:any)=>{
+            <Input className="input_lb" placeholder="选择或输入标签" value={value} onInput={(e: any) => {
                 setValue(e.target.value)
-            }}/>
+            }} />
             <View className="label_bg">
                 {
-                    props.labels.map((item,index)=>{
-                        return <View className="label" key={index} onClick={()=>setValue(item.label)}>{item.label}</View>
+                    props.labels.map((item, index) => {
+                        return <View className="label" key={index} onClick={() => setValue(item.label)}>{item.label}</View>
                     })
                 }
             </View>
         </View>
-        <View className="pop_footer" onClick={()=>setShowTimePicker(true)}>下一步</View>
+        <View className="pop_footer" style={{ backgroundColor: getThemeColor(health.mode) }} onClick={() => setShowTimePicker(true)}>下一步</View>
         {
             showTimePicker && timeContent()
         }

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

@@ -82,9 +82,9 @@ export default function AddMoment() {
     }
 
     function duration() {
-        const seconds = moment.target.duration/1000
-        var hours = Math.floor(seconds/3600)
-        var minutes = Math.floor((seconds%3600)/60)
+        const seconds = moment.target.duration / 1000
+        var hours = Math.floor(seconds / 3600)
+        var minutes = Math.floor((seconds % 3600) / 60)
         // const { hours, minutes } = getIntervalHoursAndMinutes(meal.schedule_end_time, meal.schedule_start_time)
         var time = ''
         if (hours > 0) {
@@ -139,7 +139,7 @@ export default function AddMoment() {
             // real_end_time: meal.target_end_time,
         }
 
-        if (title.length>0){
+        if (title.length > 0) {
             params.title = title
         }
 
@@ -155,7 +155,7 @@ export default function AddMoment() {
         if (moment.event_id) {
             params.event_id = moment.event_id
         }
-        if (moment.target.duration){
+        if (moment.target.duration) {
             params.duration = moment.target.duration
         }
         createMoment(params).then(res => {
@@ -292,10 +292,10 @@ export default function AddMoment() {
             <View className="addmoment_header">
                 <Text className="header_time" onClick={tapTime} style={{ color: getThemeColor(health.mode) }}>{dayjs(moment.target.timestamp).format('HH:mm')}</Text>
                 {
-                    health.mode == 'EAT' && <View className="header_line"/>
+                    (health.mode == 'EAT' || health.mode == 'ACTIVE') && <View className="header_line" />
                 }
                 {
-                    health.mode == 'EAT' && <Text className="header_time" style={{ color: getThemeColor(health.mode) }} onClick={tapDuration}>{duration()}</Text>
+                    (health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text className="header_time" style={{ color: getThemeColor(health.mode) }} onClick={tapDuration}>{duration()}</Text>
                 }
             </View>
         }

+ 0 - 0
src/_health/pages/change_times.tsx


+ 0 - 0
src/_health/pages/edit.scss


+ 3 - 2
src/_health/pages/edit_schedule.scss

@@ -7,14 +7,15 @@
 }
 
 .item {
-    margin-left: 46px;
-    margin-right: 46px;
+    padding-left: 46px;
+    padding-right: 46px;
     height: 114px;
     align-items: center;
     display: flex;
     flex-direction: row;
     align-items: center;
     position: relative;
+    background-color: #fff;
 }
 
 .item_line{

+ 56 - 21
src/_health/pages/edit_schedule.tsx

@@ -6,6 +6,8 @@ import AddLabel from '../components/add_label'
 import { delSchedule, getLabels, getSchedules } from '@/services/health'
 import { AtSwipeAction } from "taro-ui"
 import { useSelector } from 'react-redux'
+import { getThemeColor } from '@/features/health/hooks/health_hooks'
+import showActionSheet from '@/components/basic/ActionSheet'
 
 
 export default function EditSchedule() {
@@ -14,14 +16,15 @@ export default function EditSchedule() {
     const [labels, setLabels] = useState<any>([])
     const [showDel, setShowDel] = useState(false)
     const health = useSelector((state: any) => state.health);
+    let navigation, showActionSheetWithOptions;
 
     useEffect(() => {
         schedules()
     }, [])
 
     function schedules() {
-        getSchedules({ window: health.mode,is_all_day:false }).then(res => {
-            console.log('sss',res)
+        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
+            console.log('sss', res)
             if ((res as any).data && (res as any).data.length > 0) {
                 setList((res as any).data)
             }
@@ -29,7 +32,7 @@ export default function EditSchedule() {
 
         })
 
-        getLabels({ window: 'EAT' }).then(res => {
+        getLabels({ window: health.mode }).then(res => {
             setLabels((res as any).labels)
         })
     }
@@ -46,6 +49,33 @@ export default function EditSchedule() {
         })
     }
 
+    function tapEdit() {
+        let array:any = []
+        switch(health.mode){
+            case 'DAY':
+            case 'NIGHT':
+                array = ['设置提醒']
+                break
+            case 'FAST':
+            case 'SLEEP':
+                array = ['调整时间','设置提醒']
+                break;
+            case 'EAT':
+            case 'ACTIVE':
+                array = ['调整时间','设置提醒','编辑标记','删除']
+                break;
+            
+        }
+        showActionSheet({
+            showActionSheetWithOptions: showActionSheetWithOptions,
+            title: 'Oprate Title',
+            itemList: array,
+            success: (res) => {
+                // tapActionSheet(res)
+            }
+        })
+    }
+
     return <View>
         {
             list.map((item, index) => {
@@ -57,31 +87,36 @@ export default function EditSchedule() {
                 //         }
                 //     }
                 // ]}>
-                return    <View className='item' key={index}>
+                return <View className='item' key={index}>
+                    {
+                        showDel && <Text style={{ color: 'red', marginRight: 5 }} onClick={() => delItem(index)}>删除</Text>
+                    }
+
+                    <View className='item_left'>
                         {
-                            showDel && <Text style={{ color: 'red', marginRight: 5 }} onClick={() => delItem(index)}>删除</Text>
+                            health.mode == 'EAT' && <Text className='item_index'>第{index + 1}餐</Text>
                         }
-        
-                        <View className='item_left'>
-                            {
-                                health.mode == 'EAT' && <Text className='item_index'>第{index + 1}餐</Text>
-                            }
-                            
-                            <Text className='item_name'>{item.title}</Text>
-                        </View>
-                        <Text className='item_time'>{item.time}</Text>
-                        <View className='item_line' />
+
+                        <Text className='item_name'>{item.title}</Text>
                     </View>
+                    <Text className='item_time'>{item.time}</Text>
+                    <View className='item_line' />
+                </View>
                 // </AtSwipeAction>
             })
         }
-        
 
-        <View className='toolbar'>
-            <View className='toolbar_btn' onClick={add}>添加一餐</View>
-            <View style={{ flex: 1 }} />
-            <View className='toolbar_btn' onClick={() => setShowDel(!showDel)}>移除</View>
-        </View>
+
+        {
+            (health.mode == 'EAT' || health.mode == 'ACTIVE') && <View className='toolbar'>
+                <View className='toolbar_btn' style={{ color: getThemeColor(health.mode) }} onClick={add}>添加</View>
+                <View style={{ flex: 1 }} />
+                <View className='toolbar_btn' style={{ color: getThemeColor(health.mode) }} onClick={() => setShowDel(!showDel)}>移除</View>
+            </View>
+        }
+
+        <Text onClick={tapEdit}>批量编辑</Text>
+
         {
             showModal && <Modal testInfo={null}
                 dismiss={() => {

+ 77 - 0
src/_health/pages/schedules_del.tsx

@@ -0,0 +1,77 @@
+import showAlert from "@/components/basic/Alert";
+import { IconRemove } from "@/components/basic/Icons";
+import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
+import { createSchedule, delSchedules, getSchedules } from "@/services/health";
+import { View, Text } from "@tarojs/components";
+import Taro from "@tarojs/taro";
+import { useEffect, useState } from "react";
+import { useSelector } from "react-redux";
+
+export default function SchedulesDel() {
+    const health = useSelector((state: any) => state.health);
+    const [scenario, setScenario] = useState(getScenario(health.windows, health.mode))
+    const [showTimePicker, setShowTimePicker] = useState(false)
+    const [list, setList] = useState<any>([])
+    const [selItem, setSelItem] = useState<any>(null)
+    const [ids,setIds] = useState<any>([])
+
+    useEffect(() => {
+        schedules()
+    }, [])
+
+    function schedules() {
+        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
+            if ((res as any).data && (res as any).data.length > 0) {
+                setList((res as any).data)
+            }
+        }).catch(e => {
+
+        })
+    }
+
+    function save() {
+
+
+        delSchedules(ids).then(res => {
+            global.refreshWindow()
+            global.refreshSchedules()
+            if (process.env.TARO_ENV == 'weapp') {
+                Taro.navigateBack()
+            }
+        })
+    }
+
+    function del(index){
+        showAlert({
+            title:'删除',
+            content:'确认删除吗?',
+            showCancel:true,
+            confirm:()=>{
+                var tempList = JSON.parse(JSON.stringify(ids))
+                tempList.push(list[index].id)
+                setIds(tempList)
+
+                var array = JSON.parse(JSON.stringify(list))
+                array.splice(index,1)
+                setList(array)
+            }
+        })
+    }
+
+    if (list.length == 0) return <View />
+
+    return <View>
+        {
+            list.map((item, index) => {
+                return <View key={index} >
+                    <Text>{index + 1}</Text>
+                    <Text>{item.title}</Text>
+                    <View onClick={()=>del(index)}>
+                        <IconRemove width={24} color={getThemeColor(health.mode)} />
+                    </View>
+                </View>
+            })
+        }
+        <View style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={save}>完成</View>
+    </View>
+}

+ 65 - 0
src/_health/pages/schedules_list.scss

@@ -0,0 +1,65 @@
+@import "~taro-ui/dist/style/components/swipe-action.scss";
+
+.container {
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+}
+
+.item {
+    padding-left: 46px;
+    padding-right: 46px;
+    height: 114px;
+    align-items: center;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    position: relative;
+    background-color: #fff;
+}
+
+.item_line{
+    height: 2px;
+    background-color: #B2B2B2;
+    transform: scaleY(0.5);
+    position: absolute;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.item_left{
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+}
+
+.item_index{
+    color: #B2B2B2;
+    font-size: 18px;
+}
+
+.item_name{
+    color: #4D4D4D;
+    font-size: 34px;
+}
+
+.item_time{
+    color: #B2B2B2;
+    font-size: 34px;
+}
+
+.toolbar{
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    margin-top: 20px;
+    margin-bottom: 20px;
+    padding-left: 46px;
+    padding-right: 46px;
+}
+
+.toolbar_btn{
+    color: #FF751A;
+    font-size: 30px;
+}

+ 161 - 0
src/_health/pages/schedules_list.tsx

@@ -0,0 +1,161 @@
+import { View, Text } from '@tarojs/components'
+import './schedules_list.scss'
+import { useEffect, useState } from 'react'
+import Modal from '@/components/layout/Modal.weapp'
+import AddLabel from '../components/add_label'
+import { delSchedule, getLabels, getSchedules } from '@/services/health'
+import { AtSwipeAction } from "taro-ui"
+import { useSelector } from 'react-redux'
+import { getThemeColor } from '@/features/health/hooks/health_hooks'
+import showActionSheet from '@/components/basic/ActionSheet'
+import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
+
+
+export default function SchedulesList() {
+    const [showModal, setShowModal] = useState(false)
+    const [list, setList] = useState<any>([])
+    const [labels, setLabels] = useState<any>([])
+    const [showDel, setShowDel] = useState(false)
+    const health = useSelector((state: any) => state.health);
+    let navigation, showActionSheetWithOptions;
+
+    useEffect(() => {
+        schedules()
+    }, [])
+
+    global.refreshSchedules = ()=>{
+        schedules()
+    }
+
+    function schedules() {
+        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
+            console.log('sss', res)
+            if ((res as any).data && (res as any).data.length > 0) {
+                setList((res as any).data)
+            }
+        }).catch(e => {
+
+        })
+
+        getLabels({ window: health.mode }).then(res => {
+            setLabels((res as any).labels)
+        })
+    }
+
+    function add() {
+        setShowModal(true)
+    }
+
+    function delItem(index) {
+        delSchedule(list[index].id).then(res => {
+            schedules()
+            global.refreshWindow()
+            global.refreshHistory()
+        })
+    }
+
+    function tapEdit() {
+        let array: any = []
+        switch (health.mode) {
+            case 'DAY':
+            case 'NIGHT':
+                array = ['设置提醒']
+                break
+            case 'FAST':
+            case 'SLEEP':
+                array = ['调整时间', '设置提醒']
+                break;
+            case 'EAT':
+            case 'ACTIVE':
+                array = ['调整时间', '设置提醒', '编辑标记', '删除']
+                break;
+
+        }
+        showActionSheet({
+            showActionSheetWithOptions: showActionSheetWithOptions,
+            title: 'Oprate Title',
+            itemList: array,
+            success: (res) => {
+                tapActionSheet(res)
+            }
+        })
+    }
+
+    function tapActionSheet(index) {
+        const mode = health.mode;
+        switch (index) {
+            case 0:
+                switch (mode) {
+                    case 'DAY':
+                    case 'NIGHT':
+                        jumpPage('/_health/pages/schedules_reminder')
+                        break;
+                    default:
+                        jumpPage('/_health/pages/schedules_time')
+                        break;
+                }
+                break;
+            case 1:
+                jumpPage('/_health/pages/schedules_reminder')
+                break;
+            case 2:
+                jumpPage('/_health/pages/schedules_mark')
+                break;
+            case 3:
+                jumpPage('/_health/pages/schedules_del')
+                break;
+        }
+    }
+
+    return <View>
+        {
+            list.map((item, index) => {
+                // return <AtSwipeAction key={index} isOpened options={[
+                //     {
+                //         text: '删除',
+                //         style: {
+                //             backgroundColor: '#FF4949'
+                //         }
+                //     }
+                // ]}>
+                return <View className='item' key={index}>
+                    {
+                        showDel && <Text style={{ color: 'red', marginRight: 5 }} onClick={() => delItem(index)}>删除</Text>
+                    }
+
+                    <View className='item_left'>
+                        {
+                            health.mode == 'EAT' && <Text className='item_index'>第{index + 1}餐</Text>
+                        }
+
+                        <Text className='item_name'>{item.title}</Text>
+                    </View>
+                    <Text className='item_time'>{item.time}</Text>
+                    <View className='item_line' />
+                </View>
+                // </AtSwipeAction>
+            })
+        }
+
+
+        {
+            (health.mode == 'EAT' || health.mode == 'ACTIVE') && <View className='toolbar'>
+                <View className='toolbar_btn' style={{ color: getThemeColor(health.mode) }} onClick={add}>添加</View>
+                <View style={{ flex: 1 }} />
+                <View className='toolbar_btn' style={{ color: getThemeColor(health.mode) }} onClick={() => setShowDel(!showDel)}>移除</View>
+            </View>
+        }
+
+        <Text onClick={tapEdit}>批量编辑</Text>
+
+        {
+            showModal && <Modal testInfo={null}
+                dismiss={() => {
+                    setShowModal(false)
+                }}
+                confirm={() => { }}>
+                <AddLabel labels={labels} />
+            </Modal>
+        }
+    </View>
+}

+ 69 - 0
src/_health/pages/schedules_mark.tsx

@@ -0,0 +1,69 @@
+import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
+import { createSchedule, getSchedules } from "@/services/health";
+import { View,Text, Input } from "@tarojs/components";
+import Taro from "@tarojs/taro";
+import { useEffect, useState } from "react";
+import { useSelector } from "react-redux";
+
+export default function SchedulesMark() {
+    const health = useSelector((state: any) => state.health);
+    const [scenario, setScenario] = useState(getScenario(health.windows, health.mode))
+    const [showTimePicker, setShowTimePicker] = useState(false)
+    const [list, setList] = useState<any>([])
+    const [selItem, setSelItem] = useState<any>(null)
+
+    useEffect(() => {
+        schedules()
+    }, [])
+
+    function schedules() {
+        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
+            if ((res as any).data && (res as any).data.length > 0) {
+                setList((res as any).data)
+            }
+        }).catch(e => {
+
+        })
+    }
+
+    function save() {
+        var array:any = []
+        list.map((item)=>{
+            array.push({
+                id:item.id,
+                time:item.time,
+                event:item.event,
+                title:item.title,
+                reminder_enabled:item.reminder_enabled
+            })
+        })
+
+        createSchedule({
+
+            schedules: array
+        }).then(res => {
+            global.refreshWindow()
+            global.refreshSchedules()
+            if (process.env.TARO_ENV == 'weapp') {
+                Taro.navigateBack()
+            }
+        })
+    }
+
+    if (list.length == 0) return <View />
+
+    return <View>
+        {
+            list.map((item, index) => {
+                return <View key={index} >
+                    <Text>{index + 1}</Text>
+                    <Input value={item.title} onInput={(e)=>{
+                        item.title = e.detail.value;
+                        setList([...list])
+                    }}/>
+                </View>
+            })
+        }
+        <View style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={save}>完成</View>
+    </View>
+}

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

@@ -0,0 +1,7 @@
+import { View } from "@tarojs/components";
+import { useSelector } from "react-redux";
+
+export default function SchedulesOrder() {
+    const health = useSelector((state: any) => state.health);
+    return <View></View>
+}

+ 70 - 0
src/_health/pages/schedules_reminder.tsx

@@ -0,0 +1,70 @@
+import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
+import { createSchedule, getSchedules } from "@/services/health";
+import { View, Text, Switch } from "@tarojs/components";
+import Taro from "@tarojs/taro";
+import { useEffect, useState } from "react";
+import { useSelector } from "react-redux";
+
+export default function SchedulesReminder() {
+    const health = useSelector((state: any) => state.health);
+    const [scenario, setScenario] = useState(getScenario(health.windows, health.mode))
+    const [showTimePicker, setShowTimePicker] = useState(false)
+    const [list, setList] = useState<any>([])
+    const [selItem, setSelItem] = useState<any>(null)
+
+    useEffect(() => {
+        schedules()
+    }, [])
+
+    function schedules() {
+        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
+            if ((res as any).data && (res as any).data.length > 0) {
+                setList((res as any).data)
+            }
+        }).catch(e => {
+
+        })
+    }
+
+    function save() {
+        var array:any = []
+        list.map((item)=>{
+            array.push({
+                id:item.id,
+                time:item.time,
+                event:item.event,
+                title:item.title,
+                reminder_enabled:item.reminder_enabled
+            })
+        })
+
+        createSchedule({
+
+            schedules: array
+        }).then(res => {
+            global.refreshWindow()
+            global.refreshSchedules()
+            if (process.env.TARO_ENV == 'weapp') {
+                Taro.navigateBack()
+            }
+        })
+    }
+
+    if (list.length == 0) return <View />
+
+    return <View>
+        {
+            list.map((item, index) => {
+                return <View key={index} >
+                    <Text>{index + 1}</Text>
+                    <Text>{item.title}</Text>
+                    <Switch checked={item.reminder_enabled} onChange={(e)=>{
+                        item.reminder_enabled = e.detail.value
+                        setList([...list])
+                    }}/>
+                </View>
+            })
+        }
+        <View style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={save}>完成</View>
+    </View>
+}

+ 109 - 0
src/_health/pages/schedules_time.tsx

@@ -0,0 +1,109 @@
+import Modal from "@/components/layout/Modal.weapp";
+import TimePicker from "@/features/common/TimePicker";
+import { getScenario, getThemeColor } from "@/features/health/hooks/health_hooks";
+import { createSchedule, getSchedules } from "@/services/health";
+import { View, Text } from "@tarojs/components";
+import Taro from "@tarojs/taro";
+import { useEffect, useState } from "react";
+import { useSelector } from "react-redux";
+
+export default function SchedulesTime() {
+    const health = useSelector((state: any) => state.health);
+    const [scenario, setScenario] = useState(getScenario(health.windows, health.mode))
+    const [showTimePicker, setShowTimePicker] = useState(false)
+    const [list, setList] = useState<any>([])
+    const [selItem, setSelItem] = useState<any>(null)
+
+    useEffect(() => {
+        schedules()
+    }, [])
+
+    function schedules() {
+        getSchedules({ window: health.mode, is_all_day: false }).then(res => {
+            if ((res as any).data && (res as any).data.length > 0) {
+                setList((res as any).data)
+            }
+        }).catch(e => {
+
+        })
+    }
+
+    function changeTime(item) {
+        setSelItem(item)
+        setShowTimePicker(true)
+    }
+
+    function modalContent() {
+        const strTime = selItem.time
+
+        var title = selItem.title
+        var color = getThemeColor(health.mode)
+
+        return <TimePicker time={strTime}
+            color={color}
+            title={title}
+            confirm={(e) => {
+                confirmPickerTime(e)
+            }}
+            cancel={() => {
+                setShowTimePicker(false)
+            }} />
+    }
+
+    function confirmPickerTime(e) {
+        console.log(e)
+        setShowTimePicker(false)
+        selItem.time = e;
+        setList([...list])
+    }
+
+    function save() {
+        var array:any = []
+        list.map((item)=>{
+            array.push({
+                id:item.id,
+                time:item.time,
+                event:item.event,
+                title:item.title
+            })
+        })
+
+        createSchedule({
+
+            schedules: array
+        }).then(res => {
+            global.refreshWindow()
+            global.refreshSchedules()
+            if (process.env.TARO_ENV == 'weapp') {
+                Taro.navigateBack()
+            }
+        })
+    }
+
+    if (list.length == 0) return <View />
+
+    return <View>
+        {
+            list.map((item, index) => {
+                return <View key={index} onClick={() => changeTime(item)}>
+                    <Text>{index + 1}</Text>
+                    <Text>{item.title}</Text>
+                    <Text>{item.time}</Text>
+                </View>
+            })
+        }
+        <View style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={save}>完成</View>
+        {
+            showTimePicker && <Modal
+                testInfo={null}
+                dismiss={() => {
+                    setShowTimePicker(false)
+                }}
+                confirm={() => { }}>
+                {
+                    modalContent()
+                }
+            </Modal>
+        }
+    </View>
+}

+ 6 - 1
src/app.config.ts

@@ -46,7 +46,12 @@ const appConfig = defineAppConfig({
       root: '_health',
       pages: [
         'pages/add_moment',
-        'pages/edit_schedule',
+        'pages/schedules_list',
+        'pages/schedules_del',
+        'pages/schedules_mark',
+        'pages/schedules_order',
+        'pages/schedules_reminder',
+        'pages/schedules_time',
         'pages/setting_reminder'
       ]
     }

Разница между файлами не показана из-за своего большого размера
+ 2 - 6
src/components/basic/Icons.tsx


+ 12 - 8
src/features/health/MainConsole.tsx

@@ -95,7 +95,7 @@ export default function MainConsole(props: { type: WindowType }) {
                 return;
 
         }
-        jumpPage('/_health/pages/clock/add_moment?moment=' + JSON.stringify(item))
+        jumpPage('/_health/pages/add_moment?moment=' + JSON.stringify(item))
     }
 
     function operateTitle(item) {
@@ -185,7 +185,7 @@ export default function MainConsole(props: { type: WindowType }) {
                 color = MainColorType.fast
                 break;
             case 'SLEEP':
-                title = selItem.event == 'SLEEP_END' ? '结束睡眠' : '开始睡眠'
+                title = selItem.event == 'SLEEP_WAKE_UP' ?  '结束睡眠':'开始睡眠'
                 color = MainColorType.sleep
         }
 
@@ -235,7 +235,10 @@ export default function MainConsole(props: { type: WindowType }) {
         }
 
         updateSchedule({
-            time: strTime
+            time: strTime,
+            event: selItem.event,
+            title: selItem.title,
+            is_all_day: false
         }, selItem.schedule_id).then(res => {
             global.refreshWindow()
             global.refreshHistory()
@@ -265,8 +268,9 @@ export default function MainConsole(props: { type: WindowType }) {
                 color = MainColorType.fast
                 break;
             case 'SLEEP':
-                title = selItem.event == 'FAST_SLEEP' ? '结束睡眠' : '开始睡眠'
+                title = selItem.event == 'SLEEP_WAKE_UP' ? '结束睡眠':'开始睡眠'
                 color = MainColorType.sleep
+                break
         }
 
         var endTimestamp = 0
@@ -400,7 +404,7 @@ export default function MainConsole(props: { type: WindowType }) {
                                     //编辑本次时长
                                 }
                                 else {
-                                    jumpPage('/_health/pages/edit_schedule')
+                                    jumpPage('/_health/pages/schedules_list')
                                 }
                             }
                             break;
@@ -417,7 +421,7 @@ export default function MainConsole(props: { type: WindowType }) {
                 {
                     switch (health.mode) {
                         case 'EAT':
-                            jumpPage('/_health/pages/edit_schedule')
+                            jumpPage('/_health/pages/schedules_list')
                             break;
                         case 'FAST':
                         case 'SLEEP':
@@ -430,7 +434,7 @@ export default function MainConsole(props: { type: WindowType }) {
                             }
                             break;
                         case 'ACTIVE':
-                            jumpPage('/_health/pages/edit_schedule')
+                            jumpPage('/_health/pages/schedules_list')
                             break;
                     }
                 }
@@ -549,7 +553,7 @@ export default function MainConsole(props: { type: WindowType }) {
         <Image className="main_arrow" src={require('@assets/images/center_arrow.png')} />
         <View className="main_summary">
             <View className="main_summary_status" style={{ color: getThemeColor(health.mode) }}>{windowStatus()}</View>
-            <Text className="main_summary_time" style={{color:getWindowStatus(health.windows, health.mode)==WindowStatusType.upcoming?'#B2B2B2':'#000'}}>{getCountownTime(health.windows, health.mode)}</Text>
+            <Text className="main_summary_time" style={{ color: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : '#000' }}>{getCountownTime(health.windows, health.mode)}</Text>
             <Text className="main_summary_duration">Total {getDuration(health.windows, health.mode)}</Text>
             <View className="border_footer_line" />
         </View>

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

@@ -561,7 +561,7 @@ export default function MainFastEatCard(props: { count: any, typeChanged: Functi
                     case 0:
                         break;
                     case 1:
-                        jumpPage('/_health/pages/edit_schedule')
+                        jumpPage('/_health/pages/schedules_list')
                         break;
                 }
             }

+ 13 - 0
src/services/health.tsx

@@ -66,6 +66,19 @@ export const delSchedule = (code:string) => {
     })
 }
 
+export const delSchedules = (ids:any) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_HEALTH_SCHEDULES, method: 'DELETE', data: {ids}
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
+    })
+}
+
 export const updateTarget = (timestamp,id) =>{
     return new Promise((resolve, reject) => {
         request({

Некоторые файлы не были показаны из-за большого количества измененных файлов