|
@@ -8,7 +8,7 @@ import { jumpPage } from "../trackTimeDuration/hooks/Common";
|
|
|
import Modal from "@/components/layout/Modal.weapp";
|
|
import Modal from "@/components/layout/Modal.weapp";
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
import ConsolePicker from "../trackTimeDuration/components/ConsolePicker";
|
|
import ConsolePicker from "../trackTimeDuration/components/ConsolePicker";
|
|
|
-import { clockTimes, updateSchedule } from "@/services/health";
|
|
|
|
|
|
|
+import { clockTimes, updateSchedule, updateTarget } from "@/services/health";
|
|
|
import TimePicker from "../common/TimePicker";
|
|
import TimePicker from "../common/TimePicker";
|
|
|
import showActionSheet from "@/components/basic/ActionSheet";
|
|
import showActionSheet from "@/components/basic/ActionSheet";
|
|
|
|
|
|
|
@@ -45,10 +45,15 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
if (item.scenario != 'FAST' && item.scenario != 'SLEEP') {
|
|
if (item.scenario != 'FAST' && item.scenario != 'SLEEP') {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (item.action == 'NA' || item.action == 'POST_MOMENT' ||'SLEEP_WAKE_UP' == item.action) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!user.isLogin) {
|
|
if (!user.isLogin) {
|
|
|
jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+ console.log(item)
|
|
|
setSelItem(item)
|
|
setSelItem(item)
|
|
|
setShowPicker(true)
|
|
setShowPicker(true)
|
|
|
}
|
|
}
|
|
@@ -150,6 +155,38 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function confirmPickerTime(strTime) {
|
|
function confirmPickerTime(strTime) {
|
|
|
|
|
+ if (selItem.event == 'FAST_END') {
|
|
|
|
|
+ const obj = health.windows.fast_eat.fast.timeline[0]
|
|
|
|
|
+ if (obj.action=='POST_MOMENT' || obj.action == 'NA') {
|
|
|
|
|
+ const format = dayjs(obj.target.timestamp).format(`YYYY-MM-DDT${strTime}:ss`)
|
|
|
|
|
+ var t = new Date(format).getTime()
|
|
|
|
|
+ if (t <= obj.target.timestamp) {
|
|
|
|
|
+ t += 24 * 3600 * 1000
|
|
|
|
|
+ }
|
|
|
|
|
+ updateTarget(t, obj.event_id).then(res => {
|
|
|
|
|
+ global.refreshWindow()
|
|
|
|
|
+ setShowPicker(false)
|
|
|
|
|
+ })
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (selItem.event == 'SLEEP_WAKE_UP') {
|
|
|
|
|
+ const obj = health.windows.sleep_active.sleep.timeline[0]
|
|
|
|
|
+ if (obj.action=='POST_MOMENT' || obj.action == 'NA') {
|
|
|
|
|
+ const format = dayjs(obj.target.timestamp).format(`YYYY-MM-DDT${strTime}:ss`)
|
|
|
|
|
+ var t = new Date(format).getTime()
|
|
|
|
|
+ if (t <= obj.target.timestamp) {
|
|
|
|
|
+ t += 24 * 3600 * 1000
|
|
|
|
|
+ }
|
|
|
|
|
+ updateTarget(t, obj.event_id).then(res => {
|
|
|
|
|
+ global.refreshWindow()
|
|
|
|
|
+ setShowPicker(false)
|
|
|
|
|
+ })
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log('zzz')
|
|
|
|
|
+
|
|
|
updateSchedule({
|
|
updateSchedule({
|
|
|
time: strTime
|
|
time: strTime
|
|
|
}, selItem.schedule_id).then(res => {
|
|
}, selItem.schedule_id).then(res => {
|
|
@@ -318,7 +355,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
detail()
|
|
detail()
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
- (health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text style={{display:'flex',alignItems:'center',justifyContent:'center'}} onClick={more}>更多</Text>
|
|
|
|
|
|
|
+ (health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={more}>更多</Text>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
showTimePicker && modalContent()
|
|
showTimePicker && modalContent()
|