Leon 1 год назад
Родитель
Сommit
633f4fc217
2 измененных файлов с 188 добавлено и 170 удалено
  1. 188 169
      src/_health/pages/schedules.tsx
  2. 0 1
      src/pages/account/Profile.tsx

+ 188 - 169
src/_health/pages/schedules.tsx

@@ -22,6 +22,8 @@ import ScheduleItem from "../components/schedule_item";
 import { useTranslation } from "react-i18next";
 import { useTranslation } from "react-i18next";
 import NewHeader, { NewHeaderType } from "../components/new_header";
 import NewHeader, { NewHeaderType } from "../components/new_header";
 import ListFooter from "../components/list_footer";
 import ListFooter from "../components/list_footer";
+import Layout from "@/components/layout/layout";
+import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
 
 
 let useRoute;
 let useRoute;
 let useNavigation;
 let useNavigation;
@@ -92,13 +94,13 @@ export default function Schedules() {
         let windows = ''
         let windows = ''
         switch (selMode) {
         switch (selMode) {
             case 'FAST':
             case 'FAST':
-                if (router.params.isFastSleep){
+                if (router.params.isFastSleep) {
                     windows = 'FAST,SLEEP';
                     windows = 'FAST,SLEEP';
                 }
                 }
                 else {
                 else {
                     windows = 'FAST,EAT';
                     windows = 'FAST,EAT';
                 }
                 }
-                
+
                 break
                 break
             case 'EAT':
             case 'EAT':
                 windows = 'EAT,FAST';
                 windows = 'EAT,FAST';
@@ -138,7 +140,7 @@ export default function Schedules() {
     function getTitle() {
     function getTitle() {
         switch (selMode) {
         switch (selMode) {
             case 'FAST':
             case 'FAST':
-                if (router.params.isFastSleep){
+                if (router.params.isFastSleep) {
                     return '断食和睡眠';
                     return '断食和睡眠';
                 }
                 }
                 return '断食和进食';
                 return '断食和进食';
@@ -375,194 +377,211 @@ export default function Schedules() {
     if (!loaded) return <View />
     if (!loaded) return <View />
 
 
 
 
-    return <View>
-        <View style={{ display: 'flex', flexDirection: 'column' }}>
-            <NewHeader type={NewHeaderType.left} title={getTitle()} />
-
-            <Card>
-                <View>
-                    {
-                        errors.map((item, index) => {
-                            return <View key={index} className='error_tip'>
+    function detail() {
+        return <View>
+            <View style={{ display: 'flex', flexDirection: 'column' }}>
+                <NewHeader type={NewHeaderType.left} title={getTitle()} />
+
+                <Card>
+                    <View>
+                        {
+                            errors.map((item, index) => {
+                                return <View key={index} className='error_tip'>
+                                    <StatusIndicator type={StatusType.img}
+                                        fontColor="#000"
+                                        fontSize={rpxToPx(24)}
+                                        text={item} color={MainColorType.error}>
+                                        <IconError color="#fff" width={rpxToPx(26)} />
+                                    </StatusIndicator>
+                                </View>
+                                // return <View key={index} className='error_tip'>{item}</View>
+                            })
+                        }
+                        {
+                            showAutoSave && <View className='success_tip'>
                                 <StatusIndicator type={StatusType.img}
                                 <StatusIndicator type={StatusType.img}
                                     fontColor="#000"
                                     fontColor="#000"
                                     fontSize={rpxToPx(24)}
                                     fontSize={rpxToPx(24)}
-                                    text={item} color={MainColorType.error}>
-                                    <IconError color="#fff" width={rpxToPx(26)} />
+                                    text='已自动保存' color={MainColorType.success}>
+                                    <IconSuccess color="#fff" width={rpxToPx(26)} />
                                 </StatusIndicator>
                                 </StatusIndicator>
                             </View>
                             </View>
-                            // return <View key={index} className='error_tip'>{item}</View>
-                        })
-                    }
-                    {
-                        showAutoSave && <View className='success_tip'>
-                            <StatusIndicator type={StatusType.img}
-                                fontColor="#000"
-                                fontSize={rpxToPx(24)}
-                                text='已自动保存' color={MainColorType.success}>
-                                <IconSuccess color="#fff" width={rpxToPx(26)} />
-                            </StatusIndicator>
-                        </View>
-                    }
-                    {
-                        !health.finish_setup && selMode == '' && <View className='success_tip' style={{ backgroundColor: MainColorType.blue + '1A', color: MainColorType.blue }}>You haven't finished setting up your schedule yet!</View>
-                    }
-                    {
-                        list.map((obj, i) => {
-                            return <ScheduleItem
-                                index={i}
-                                count={list.length}
-                                key={i * 100}
-                                obj={obj}
-                                highlight={false}
-                                showLine={i < list.length - 1}
-                                errors={errors}
-                                selMode={selMode}
-                                disable={!health.finish_setup}
-                                onChange={time => {
-                                    obj.time = time
-                                    setSelItem(obj)
-                                    setShowTimePicker(false)
-                                    var array = JSON.parse(JSON.stringify(list))
-                                    array[i].time = time
-                                    array[i].op_ms = new Date().getTime()
-                                    setList(array)
-                                    checkData(array)
-                                }}
-                                onDelete={() => {
-                                    delSchedule(obj.id).then(res => {
+                        }
+                        {
+                            !health.finish_setup && selMode == '' && <View className='success_tip' style={{ backgroundColor: MainColorType.blue + '1A', color: MainColorType.blue }}>You haven't finished setting up your schedule yet!</View>
+                        }
+                        {
+                            list.map((obj, i) => {
+                                return <ScheduleItem
+                                    index={i}
+                                    count={list.length}
+                                    key={i * 100}
+                                    obj={obj}
+                                    highlight={false}
+                                    showLine={i < list.length - 1}
+                                    errors={errors}
+                                    selMode={selMode}
+                                    disable={!health.finish_setup}
+                                    onChange={time => {
+                                        obj.time = time
+                                        setSelItem(obj)
+                                        setShowTimePicker(false)
                                         var array = JSON.parse(JSON.stringify(list))
                                         var array = JSON.parse(JSON.stringify(list))
-                                        array.splice(i, 1)
+                                        array[i].time = time
+                                        array[i].op_ms = new Date().getTime()
                                         setList(array)
                                         setList(array)
-
-                                        global.refreshWindow()
-                                    })
-                                }}
-                            />
-                        })
-                    }
-                </View>
-            </Card>
-            <View style={{ height: 20, flexShrink: 0 }} />
-            {
-                !router.params.isFastSleep && selMode != '' && selMode != 'DAY' && selMode != 'NIGHT' && <Card><View className='item_add'
-                    onClick={() => add((selMode == 'FAST' || selMode == 'EAT'))}>
-                    <StatusIndicator type={StatusType.img}
-                        fontColor={getAddColor()}
-                        fontSize={rpxToPx(34)}
-                        text={(selMode == 'FAST' || selMode == 'EAT') ? t('health.add_meal') : t('health.add_active')} color={getAddColor()}>
-                        <IconAdd color="#fff" width={rpxToPx(20)} />
-                    </StatusIndicator>
-                    {/* <IconAdd color={getAddColor()} width={rpxToPx(34)} />
-                    <View className='toolbar_btn' style={{ color: getAddColor() }} >添加</View> */}
-                    <View style={{ flex: 1 }} />
-                </View></Card>
-            }
-            {
-                selMode == '' && <Card>
-                    <View className='item_add'
-                        style={{ position: 'relative' }}
-                        onClick={() => add(true)}>
-                        <StatusIndicator type={StatusType.img}
-                            fontColor={MainColorType.eat}
-                            fontSize={rpxToPx(34)}
-                            text={t('health.add_meal')} color={MainColorType.eat}>
-                            <IconAdd color="#fff" width={rpxToPx(20)} />
-                        </StatusIndicator>
-                        <View style={{ flex: 1 }} />
-                        <View className='border_footer_line' style={{ left: rpxToPx(66) }} />
+                                        checkData(array)
+                                    }}
+                                    onDelete={() => {
+                                        delSchedule(obj.id).then(res => {
+                                            var array = JSON.parse(JSON.stringify(list))
+                                            array.splice(i, 1)
+                                            setList(array)
+
+                                            global.refreshWindow()
+                                        })
+                                    }}
+                                />
+                            })
+                        }
                     </View>
                     </View>
-                    <View className='item_add'
-                        onClick={() => add(false)}>
+                </Card>
+                <View style={{ height: 20, flexShrink: 0 }} />
+                {
+                    !router.params.isFastSleep && selMode != '' && selMode != 'DAY' && selMode != 'NIGHT' && <Card><View className='item_add'
+                        onClick={() => add((selMode == 'FAST' || selMode == 'EAT'))}>
                         <StatusIndicator type={StatusType.img}
                         <StatusIndicator type={StatusType.img}
-                            fontColor={MainColorType.active}
+                            fontColor={getAddColor()}
                             fontSize={rpxToPx(34)}
                             fontSize={rpxToPx(34)}
-                            text={t('health.add_active')} color={MainColorType.active}>
+                            text={(selMode == 'FAST' || selMode == 'EAT') ? t('health.add_meal') : t('health.add_active')} color={getAddColor()}>
                             <IconAdd color="#fff" width={rpxToPx(20)} />
                             <IconAdd color="#fff" width={rpxToPx(20)} />
                         </StatusIndicator>
                         </StatusIndicator>
+                        {/* <IconAdd color={getAddColor()} width={rpxToPx(34)} />
+                    <View className='toolbar_btn' style={{ color: getAddColor() }} >添加</View> */}
                         <View style={{ flex: 1 }} />
                         <View style={{ flex: 1 }} />
-                    </View>
-                </Card>
-            }
+                    </View></Card>
+                }
+                {
+                    selMode == '' && <Card>
+                        <View className='item_add'
+                            style={{ position: 'relative' }}
+                            onClick={() => add(true)}>
+                            <StatusIndicator type={StatusType.img}
+                                fontColor={MainColorType.eat}
+                                fontSize={rpxToPx(34)}
+                                text={t('health.add_meal')} color={MainColorType.eat}>
+                                <IconAdd color="#fff" width={rpxToPx(20)} />
+                            </StatusIndicator>
+                            <View style={{ flex: 1 }} />
+                            <View className='border_footer_line' style={{ left: rpxToPx(66) }} />
+                        </View>
+                        <View className='item_add'
+                            onClick={() => add(false)}>
+                            <StatusIndicator type={StatusType.img}
+                                fontColor={MainColorType.active}
+                                fontSize={rpxToPx(34)}
+                                text={t('health.add_active')} color={MainColorType.active}>
+                                <IconAdd color="#fff" width={rpxToPx(20)} />
+                            </StatusIndicator>
+                            <View style={{ flex: 1 }} />
+                        </View>
+                    </Card>
+                }
 
 
-            {
-                health.finish_setup && <View style={{
-                    backgroundColor: 'transparent',
-                    position: 'relative',
-                    display: 'flex',
-                    alignItems: 'center',
-                    justifyContent: 'center',
-                    height: rpxToPx(128),
-                    width: rpxToPx(750)
-                }}>
-                    {
-                        selMode != '' && <View style={{ width: rpxToPx(316), height: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
-                            <NewButton
-                                type={NewButtonType.link}
-                                title='View Full Schedule'
-                                onClick={showAll}
-                            >
-                            </NewButton>
-                        </View>}
-                    <NewButton
-                        btnStyle={{
-                            position: 'absolute',
-                            top: rpxToPx(42),
-                            right: rpxToPx(40)
-                        }}
-                        type={NewButtonType.more}
-                        onClick={more}
-                    />
+                {
+                    health.finish_setup && <View style={{
+                        backgroundColor: 'transparent',
+                        position: 'relative',
+                        display: 'flex',
+                        alignItems: 'center',
+                        justifyContent: 'center',
+                        height: rpxToPx(128),
+                        width: rpxToPx(750)
+                    }}>
+                        {
+                            selMode != '' && <View style={{ width: rpxToPx(316), height: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+                                <NewButton
+                                    type={NewButtonType.link}
+                                    title='View Full Schedule'
+                                    onClick={showAll}
+                                >
+                                </NewButton>
+                            </View>}
+                        <NewButton
+                            btnStyle={{
+                                position: 'absolute',
+                                top: rpxToPx(42),
+                                right: rpxToPx(40)
+                            }}
+                            type={NewButtonType.more}
+                            onClick={more}
+                        />
 
 
-                </View>
-            }
+                    </View>
+                }
 
 
 
 
-            {/* <View style={{ height: 100, flexShrink: 0 }} /> */}
-            <ListFooter />
+                {/* <View style={{ height: 100, flexShrink: 0 }} /> */}
+                <ListFooter />
+
+                <View style={{ flex: 1 }} />
+                {
+                    selMode == '' && !health.finish_setup && <View className="main_footer">
+                        <NewButton
+                            type={NewButtonType.fill}
+                            title={t('health.finish_setup')}
+                            disable={errors.length > 0}
+                            color={MainColorType.blue}
+                            width={rpxToPx(646)}
+                            height={rpxToPx(96)}
+                            onClick={() => {
+                                jumpPage('/_health/pages/guide_begin')
+                            }}
+                        />
+                    </View>
+                }
 
 
-            <View style={{ flex: 1 }} />
-            {
-                selMode == '' && !health.finish_setup && <View className="main_footer">
-                    <NewButton
-                        type={NewButtonType.fill}
-                        title={t('health.finish_setup')}
-                        disable={errors.length > 0}
-                        color={MainColorType.blue}
-                        width={rpxToPx(646)}
-                        height={rpxToPx(96)}
-                        onClick={() => {
-                            jumpPage('/_health/pages/guide_begin')
+
+                {/* <View className="edit_footer_btn" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={tapEdit}>批量编辑</View> */}
+                {
+                    showTimePicker && <Modal
+                        testInfo={null}
+                        dismiss={() => {
+                            setShowTimePicker(false)
+                        }}
+                        confirm={() => { }}>
+                        {
+                            modalContent()
+                        }
+                    </Modal>
+                }
+                {
+                    showModal && <AddLabel labels={isEat ? labels : labels2}
+                        window={isEat ? 'EAT' : 'ACTIVE'}
+                        color={isEat ? MainColorType.eat : MainColorType.active}
+                        disMiss={() => setShowModal(false)}
+                        op_page={getOpPage()}
+                        confirm={(res) => {
+                            checkResultData(res)
                         }}
                         }}
                     />
                     />
-                </View>
-            }
-
+                }
+            </View>
+        </View>
+    }
 
 
-            {/* <View className="edit_footer_btn" style={{ color: getThemeColor(health.mode), backgroundColor: getThemeColor(health.mode) + '33' }} onClick={tapEdit}>批量编辑</View> */}
-            {
-                showTimePicker && <Modal
-                    testInfo={null}
-                    dismiss={() => {
-                        setShowTimePicker(false)
-                    }}
-                    confirm={() => { }}>
-                    {
-                        modalContent()
-                    }
-                </Modal>
-            }
+    return <View>
+        <Layout title={getTitle()}
+            titleShowStyle={NaviBarTitleShowType.scrollToShow}
+            type={TemplateType.customHeader}
+            // header={headerView()}
+            // triggered={triggered}
+            // refresh={refresh}
+            // showPullToRefresh={true}
+        >
             {
             {
-                showModal && <AddLabel labels={isEat ? labels : labels2}
-                    window={isEat ? 'EAT' : 'ACTIVE'}
-                    color={isEat ? MainColorType.eat : MainColorType.active}
-                    disMiss={() => setShowModal(false)}
-                    op_page={getOpPage()}
-                    confirm={(res) => {
-                        checkResultData(res)
-                    }}
-                />
+                detail()
             }
             }
-        </View>
+        </Layout>
     </View>
     </View>
 }
 }

+ 0 - 1
src/pages/account/Profile.tsx

@@ -390,7 +390,6 @@ export default function Page() {
                 icon={<Image src={require('@assets/_health/setting_more.png')} className="profile_cell_icon" />}
                 icon={<Image src={require('@assets/_health/setting_more.png')} className="profile_cell_icon" />}
             />
             />
             <View style={{ height: 140, flexShrink: 0 }}></View>
             <View style={{ height: 140, flexShrink: 0 }}></View>
-
         </View>
         </View>
     }
     }