|
|
@@ -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();
|