Leon 2 년 전
부모
커밋
c9ddbfccd5

+ 4 - 1
dist/common.js

@@ -178,10 +178,13 @@ function Rings(props) {
 
 
 function Component(props) {
-  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(-1),
+  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(props.selIndex ? props.selIndex : -1),
     _useState2 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__["default"])(_useState, 2),
     selIndex = _useState2[0],
     setSelIndex = _useState2[1];
+  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
+    setSelIndex(props.selIndex);
+  }, [props.selIndex]);
   function isString(variable) {
     return typeof variable === 'string';
   }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/common.js.map


+ 15 - 2
dist/pages/ChooseScenario.js

@@ -111,7 +111,20 @@ function Component() {
     _useState4 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_13__["default"])(_useState3, 2),
     scenarios = _useState4[0],
     setScenarios = _useState4[1];
+  var selScenario = (0,react_redux__WEBPACK_IMPORTED_MODULE_9__.useSelector)(function (state) {
+    return state.scenario;
+  });
   (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_8__.useReady)(function () {
+    console.log(selScenario);
+    if (selScenario) {
+      if (selScenario.name == 'FAST_SLEEP') {
+        setSelIndex(2);
+      } else if (selScenario.name == 'SLEEP') {
+        setSelIndex(1);
+      } else {
+        setSelIndex(0);
+      }
+    }
     (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_11__.getPlans)().then(function (res) {
       var data = res;
       setScenarios(data.scenarios);
@@ -236,7 +249,6 @@ function Component() {
     return array;
   }
   function handleItemSelect(index) {
-    console.log('handleItemSelect', index);
     setSelIndex(index);
     dispatch((0,_store_scenario__WEBPACK_IMPORTED_MODULE_10__.setScenario)(scenarios[index]));
     // dispatch(setScenarioName(scenarios[index].scenario) as any)
@@ -261,7 +273,8 @@ function Component() {
       },
       children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_SingleSelect__WEBPACK_IMPORTED_MODULE_4__["default"], {
         items: items(),
-        itemSelect: handleItemSelect
+        itemSelect: handleItemSelect,
+        selIndex: selIndex
       })
     }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Footer__WEBPACK_IMPORTED_MODULE_3__["default"], {
       child: footerContent()

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/pages/ChooseScenario.js.map


+ 27 - 22
dist/pages/Clock.js

@@ -288,11 +288,13 @@ function IndexPage() {
     if (!user.isLogin) {
       return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_16__.View, {});
     }
-    if (checkData.current_record.scenario == 'FAST_SLEEP') {
-      return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)(_features_trackTimeDuration_components_Schedule__WEBPACK_IMPORTED_MODULE_9__["default"], {});
-    }
-    return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_16__.View, {});
+
+    // if ((checkData as any).current_record.scenario == 'FAST_SLEEP') {
+    return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsx)(_features_trackTimeDuration_components_Schedule__WEBPACK_IMPORTED_MODULE_9__["default"], {});
+    // }
+    // return <View />
   }
+
   return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_14__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_16__.View, {
     style: {
       flex: 1,
@@ -1116,7 +1118,14 @@ function Component() {
       width: '100%',
       alignItems: 'center'
     },
-    children: [value == 'ONGOING' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
+    children: [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData && _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData.current_record.last_real_check_time && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
+      style: {
+        width: '100%',
+        textAlign: 'center',
+        color: 'red'
+      },
+      children: _utils_time_format__WEBPACK_IMPORTED_MODULE_2__.TimeFormatter.formateTime(_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData.current_record.last_real_check_time)
+    }), value == 'ONGOING' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
       children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
         children: _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData.current_record.scenario == 'FAST' ? _utils_time_format__WEBPACK_IMPORTED_MODULE_2__.TimeFormatter.countdown(_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData.current_record.fast.target_end_time) : _utils_time_format__WEBPACK_IMPORTED_MODULE_2__.TimeFormatter.countdown(_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData.current_record.sleep.target_end_time)
       })
@@ -1136,12 +1145,6 @@ function Component() {
       })
     }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
       children: [key === 'FAST_SLEEP' && mixedBtns(), key === 'FAST' && fastBtns(), key === 'SLEEP' && sleepBtns()]
-    }), _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData && _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData.current_record.last_real_check_time && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
-      style: {
-        width: '100%',
-        textAlign: 'center'
-      },
-      children: _utils_time_format__WEBPACK_IMPORTED_MODULE_2__.TimeFormatter.formateTime(_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData.current_record.last_real_check_time)
     }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(taro_ui__WEBPACK_IMPORTED_MODULE_5__.AtFloatLayout, {
       isOpened: isOpen,
       onClose: function onClose() {
@@ -1458,27 +1461,29 @@ function Component(props) {
     setIsLatest(true);
     setIsOpen(true);
   }
+  function getTime(t1, t2) {
+    return _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(t1, t2);
+  }
   function getStepATime(obj) {
     if (obj.status == 'COMPLETED' && obj.sleep.status == 'NOT_STARTED') {
       return '未知';
     }
-    debugger;
-    return obj.status == 'ONGOING1' ? _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.fast.real_start_time, new Date().getTime()) : obj.sleep.real_start_time ? _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.sleep.real_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time) : _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.sleep.target_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time);
+    return obj.status == 'ONGOING1' ? getTime(obj.fast.real_start_time, new Date().getTime()) : obj.sleep.real_start_time ? getTime(obj.sleep.real_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time) : getTime(obj.sleep.target_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time);
   }
   function getStepBTime(obj) {
     if (obj.status == 'ONGOING1') return 'Next up';
-    if (obj.status == 'ONGOING2') return _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.sleep.real_start_time, new Date().getTime());
-    if (obj.status == 'WAIT_FOR_START') return _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.sleep.target_end_time, obj.sleep.target_start_time);
+    if (obj.status == 'ONGOING2') return getTime(obj.sleep.real_start_time, new Date().getTime());
+    if (obj.status == 'WAIT_FOR_START') return getTime(obj.sleep.target_end_time, obj.sleep.target_start_time);
     if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return '未知';
-    return _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.sleep.real_end_time, obj.sleep.real_start_time);
+    return getTime(obj.sleep.real_end_time, obj.sleep.real_start_time);
   }
   function getStepCTime(obj) {
     if (obj.status == 'ONGOING1') return 'Final stage';
     if (obj.status == 'ONGOING2') return 'Next up';
-    if (obj.status == 'ONGOING3') return _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.sleep.real_end_time, new Date().getTime());
-    if (obj.status == 'WAIT_FOR_START') return _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.fast.target_end_time, obj.sleep.target_end_time);
+    if (obj.status == 'ONGOING3') return getTime(obj.sleep.real_end_time, new Date().getTime());
+    if (obj.status == 'WAIT_FOR_START') return getTime(obj.fast.target_end_time, obj.sleep.target_end_time);
     if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return '未知';
-    return _utils_time_format__WEBPACK_IMPORTED_MODULE_3__.TimeFormatter.calculateTimeDifference(obj.fast.real_end_time, obj.sleep.real_end_time);
+    return getTime(obj.fast.real_end_time, obj.sleep.real_end_time);
   }
   function layoutContent() {
     //当前断食阶段
@@ -1649,16 +1654,16 @@ function Component(props) {
     }), scheduleItems(), value == 'WAIT_FOR_START' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
       onClick: editSchedule,
       children: "\u8C03\u6574\u65E5\u7A0B"
-    }), props.type == 'latest' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
+    }), props.type == 'latest' && key == 'FAST_SLEEP' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
       onClick: showLatest,
       children: "Durations by stage"
-    }), props.type != 'latest' && (value == 'WAIT_FOR_START' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
+    }), props.type != 'latest' && key == 'FAST_SLEEP' && (value == 'WAIT_FOR_START' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
       onClick: showStage,
       children: "Duration goals by stage"
     }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_8__.Text, {
       onClick: showStage,
       children: "Current stage"
-    })), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(taro_ui__WEBPACK_IMPORTED_MODULE_4__.AtFloatLayout, {
+    })), key == 'FAST_SLEEP' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(taro_ui__WEBPACK_IMPORTED_MODULE_4__.AtFloatLayout, {
       isOpened: isOpen,
       onClose: function onClose() {
         stopTimer();

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/pages/Clock.js.map


+ 1 - 1
dist/pages/Clock.wxss

@@ -228,7 +228,7 @@
   bottom: 0;
   width: 100%;
   min-height: 900rpx;
-  max-height: 900rpx;
+  max-height: 950rpx;
   background-color: #FFF;
   -webkit-transform: translate3d(0, 100%, 0);
           transform: translate3d(0, 100%, 0);

+ 27 - 0
dist/pages/Login.wxss

@@ -0,0 +1,27 @@
+/*!*******************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
+  !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[0].use[4]!./src/components/SingleSelect.scss ***!
+  \*******************************************************************************************************************************************************************************************************************************************************************************************************************************/
+.item {
+  margin: 0 46rpx 40rpx 46rpx;
+  background-color: #1C1C1C;
+  border: solid 4rpx #1C1C1C;
+  border-radius: 36rpx;
+  padding: 40rpx;
+  color: #fff;
+  display: -webkit-flex;
+  display: -ms-flexbox;
+  display: flex;
+  -webkit-flex-direction: row;
+      -ms-flex-direction: row;
+          flex-direction: row;
+  -webkit-align-items: center;
+      -ms-flex-align: center;
+          align-items: center;
+  -webkit-justify-content: space-between;
+      -ms-flex-pack: justify;
+          justify-content: space-between;
+}
+
+.item_select {
+  border: solid 4rpx #AAFF00;
+}

+ 6 - 6
dist/prebundle/remoteEntry.js

@@ -30,12 +30,12 @@ var moduleMap = {
 	"./xstate": function() {
 		return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-77KB62LY_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-3EXGJ5BE_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_xstate_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/xstate.js */ "./node_modules/.taro/weapp/prebundle/xstate.js")); }; });
 	},
-	"./i18next": function() {
-		return __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_i18next_js").then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/i18next.js */ "./node_modules/.taro/weapp/prebundle/i18next.js")); }; });
-	},
 	"./taro-ui": function() {
 		return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-77KB62LY_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-3EXGJ5BE_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-LNJCN3VW_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-6GAVBEBQ_js"), __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_taro-ui_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/taro-ui.js */ "./node_modules/.taro/weapp/prebundle/taro-ui.js")); }; });
 	},
+	"./i18next": function() {
+		return __webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_i18next_js").then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/i18next.js */ "./node_modules/.taro/weapp/prebundle/i18next.js")); }; });
+	},
 	"./react/jsx-runtime": function() {
 		return Promise.all([__webpack_require__.e("vendors-node_modules_taro_weapp_prebundle_chunk-LNJCN3VW_js"), __webpack_require__.e("node_modules_taro_weapp_prebundle_react_jsx-runtime_js")]).then(function() { return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react_jsx-runtime.js */ "./node_modules/.taro/weapp/prebundle/react_jsx-runtime.js")); }; });
 	},
@@ -101,12 +101,12 @@ var taroModuleMap = {
 	"./xstate": function() {
 		return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/xstate.js */ "./node_modules/.taro/weapp/prebundle/xstate.js")); };
 	},
-	"./i18next": function() {
-		return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/i18next.js */ "./node_modules/.taro/weapp/prebundle/i18next.js")); };
-	},
 	"./taro-ui": function() {
 		return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/taro-ui.js */ "./node_modules/.taro/weapp/prebundle/taro-ui.js")); };
 	},
+	"./i18next": function() {
+		return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/i18next.js */ "./node_modules/.taro/weapp/prebundle/i18next.js")); };
+	},
 	"./react/jsx-runtime": function() {
 		return function() { return (__webpack_require__(/*! ./node_modules/.taro/weapp/prebundle/react_jsx-runtime.js */ "./node_modules/.taro/weapp/prebundle/react_jsx-runtime.js")); };
 	},

+ 7 - 3
src/components/SingleSelect.tsx

@@ -1,10 +1,14 @@
 import { View, Text, Image } from "@tarojs/components";
-import { useState } from "react";
+import { useEffect, useState } from "react";
 import './SingleSelect.scss'
 import check from '../assets/svg/check.svg'
 
-export default function Component(props: { items: any[],itemSelect?:(index: number)=>void }) {
-    const [selIndex, setSelIndex] = useState(-1)
+export default function Component(props: { items: any[],itemSelect?:(index: number)=>void,selIndex?:number }) {
+    const [selIndex, setSelIndex] = useState(props.selIndex?props.selIndex:-1)
+
+    useEffect(()=>{
+        setSelIndex(props.selIndex!)
+    },[props.selIndex])
 
     function isString(variable: any): boolean {
         return typeof variable === 'string';

+ 15 - 3
src/features/trackTimeDuration/components/ChooseScenario.tsx

@@ -11,7 +11,7 @@ import './ChooseScenario.scss'
 import { useState } from "react";
 import { useReady } from "@tarojs/taro";
 import Taro from "@tarojs/taro";
-import { useDispatch } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
 import { setScenario, setScenarioName } from "@/store/scenario";
 import { getPlans } from "@/services/trackTimeDuration";
 
@@ -21,8 +21,21 @@ export default function Component() {
     const dispatch = useDispatch();
     const [selIndex,setSelIndex] = useState(0)
     const [scenarios,setScenarios] = useState<any[]>([])
+    const selScenario = useSelector((state: any) => state.scenario);
 
     useReady(()=>{
+        console.log(selScenario)
+        if (selScenario) {
+            if (selScenario.name == 'FAST_SLEEP'){
+                setSelIndex(2)
+            }
+            else if (selScenario.name == 'SLEEP'){
+                setSelIndex(1)
+            }
+            else {
+                setSelIndex(0)
+            }
+        }
         getPlans().then(res=>{
             const data = res as { scenarios: any[] };
             setScenarios(data.scenarios)
@@ -93,7 +106,6 @@ export default function Component() {
     }
 
     function handleItemSelect(index: number) {
-        console.log('handleItemSelect', index)
         setSelIndex(index)
         dispatch(setScenario(scenarios[index]) as any)
         // dispatch(setScenarioName(scenarios[index].scenario) as any)
@@ -104,7 +116,7 @@ export default function Component() {
         <Texts text={t('page.choose_scenario.sub_title')} type={TextType.secondary}></Texts>
         <View style={{ height: 20 }} />
         <View style={{ position: 'relative', zIndex: 1 }}>
-            <SingleSelect items={items()} itemSelect={handleItemSelect}/>
+            <SingleSelect items={items()} itemSelect={handleItemSelect} selIndex={selIndex}/>
         </View>
 
         <Footer child={footerContent()} />

+ 7 - 6
src/features/trackTimeDuration/components/Console.tsx

@@ -226,6 +226,12 @@ export default function Component() {
     }
     return (
         <View style={{ display: 'flex', flexDirection: 'column', width: '100%', alignItems: 'center' }}>
+            {
+                machine.context.checkData && (machine.context.checkData as any).current_record.last_real_check_time &&
+                <Text style={{ width: '100%', textAlign: 'center',color:'red' }}>
+                    {TimeFormatter.formateTime((machine.context.checkData as any).current_record.last_real_check_time)}
+                </Text>
+            }
             {
                 value == 'ONGOING' && <View>
                     <Text>{(machine.context.checkData as any).current_record.scenario == 'FAST' ?
@@ -262,12 +268,7 @@ export default function Component() {
                 }
             </View>
 
-            {
-                machine.context.checkData && (machine.context.checkData as any).current_record.last_real_check_time &&
-                <Text style={{ width: '100%', textAlign: 'center' }}>
-                    {TimeFormatter.formateTime((machine.context.checkData as any).current_record.last_real_check_time)}
-                </Text>
-            }
+            
             <AtFloatLayout
                 isOpened={isOpen}
                 onClose={() => {

+ 32 - 25
src/features/trackTimeDuration/components/Schedule.tsx

@@ -13,7 +13,7 @@ export default function Component(props: { type?: string }) {
     const [key, setKey] = useState('');
     const [value, setValue] = useState('');
     const [isOpen, setIsOpen] = useState(false);
-    const [isLatest, setIsLatest] = useState(props.type=='latest');
+    const [isLatest, setIsLatest] = useState(props.type == 'latest');
 
     const [timerId, setTimerId] = useState(null)
     const [counter, setCounter] = useState(0)
@@ -106,39 +106,44 @@ export default function Component(props: { type?: string }) {
         setIsOpen(true)
     }
 
+    function getTime(t1: number, t2: number) {
+        return TimeFormatter.calculateTimeDifference(t1, t2)
+    }
+
+
+
     function getStepATime(obj) {
         if (obj.status == 'COMPLETED' && obj.sleep.status == 'NOT_STARTED') {
             return '未知'
         }
-        debugger
         return obj.status == 'ONGOING1' ?
-            TimeFormatter.calculateTimeDifference(obj.fast.real_start_time, (new Date()).getTime()) :
-            obj.sleep.real_start_time ? TimeFormatter.calculateTimeDifference(obj.sleep.real_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time) :
-                TimeFormatter.calculateTimeDifference(obj.sleep.target_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time)
+            getTime(obj.fast.real_start_time, (new Date()).getTime()) :
+            obj.sleep.real_start_time ? getTime(obj.sleep.real_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time) :
+                getTime(obj.sleep.target_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time)
     }
 
     function getStepBTime(obj) {
         if (obj.status == 'ONGOING1') return 'Next up'
-        if (obj.status == 'ONGOING2') return TimeFormatter.calculateTimeDifference(obj.sleep.real_start_time, (new Date()).getTime())
-        if (obj.status == 'WAIT_FOR_START') return TimeFormatter.calculateTimeDifference(obj.sleep.target_end_time, obj.sleep.target_start_time)
+        if (obj.status == 'ONGOING2') return getTime(obj.sleep.real_start_time, (new Date()).getTime())
+        if (obj.status == 'WAIT_FOR_START') return getTime(obj.sleep.target_end_time, obj.sleep.target_start_time)
         if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return '未知'
-        return TimeFormatter.calculateTimeDifference(obj.sleep.real_end_time, obj.sleep.real_start_time)
+        return getTime(obj.sleep.real_end_time, obj.sleep.real_start_time)
 
     }
 
     function getStepCTime(obj) {
         if (obj.status == 'ONGOING1') return 'Final stage'
         if (obj.status == 'ONGOING2') return 'Next up'
-        if (obj.status == 'ONGOING3') return TimeFormatter.calculateTimeDifference(obj.sleep.real_end_time, (new Date()).getTime())
-        if (obj.status == 'WAIT_FOR_START') return TimeFormatter.calculateTimeDifference(obj.fast.target_end_time, obj.sleep.target_end_time)
+        if (obj.status == 'ONGOING3') return getTime(obj.sleep.real_end_time, (new Date()).getTime())
+        if (obj.status == 'WAIT_FOR_START') return getTime(obj.fast.target_end_time, obj.sleep.target_end_time)
         if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return '未知'
-        return TimeFormatter.calculateTimeDifference(obj.fast.real_end_time, obj.sleep.real_end_time)
+        return getTime(obj.fast.real_end_time, obj.sleep.real_end_time)
     }
 
     function layoutContent() {
         //当前断食阶段
         var obj = isLatest ? (checkData as any).latest_record : (checkData as any).current_record
-        return <View style={{ flexDirection: 'column', display: 'flex',color:'#000' }}>
+        return <View style={{ flexDirection: 'column', display: 'flex', color: '#000' }}>
             {
                 obj.status == 'WAIT_FOR_START' ? <Text>断食阶段目标</Text> :
                     obj.status == 'COMPLETED' ? <Text>断食阶段</Text> :
@@ -269,25 +274,27 @@ export default function Component(props: { type?: string }) {
             value == 'WAIT_FOR_START' && <Text onClick={editSchedule}>调整日程</Text>
         }
         {
-            props.type == 'latest' && <Text onClick={showLatest}>Durations by stage</Text>
+            props.type == 'latest' && key == 'FAST_SLEEP' && <Text onClick={showLatest}>Durations by stage</Text>
         }
         {
-            props.type != 'latest' && (value == 'WAIT_FOR_START' ? <Text onClick={showStage}>Duration goals by stage</Text> : <Text onClick={showStage}>Current stage</Text>)
+            props.type != 'latest' && key == 'FAST_SLEEP' && (value == 'WAIT_FOR_START' ? <Text onClick={showStage}>Duration goals by stage</Text> : <Text onClick={showStage}>Current stage</Text>)
         }
 
-        <AtFloatLayout
-            isOpened={isOpen}
-            onClose={() => {
-                stopTimer()
-                setIsOpen(false)
-            }}
-            title="这是个标题">
-            {
-                checkData && layoutContent()
-            }
+        {
+            key == 'FAST_SLEEP' && <AtFloatLayout
+                isOpened={isOpen}
+                onClose={() => {
+                    stopTimer()
+                    setIsOpen(false)
+                }}
+                title="这是个标题">
+                {
+                    checkData && layoutContent()
+                }
 
 
-        </AtFloatLayout>
+            </AtFloatLayout>
+        }
         <Text style={{ opacity: 0 }}>{counter}</Text>
 
     </View >

+ 3 - 3
src/pages/clock.tsx

@@ -218,10 +218,10 @@ export default function IndexPage() {
       return <View />
     }
 
-    if ((checkData as any).current_record.scenario == 'FAST_SLEEP') {
+    // if ((checkData as any).current_record.scenario == 'FAST_SLEEP') {
       return <Schedule />
-    }
-    return <View />
+    // }
+    // return <View />
   }
 
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.