Leon 1 year ago
parent
commit
ba91ea2675
1 changed files with 23 additions and 9 deletions
  1. 23 9
      src/features/trackTimeDuration/components/IndexConsoleMuti.tsx

+ 23 - 9
src/features/trackTimeDuration/components/IndexConsoleMuti.tsx

@@ -37,6 +37,7 @@ export default function IndexConsoleMuti(props: { status: string, event: string,
     function confirm() {
         var fast: any = {}
         var sleep: any = {}
+        debugger
         switch (props.event) {
             case 'start_sleep':
                 if (!fastStart) {
@@ -98,7 +99,7 @@ export default function IndexConsoleMuti(props: { status: string, event: string,
                         })
                         return
                     }
-                    if (!sleepStart) {
+                    if (!sleepStart && props.scenario == 'FAST_SLEEP') {
                         Taro.showToast({
                             icon: 'none',
                             title: '请选择开始睡眠时间'
@@ -106,10 +107,13 @@ export default function IndexConsoleMuti(props: { status: string, event: string,
                         return
                     }
                     fast.real_start_time = fastStart.time
-                    fast.real_start_date =  fastStart.date
+                    fast.real_start_date = fastStart.date
+
+                    if (props.scenario == 'FAST_SLEEP') {
+                        sleep.real_start_time = sleepStart.time
+                        sleep.real_start_date = sleepStart.date
+                    }
 
-                    sleep.real_start_time = sleepStart.time
-                    sleep.real_start_date = sleepStart.date
 
                 }
                 else if (props.status == 'ONGOING1') {
@@ -143,10 +147,20 @@ export default function IndexConsoleMuti(props: { status: string, event: string,
                 fast.real_end_date = fastEnd.date
                 break;
         }
-        batchClocks({
-            fast,
-            sleep
-        }).then(res => {
+        var params: any = {
+        }
+        if (props.scenario == 'FAST_SLEEP') {
+            params = {
+                fast,
+                sleep
+            }
+        }
+        else {
+            params = {
+                fast
+            }
+        }
+        batchClocks(params).then(res => {
             getLocalPush()
             global.indexPageRefresh()
             global.scrollToLatest()
@@ -159,7 +173,7 @@ export default function IndexConsoleMuti(props: { status: string, event: string,
 
         })
     }
-
+    
     function tapItem(index: number) {
         setShowPicker(true);
         switch (index) {