|
|
@@ -8,13 +8,14 @@ import { jumpPage } from "../trackTimeDuration/hooks/Common";
|
|
|
import Modal from "@/components/layout/Modal.weapp";
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
import ConsolePicker from "../trackTimeDuration/components/ConsolePicker";
|
|
|
-import { clockTimes, makeDone, updateSchedule, updateTarget } from "@/services/health";
|
|
|
+import { clockTimes, makeDone, updateEventDuration, updateSchedule, updateTarget } from "@/services/health";
|
|
|
import TimePicker from "../common/TimePicker";
|
|
|
import showActionSheet from "@/components/basic/ActionSheet";
|
|
|
import { rpxToPx } from "@/utils/tools";
|
|
|
import { setMode } from "@/store/health";
|
|
|
import { getCountownTime, getDuration, getScenario, getThemeColor, getWindowStatus } from "./hooks/health_hooks";
|
|
|
import { IconMore } from "@/components/basic/Icons";
|
|
|
+import DurationPicker from "@/_health/components/duration_picker";
|
|
|
|
|
|
let useNavigation;
|
|
|
let min = 0
|
|
|
@@ -30,6 +31,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
const user = useSelector((state: any) => state.user);
|
|
|
const [showPicker, setShowPicker] = useState(false)
|
|
|
const [showTimePicker, setShowTimePicker] = useState(false)
|
|
|
+ const [durationPicker,setDurationPicker] = useState(false)
|
|
|
const [operateType, setOperateType] = useState('')
|
|
|
const [btnDisable, setBtnDisable] = useState(false)
|
|
|
const [selItem, setSelItem] = useState<any>(null)
|
|
|
@@ -394,7 +396,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
switch (health.mode) {
|
|
|
case 'DAY':
|
|
|
case 'NIGHT':
|
|
|
- jumpPage('/_health/pages/setting_reminder')
|
|
|
+ jumpPage('/_health/pages/schedules_list')
|
|
|
break;
|
|
|
case 'FAST':
|
|
|
case 'SLEEP':
|
|
|
@@ -402,6 +404,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
const obj = getScenario(health.windows, health.mode)
|
|
|
if (obj.window_id) {
|
|
|
//编辑本次时长
|
|
|
+ setDurationPicker(true)
|
|
|
}
|
|
|
else {
|
|
|
jumpPage('/_health/pages/schedules_list')
|
|
|
@@ -428,6 +431,8 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
const obj = getScenario(health.windows, health.mode)
|
|
|
if (obj.window_id) {
|
|
|
//del record
|
|
|
+
|
|
|
+ console.log('zzzzzzzzz')
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
@@ -549,6 +554,14 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
}
|
|
|
return ''
|
|
|
}
|
|
|
+
|
|
|
+ function updateDuration(duration){
|
|
|
+ setDurationPicker(false)
|
|
|
+ const scenario = getScenario(health.windows,health.mode)
|
|
|
+ updateEventDuration(scenario.timeline[0].event_id,scenario.target.start_timestamp+duration).then(res=>{
|
|
|
+ global.refreshWindow()
|
|
|
+ })
|
|
|
+ }
|
|
|
return <View className="main-console-bg">
|
|
|
<Image className="main_arrow" src={require('@assets/images/center_arrow.png')} />
|
|
|
<View className="main_summary">
|
|
|
@@ -579,5 +592,14 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
{
|
|
|
showPicker && timeContent()
|
|
|
}
|
|
|
+ {
|
|
|
+ durationPicker && <DurationPicker
|
|
|
+ done={(time)=>{
|
|
|
+ updateDuration(time)
|
|
|
+ }}
|
|
|
+ dismiss={()=>{
|
|
|
+ setDurationPicker(false)
|
|
|
+ }} time={getScenario(health.windows,health.mode).target.duration}/>
|
|
|
+ }
|
|
|
</View>
|
|
|
}
|