import { View, Text, Switch } from "@tarojs/components"; import './move_setting_reminder.scss' import './move_schedule.scss' import Cell from "../base/cell"; import { useEffect, useState } from "react"; import { createSchedule, getMoveSchedules } from "@/services/health"; import { getThemeColor } from "@/features/health/hooks/health_hooks"; import NewHeader, { NewHeaderType } from "../components/new_header"; import { IconNotification, IconNotificationOff } from "@/components/basic/Icons"; import { MainColorType } from "@/context/themes/color"; import { rpxToPx } from "@/utils/tools"; import StatusIndicator, { StatusType } from "../base/status_indicator"; import Layout from "@/components/layout/layout"; import { NaviBarTitleShowType, TemplateType } from "@/utils/types"; export default function MoveSettingReminder() { const [selIndex, setSelIndex] = useState(-1) const [hours, setHours] = useState('') const [total, setTotal] = useState('') const [detail, setDetail] = useState(null) useEffect(() => { getData() }, []) function getData() { getMoveSchedules().then(res => { setDetail(res) setHours((res as any).goal.hour) setTotal((res as any).goal.day) }) } if (!detail) return function detailContent() { return { detail.schedules.map((item, index) => { return {/* {item.reminder_time} check in for {item.time}-{item.end_time} */} Check in at {item.reminder_time} {item.title} {/* {item.real_steps}/{item.target_steps} steps */} { item.reminder ? : } { console.log(item) createSchedule({ schedules: [{ id: item.id, reminder: e.detail.value }], }).then(res => { getData() if (global.refreshWindow) { global.refreshWindow() } if (global.refreshSchedules) { global.refreshSchedules() } if (global.updateMove) { global.updateMove() } }) }} /> { index < detail.schedules.length - 1 && } }) } } return }