Leon %!s(int64=2) %!d(string=hai) anos
pai
achega
e19b3294a9

+ 1 - 1
src/components/layout/Box.scss

@@ -8,7 +8,7 @@
     box-sizing: border-box;
     display: flex;
     flex-direction: column;
-    margin-bottom: 20px;
+    margin-bottom: 40px;
     flex-shrink: 0;
     // position: relative;
 }

+ 45 - 44
src/features/trackTimeDuration/components/Console.tsx

@@ -453,58 +453,59 @@ export default function Component() {
     }
 
     return (
-        <Box style={{ flexDirection: 'column', alignItems: 'center',flexShrink:0 }}>
-            {
-                value == 'ONGOING' && <View>
-                    <Text className="counter_text" style={{ color: textColor, opacity: textAlpha() }}>{(machine.context.checkData as any).current_record.scenario == 'FAST' ?
-                        TimeFormatter.countdown((machine.context.checkData as any).current_record.fast.target_end_time) :
-                        TimeFormatter.countdown((machine.context.checkData as any).current_record.sleep.target_end_time)}</Text>
-                </View>
-            }
-            {
-                (value == 'ONGOING1' || value == 'WAIT_FOR_START') && <Stepper child={
-                    <Text className="stepper_text" style={{ color: textColor, opacity: textAlpha() }} onClick={showDurationPicker}>{durationFormate()}</Text>
-                } minus={minus} plus={plus} disableMinus={disableMinus()} disablePlus={disablePlus()} />
-                // <Text style={{marginBottom:10}} onClick={showDurationPicker}>时长:{durationFormate()}</Text>
-            }
-            {
-                machine.context.checkData && value == 'ONGOING2' && <View>
-                    <Text className="counter_text" style={{ color: '#00ffff', opacity: textAlpha() }}>{TimeFormatter.countdown((machine.context.checkData as any).current_record.sleep.target_end_time)}</Text>
-                </View>
-            }
-
-            {
-                machine.context.checkData && value == 'ONGOING3' && <View>
-                    <Text className="counter_text" style={{ color: textColor, opacity: textAlpha() }}>{TimeFormatter.countdown((machine.context.checkData as any).current_record.fast.target_end_time)}</Text>
-                </View>
-            }
+        <Box >
+            <View  style={{ display:'flex',flexDirection: 'column',alignItems: 'center', flexShrink: 0 }}>
+                {
+                    value == 'ONGOING' && <View>
+                        <Text className="counter_text" style={{ color: textColor, opacity: textAlpha() }}>{(machine.context.checkData as any).current_record.scenario == 'FAST' ?
+                            TimeFormatter.countdown((machine.context.checkData as any).current_record.fast.target_end_time) :
+                            TimeFormatter.countdown((machine.context.checkData as any).current_record.sleep.target_end_time)}</Text>
+                    </View>
+                }
+                {
+                    (value == 'ONGOING1' || value == 'WAIT_FOR_START') && <Stepper child={
+                        <Text className="stepper_text" style={{ color: textColor, opacity: textAlpha() }} onClick={showDurationPicker}>{durationFormate()}</Text>
+                    } minus={minus} plus={plus} disableMinus={disableMinus()} disablePlus={disablePlus()} />
+                    // <Text style={{marginBottom:10}} onClick={showDurationPicker}>时长:{durationFormate()}</Text>
+                }
+                {
+                    machine.context.checkData && value == 'ONGOING2' && <View>
+                        <Text className="counter_text" style={{ color: '#00ffff', opacity: textAlpha() }}>{TimeFormatter.countdown((machine.context.checkData as any).current_record.sleep.target_end_time)}</Text>
+                    </View>
+                }
 
-            <View>
                 {
-                    key === 'FAST_SLEEP' && mixedBtns()
+                    machine.context.checkData && value == 'ONGOING3' && <View>
+                        <Text className="counter_text" style={{ color: textColor, opacity: textAlpha() }}>{TimeFormatter.countdown((machine.context.checkData as any).current_record.fast.target_end_time)}</Text>
+                    </View>
                 }
+
+                <View>
+                    {
+                        key === 'FAST_SLEEP' && mixedBtns()
+                    }
+                    {
+                        key === 'FAST' && fastBtns()
+                    }
+                    {
+                        key === 'SLEEP' && sleepBtns()
+                    }
+                </View>
                 {
-                    key === 'FAST' && fastBtns()
+                    showModal && isOpen && <Modal testInfo={testLayout()} children={layoutContent()} dismiss={() => setIsOpen(false)} confirm={() => {
+                        var picker = limitPickerRef.current;
+                        pickerConfirm((picker as any).getConfirmData());
+                        setIsOpen(false);
+                    }} />
                 }
                 {
-                    key === 'SLEEP' && sleepBtns()
+                    isOpenDurationPicker && <Modal children={durationPickerContent()} dismiss={() => setIsOpenDurationPicker(false)} confirm={() => {
+                        var picker = durationPickerRef.current;
+                        durationChange((picker as any).getConfirmData());
+                        setIsOpenDurationPicker(false);
+                    }} />
                 }
             </View>
-            {
-                showModal && isOpen && <Modal testInfo={testLayout()} children={layoutContent()} dismiss={() => setIsOpen(false)} confirm={() => {
-                    var picker = limitPickerRef.current;
-                    pickerConfirm((picker as any).getConfirmData());
-                    setIsOpen(false);
-                }} />
-            }
-            {
-                isOpenDurationPicker && <Modal children={durationPickerContent()} dismiss={() => setIsOpenDurationPicker(false)} confirm={() => {
-                    var picker = durationPickerRef.current;
-                    durationChange((picker as any).getConfirmData());
-                    setIsOpenDurationPicker(false);
-                }} />
-            }
-
         </Box>
     )
 }

+ 6 - 2
src/pages/common/RecordsHistory.tsx

@@ -1,4 +1,4 @@
-import { getClockRecords } from "@/services/trackTimeDuration";
+import { clearTimeRecords, getClockRecords } from "@/services/trackTimeDuration";
 import { View, Text, ScrollView } from "@tarojs/components";
 import { usePullDownRefresh, useReachBottom, useReady, useRouter } from "@tarojs/taro";
 import { useEffect, useState } from "react";
@@ -188,7 +188,11 @@ export default function Page() {
             })
         }
         else if (router.params.type == 'time') {
-
+            clearTimeRecords().then(res => {
+                refresh()
+                // global.refreshMetric()
+                // Taro.getCurrentPages()[0].refresh()
+            })
         }
     }
 

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

@@ -31,6 +31,7 @@ export const API_FAST_RECORDS = `${baseUrl}/api/fast/records`
 export const API_FAST_SCHEDULES = `${baseUrl}/api/fast/schedules`
 export const API_FAST_CALENDARS = `${baseUrl}/api/fast/calendars/`
 
+
 //track something
 export const API_CLOCK_RECORDS = `${baseUrl}/api/clock/records`
 export const API_UPLOAD_STEPS = `${baseUrl}/api/thirdparty/wx/steps`

+ 12 - 0
src/services/trackTimeDuration.tsx

@@ -82,4 +82,16 @@ export const delRecord = (id: string) => {
             resolve(res);
         })
     })
+}
+
+export const clearTimeRecords = ()=>{
+    return new Promise((resolve) => {
+        request({
+            url: API_CLOCK_RECORDS, method: 'DELETE', data: {}
+        }).then(res => {
+            resolve(res);
+        })
+    })
+    
+
 }