| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- import { View, Text, Image } from "@tarojs/components";
- import './guide.scss'
- import '@/_health/pages/schedules.scss'
- import NewHeader, { NewHeaderType } from "../components/new_header";
- import { useEffect, useState } from "react";
- import { createSchedule, getSchedules } from "@/services/health";
- import { setSchedules } from "@/store/health";
- import { useDispatch, useSelector } from "react-redux";
- import Card from "../components/card";
- import { rpxToPx } from "@/utils/tools";
- import { getThemeColor } from "@/features/health/hooks/health_hooks";
- import Modal from "@/components/layout/Modal.weapp";
- import TimePicker from "@/features/common/TimePicker";
- import NewButton, { NewButtonType } from "../base/new_button";
- import { MainColorType } from "@/context/themes/color";
- import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
- import ScheduleItem from "../components/schedule_item";
- import { useTranslation } from "react-i18next";
- import CellFooter, { CellFooterType } from "../base/cell_footer";
- import CellFooterText from "../base/cell_footer_text";
- export default function GuideFull() {
- const health = useSelector((state: any) => state.health);
- const [errors, setErrors] = useState<any>([])
- const [selItem, setSelItem] = useState<any>(null)
- const {t} = useTranslation()
- const dispatch = useDispatch()
- const selMode = 'SLEEP'
- useEffect(() => {
- }, [])
- function commit(){
- createSchedule({
- schedules: health.schedules,
- op_page:'SCHEDULE_FINISH_SETUP'
- // only_check: true
- }).then(res => {
- const data={
- title:t('health.guide_done_title'),
- description:t('health.guide_done_desc'),
- current_window:(res as any).current_window
- }
- jumpPage('./post_result?type=schedule&data='+JSON.stringify(data))
- global.refreshWindow()
- })
-
-
- }
- function footerDesc() {
- if (health.footer) {
- return health.footer.summary.description
- }
- return ''
- }
- function items() {
-
- var array = JSON.parse(JSON.stringify(health.schedules))
- array.sort((a, b) => {
- return a.time.localeCompare(b.time);
- });
- return <Card>
- {
- array.map((obj, i) => {
- return <ScheduleItem
- key={i * 100}
- obj={obj}
- disable
- showLine={i < array.length - 1}
- errors={errors}
- selMode={selMode}
- />
- })
- }
- </Card>
- }
- return <View style={{ flex: 1, display: 'flex', flexDirection: 'column', height: '100vh' }}>
- <NewHeader type={NewHeaderType.center_subtitle} title={t('health.guide_end_title')} subtitle={t('health.guide_end_desc')} />
- {
- items()
- }
- <CellFooter type={CellFooterType.left}>
- <View style={{display:'flex',flexDirection:'column'}}>
- <CellFooterText text={footerDesc()} />
- </View>
- </CellFooter>
- <View style={{height:300,flexShrink:0}}/>
- <View style={{flex:1}}/>
- <View className="main_footer">
- <NewButton
- type={NewButtonType.fill}
- title="完成"
- color={MainColorType.fast}
- width={rpxToPx(646)}
- height={rpxToPx(96)}
- onClick={commit}
- />
- </View>
- </View>
- }
|