| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874 |
- import { WindowStatusType, WindowType } from "@/utils/types";
- import { View, Text, Image } from "@tarojs/components";
- import dayjs from "dayjs";
- import { useEffect, useRef, useState } from "react";
- import { useDispatch, useSelector } from "react-redux";
- import './MainConsole.scss'
- 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, updateEventDuration, updateSchedule, updateTarget } from "@/services/health";
- import TimePicker from "../common/TimePicker";
- import showActionSheet from "@/components/basic/ActionSheet";
- import { rpxToPx } from "@/utils/tools";
- import { setMode, setShowActionTip } from "@/store/health";
- import { getCountownTime, getDuration, getScenario, getThemeColor, getWindowStatus } from "./hooks/health_hooks";
- import { IconCellArrow, IconMore } from "@/components/basic/Icons";
- import DurationPicker from "@/_health/components/duration_picker";
- import Taro from "@tarojs/taro";
- import { systemLocation } from "@/services/common";
- import { TimeFormatter } from "@/utils/time_format";
- import { clearLocation } from "@/services/user";
- import OnBoard from "@/_health/components/onboard";
- import NewButton, { NewButtonType } from "@/_health/base/new_button";
- let useNavigation;
- let min = 0
- let max = 0
- let defaultTimestamp = 0
- if (process.env.TARO_ENV == 'rn') {
- useNavigation = require("@react-navigation/native").useNavigation
- }
- export default function MainConsole(props: { type: WindowType }) {
- const health = useSelector((state: any) => state.health);
- 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)
- const limitPickerRef = useRef(null)
- const dispatch = useDispatch()
- let navigation, showActionSheetWithOptions;
- if (useNavigation) {
- navigation = useNavigation()
- }
- useEffect(() => {
- }, [props.type])
- function edit(item) {
- if (item.scenario != 'FAST' && item.scenario != 'SLEEP') {
- return
- }
- if (item.action == 'NA' || item.action == 'POST_MOMENT' || 'SLEEP_WAKE_UP' == item.action) {
- return;
- }
- if (!user.isLogin) {
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
- return
- }
- console.log(item)
- setSelItem(item)
- setShowPicker(true)
- }
- function record(item) {
- if (!user.isLogin) {
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
- return
- }
- setSelItem(item)
- switch (item.action) {
- case 'START':
- {
- defaultTimestamp = new Date().getTime()
- min = defaultTimestamp - 1 * 24 * 3600 * 1000
- max = defaultTimestamp
- setOperateType('startFast')
- setShowTimePicker(true)
- }
- return;
- case 'END':
- {
- defaultTimestamp = new Date().getTime()
- // defaultTimestamp = e ? new Date().getTime() : logEventTimestamp
- min = defaultTimestamp - 1 * 24 * 3600 * 1000
- max = defaultTimestamp
- setOperateType('endFast')
- setShowTimePicker(true)
- }
- return;
- case 'MARK_DONE':
- {
- setBtnDisable(true)
- clockTimes({
- check_items: [{
- schedule_id: item.schedule_id,
- date: dayjs().format('YYYYMMDD'),
- timestamp: new Date().getTime()
- }]
- }).then(res => {
- // dispatch(setShowActionTip({
- // isShow: true,
- // isCompleted: (selItem.event == 'FAST_END' || selItem.event == 'SLEEP_WAKE_UP')
- // }))
- // setBtnDisable(false)
- // setShowTimePicker(false)
- global.refreshWindow()
- global.refreshHistory()
- }).catch(e => {
- })
- }
- return;
- }
- jumpPage(`/_health/pages/add_moment?moment=${JSON.stringify(item)}&title=${item.title}&schedule_id=${item.schedule_id}&event_id=${item.event_id}`)
- }
- function operateTitle(item) {
- switch (item.action) {
- case 'START':
- case 'END':
- return '打卡'
- case 'MARK_DONE':
- return 'Action'
- }
- return '记录'
- }
- function itemTitle(item: any) {
- // if (health.mode == 'DAY' || health.mode == 'NIGHT') {
- // return item.title
- // }
- if (item.real) {
- return dayjs(item.real.timestamp).format('HH:mm')
- }
- if (!item.target || !item.target.timestamp) {
- return item.time_label
- }
- return dayjs(item.target.timestamp).format('HH:mm')
- }
- function itemValue(item: any) {
- let themeColor: any = getThemeColor(health.mode)
- const scenario = getScenario(health.windows, health.mode)
- if (item.action == 'END' && !scenario.real) {
- themeColor = '#B2B2B2'
- }
- if (health.mode == 'DAY' || health.mode == 'NIGHT') {
- return null
- }
- if (item.action && item.action != 'NA') {
- if (health.mode == 'FAST' || health.mode == 'SLEEP') {
- if (item.action == 'POST_MOMENT') {
- return <IconCellArrow color='#B2B2B2' width={rpxToPx(34)} />
- }
- }
- else if (health.mode == 'ACTIVE' && item.action == 'POST_MOMENT') {
- return <NewButton
- color={themeColor}
- type={NewButtonType.border}
- title={operateTitle(item)}
- width={rpxToPx(128)}
- height={rpxToPx(72)}
- bold={true}
- onClick={() => record(item)} />
- // return <View className="timeline_operate" style={{ color: themeColor, backgroundColor: '#fff', borderColor: themeColor, borderWidth: 1, borderStyle: 'solid' }}
- // onClick={() => record(item)}>{operateTitle(item)}</View>
- }
- return <NewButton
- color={themeColor}
- type={NewButtonType.alpha}
- title={operateTitle(item)}
- width={rpxToPx(128)}
- height={rpxToPx(72)}
- bold={true}
- onClick={() => record(item)} />
- }
- return <View />
- }
- function tapTimeline(item, inex) {
- if (health.mode == 'DAY' || health.mode == 'NIGHT') {
- return;
- }
- if (!user.isLogin) {
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
- return
- }
- if (!item.event_id) {
- return
- }
- jumpPage(`/_health/pages/timeline_detail?event_id=${item.event_id}&schedule_id=${item.schedule_id}`)
- }
- function timelineItem(item: any, index: number, count: number) {
- var hasDescription = item.moment && item.moment.description
- return <View key={index}
- className="timeline_item"
- // hoverClass='cell_hover' hoverStayTime={50}
- onClick={() => tapTimeline(item, index)}>
- <View className="timeline_left">
- {/* space */}
- <View style={{
- height: hasDescription ? rpxToPx(28) : rpxToPx(36), flexShrink: 0
- }} />
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
- {/* {
- !item.reminder && <Image src={require('@assets/images/notification_off.png')} className='notification_icon' />
- } */}
- <View style={{
- flexShrink: 0,
- width: rpxToPx(28),
- height: rpxToPx(28),
- borderRadius: rpxToPx(14),
- marginRight: rpxToPx(8),
- backgroundColor: 'gray'
- }} />
- <Text className="timeline_time">{itemTitle(item)}</Text>
- </View>
- <Text className="timeline_title"
- onClick={() => edit(item)}>{(item.moment && item.moment.title) ? item.moment.title : item.title}</Text>
- {
- hasDescription && <Text className="timeline_desc">{item.moment.description}</Text>
- }
- {/* space */}
- <View style={{
- height: hasDescription ? rpxToPx(28) : rpxToPx(54), flexShrink: 0,
- }} />
- </View>
- <View style={{ flex: 1 }} />
- {
- item.moment && item.moment.media && item.moment.media.length > 0 && <Image
- src={item.moment.media[0].url}
- mode="aspectFill"
- className="console_item_img" />
- }
- {
- itemValue(item)
- }
- <View className="seperate_line" style={{ left: count - 1 == index ? -rpxToPx(52) : rpxToPx(52) }} />
- </View>
- }
- function timeContent() {
- return <Modal
- testInfo={null}
- dismiss={() => {
- setShowPicker(false)
- }}
- confirm={() => { }}>
- {
- pickerContent()
- }
- </Modal>
- }
- function pickerContent() {
- const timestamp = selItem.target.timestamp
- const strTime = dayjs(timestamp).format('HH:mm')
- var title, color;
- switch (selItem.scenario) {
- case 'FAST':
- title = selItem.event == 'FAST_END' ? '结束断食' : '开始断食'
- color = MainColorType.fast
- break;
- case 'SLEEP':
- title = selItem.event == 'SLEEP_WAKE_UP' ? '结束睡眠' : '开始睡眠'
- color = MainColorType.sleep
- }
- return <TimePicker time={strTime}
- color={color}
- title={title}
- confirm={(e) => {
- confirmPickerTime(e)
- }}
- cancel={() => {
- setShowPicker(false)
- }} />
- }
- 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()
- global.refreshHistory()
- 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()
- global.refreshHistory()
- setShowPicker(false)
- })
- return;
- }
- }
- updateSchedule({
- time: strTime,
- event: selItem.event,
- title: selItem.title,
- is_all_day: false
- }, selItem.schedule_id).then(res => {
- global.refreshWindow()
- global.refreshHistory()
- setShowPicker(false)
- })
- }
- function modalContent() {
- global.set_time = new Date().getTime()
- return <Modal
- testInfo={null}
- dismiss={() => {
- setShowTimePicker(false)
- }}
- confirm={() => { }}>
- {
- timePickerContent()
- }
- </Modal>
- }
- function timePickerContent() {
- var title, color;
- switch (selItem.scenario) {
- case 'FAST':
- title = selItem.event == 'FAST_END' ? '结束断食' : '开始断食'
- color = MainColorType.fast
- break;
- case 'SLEEP':
- title = selItem.event == 'SLEEP_WAKE_UP' ? '结束睡眠' : '开始睡眠'
- color = MainColorType.sleep
- break
- }
- var endTimestamp = 0
- if (selItem.envent == 'FAST_END') {
- endTimestamp = new Date().getTime()//fastData.target.end_time
- }
- var duration = 24 * 3600 * 1000//fastData.target.duration
- global.set_time = new Date().getTime()
- return <View className="modal_content">
- <ConsolePicker ref={limitPickerRef}
- themeColor={color}
- title={title}
- onCancel={() => {
- setShowTimePicker(false)
- }}
- min={min}
- max={max}
- current={defaultTimestamp}
- duration={duration}
- endTimestamp={endTimestamp}
- isFast={true}
- isEnd={operateType == 'endFast'}
- isTimeout={false}
- isLoading={btnDisable}
- onChange={(e) => {
- pickerConfirm(e, null)
- global.pauseIndexTimer = false
- }}
- />
- </View>
- }
- function pickerConfirm(t1: number, event: any) {
- if (btnDisable) {
- return
- }
- global.scenario = 'FAST'
- setBtnDisable(true)
- clockTimes({
- check_items: [{
- schedule_id: selItem.schedule_id,
- date: dayjs(t1).format('YYYYMMDD'),
- timestamp: t1,
- extra: {
- set_time: global.set_time ? global.set_time : new Date().getTime(),
- confirm_time: new Date().getTime()
- }
- }]
- }).then(res => {
- dispatch(setShowActionTip({
- isShow: true,
- isCompleted: (selItem.event == 'FAST_END' || selItem.event == 'SLEEP_WAKE_UP')
- }))
- setBtnDisable(false)
- setShowTimePicker(false)
- global.refreshWindow()
- global.refreshHistory()
- }).catch(e => {
- setBtnDisable(false)
- })
- }
- function more() {
- var list: any = []
- switch (health.mode) {
- case 'DAY':
- case 'NIGHT':
- list = ['设置提醒', '设置位置']
- break;
- case 'FAST':
- case 'SLEEP':
- {
- const obj = getScenario(health.windows, health.mode)
- if (obj.window_id) {
- list.push('编辑本次时长')
- if (obj.timeline && obj.timeline[0].moment) {
- list.push('删除本次记录')
- }
- }
- list.push('编辑日程列表')
- }
- break;
- case 'EAT':
- {
- list = [
- 'Add Snack',
- '编辑日程列表',
- ]
- if (getScenario(health.windows, health.mode).window_id) {
- list.push('Make done')
- }
- }
- break;
- case 'ACTIVE':
- {
- list = [
- '记录一次活动',
- '编辑日程列表',
- ]
- if (getScenario(health.windows, health.mode).window_id) {
- list.push('Make done')
- }
- }
- break;
- }
- showActionSheet({
- showActionSheetWithOptions: showActionSheetWithOptions,
- title: 'Oprate Title',
- itemList: list,
- success: (res) => {
- tapActionSheet(res)
- }
- });
- }
- function tapActionSheet(index) {
- switch (index) {
- case 0:
- {
- switch (health.mode) {
- case 'DAY':
- case 'NIGHT':
- jumpPage('/_health/pages/schedules?mode=' + health.mode)
- break;
- case 'FAST':
- case 'SLEEP':
- {
- const obj = getScenario(health.windows, health.mode)
- if (obj.window_id) {
- //编辑本次时长
- setDurationPicker(true)
- }
- else {
- jumpPage('/_health/pages/schedules?mode=' + health.mode)
- }
- }
- break;
- case 'EAT':
- //add snack
- jumpPage(`/_health/pages/add_moment?title=加餐&is_temp=${true}`)
- break;
- case 'ACTIVE':
- //记录一次活动
- jumpPage(`/_health/pages/add_moment?title=&is_temp=${true}`)
- break;
- }
- }
- break;
- case 1:
- {
- switch (health.mode) {
- case 'EAT':
- jumpPage('/_health/pages/schedules?mode=' + health.mode)
- break;
- case 'FAST':
- case 'SLEEP':
- const obj = getScenario(health.windows, health.mode)
- if (obj.window_id) {
- //del record
- jumpPage('/_health/pages/schedules?mode=' + health.mode)
- console.log('zzzzzzzzz')
- }
- else {
- }
- break;
- case 'ACTIVE':
- jumpPage('/_health/pages/schedules?mode=' + health.mode)
- break;
- case 'DAY':
- case 'NIGHT':
- chooseLocation()
- break;
- }
- }
- break;
- case 2:
- {
- switch (health.mode) {
- case 'EAT':
- case 'ACTIVE':
- tapMakeDone()
- break;
- }
- }
- break;
- }
- }
- function tapMakeDone() {
- makeDone(getScenario(health.windows, health.mode).window_id).then(res => {
- global.refreshWindow()
- global.refreshHistory()
- })
- }
- function detail() {
- const { day, night } = health.windows.night_day
- const { fast, eat } = health.windows.fast_eat
- const { sleep, active } = health.windows.sleep_active
- let list: any = []
- switch (health.mode) {
- case 'DAY':
- list = day.timeline
- if (day.onboard == false) {
- return <OnBoard title='你还没有开启位置授权'
- desc="获取准确的日出日落信息需要您开启微信运动授权,点击下方按钮进行授权"
- btnTitle="去开启"
- onClick={chooseLocation}
- />
- }
- break;
- case 'NIGHT':
- list = night.timeline
- if (night.onboard == false) {
- return <OnBoard title='你还没有开启位置授权'
- desc='获取准确的日出日落信息需要您开启微信运动授权,点击下方按钮进行授权'
- btnTitle="去开启"
- onClick={chooseLocation}
- />
- }
- break;
- case 'FAST':
- list = fast.timeline
- break;
- case 'EAT':
- list = eat.timeline
- break;
- case 'SLEEP':
- list = sleep.timeline
- break;
- case 'ACTIVE':
- list = active.timeline
- if (active.onboard == false) {
- return <OnBoard title={list[0].title}
- desc="Subtitle"
- btnTitle="Action"
- onClick={() => {
- jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
- }}
- />
- }
- break;
- }
- return <View>
- {
- list.map((item, index) => {
- return timelineItem(item, index, list.length)
- })
- }
- </View>
- }
- function switchText() {
- switch (health.mode) {
- case 'FAST':
- return 'Switch to Eat'
- case 'EAT':
- return 'Switch to Fast'
- case 'DAY':
- return 'Switch to Night'
- case 'NIGHT':
- return 'Switch to Daylight'
- case 'SLEEP':
- return 'Switch to Activity'
- case 'ACTIVE':
- return 'Switch to Sleep'
- }
- return ''
- }
- function tapSwitchBtn() {
- switch (health.mode) {
- case 'FAST':
- dispatch(setMode('EAT'));
- break
- case 'EAT':
- dispatch(setMode('FAST'));
- break
- case 'DAY':
- dispatch(setMode('NIGHT'));
- break
- case 'NIGHT':
- dispatch(setMode('DAY'));
- break
- case 'SLEEP':
- dispatch(setMode('ACTIVE'));
- break
- case 'ACTIVE':
- dispatch(setMode('SLEEP'));
- break
- }
- }
- function windowStatus() {
- var statusType = getWindowStatus(health.windows, health.mode)
- switch (statusType) {
- case WindowStatusType.open:
- return 'New open'
- case WindowStatusType.process:
- return 'In process'
- case WindowStatusType.upcoming:
- return 'Upcoming'
- }
- return ''
- }
- function tapClearLocation() {
- Taro.showModal({
- title: '提示',
- content: '确认清除位置数据?',
- success: function (res) {
- if (res.confirm) {
- clearLocation().then(res => {
- global.refreshWindow()
- })
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- }
- function chooseLocation() {
- if (!user.isLogin) {
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
- return
- }
- Taro.chooseLocation({
- // latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
- // longitude: authInfo && authInfo.lat ? authInfo.lng : undefined,
- success: function (res) {
- uploadLocation(res)
- },
- fail(res) {
- Taro.showToast({
- title: '位置修改失败!\n请重新选择就近位置',
- icon: 'none'
- })
- },
- complete(res) {
- }
- })
- }
- function uploadLocation(res) {
- var today = new Date()
- var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
- var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 5)
- var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
- var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
- systemLocation({
- lat: res.latitude,
- lng: res.longitude,
- name: res.name,
- address: res.address,
- date_start: strYesterday,
- date_end: strTomorrow,
- coordinate_system_standard: process.env.TARO_ENV == 'weapp' ? 'GCJ-02' : 'WGS-84'
- }).then(data => {
- global.refreshWindow()
- })
- }
- function updateDuration(duration) {
- setDurationPicker(false)
- const scenario = getScenario(health.windows, health.mode)
- updateEventDuration(scenario.timeline[0].event_id, duration).then(res => {
- global.refreshWindow()
- })
- }
- function timePointClass() {
- if (getWindowStatus(health.windows, health.mode) == WindowStatusType.process) {
- return 'time_point time_point_animation'
- }
- return 'time_point'
- }
- return <View className="main-console-bg">
- <Image className="main_arrow" src={require('@assets/images/center_arrow.png')} />
- <View className="main_summary">
- {/* <View className="main_summary_status" style={{ color: getThemeColor(health.mode) }}>{windowStatus()}</View> */}
- <View className="main_summary_time" style={{ color: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : '#000' }}>{getCountownTime(health.windows, health.mode)}
- <View className={timePointClass()}
- style={{ backgroundColor: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : getThemeColor(health.mode) }} />
- </View>
- <Text className="main_summary_duration">Total {getDuration(health.windows, health.mode)}</Text>
- <View className="border_footer_line" />
- </View>
- <View style={{ backgroundColor: '#fff', width: rpxToPx(750) }}>
- {
- detail()
- }
- {
- health.mode == 'ACTIVE' && <View onClick={() => {
- var list = getScenario(health.windows, health.mode).timeline
- jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
- }}>测试</View>
- }
- </View>
- <View className="main_footer">
- <Text className="main_footer_text" onClick={tapSwitchBtn}>{switchText()}</Text>
- {/* {
- (health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={more}>更多</Text>
- } */}
- {/* {
- (health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={chooseLocation}>选择位置</Text>
- } */}
- {
- (health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={tapClearLocation}>清除位置</Text>
- }
- <View className="main_footer_more" onClick={more}>
- <IconMore color="#b2b2b2" width={17} />
- </View>
- </View>
- {
- health.mode == 'ACTIVE' && <View className="console_active_bg" onClick={() => {
- if (!user.isLogin) {
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
- return
- }
- jumpPage('/_health/pages/move')
- }}>
- <View className="console_active">
- <Image className="active_icon" src={require('@assets/_health/walk.png')} />
- <Text className="active_text">Move More</Text>
- <Image className="cell_arrow" src={require('@assets/_health/cell_arrow.png')} />
- </View>
- </View>
- }
- {
- health.mode == 'FAST' && <View className="console_active_bg" onClick={() => {
- if (!user.isLogin) {
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
- return
- }
- jumpPage('/_health/pages/fast_sleep')
- }}>
- <View className="console_active">
- <Image className="active_icon" src={require('@assets/_health/fast.png')} />
- <Text className="active_text">Fast with sleep</Text>
- <Image className="cell_arrow" src={require('@assets/_health/cell_arrow.png')} />
- </View>
- </View>
- }
- {
- health.mode == 'FAST' && <View className="console_active_bg" onClick={() => {
- if (!user.isLogin) {
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
- return
- }
- jumpPage('/_health/pages/long_fast')
- }}>
- <View className="console_active">
- <Image className="active_icon" src={require('@assets/_health/fast.png')} />
- <Text className="active_text">Long fast</Text>
- <Image className="cell_arrow" src={require('@assets/_health/cell_arrow.png')} />
- </View>
- </View>
- }
- <View className="circle" />
- {
- showTimePicker && modalContent()
- }
- {
- showPicker && timeContent()
- }
- {
- durationPicker && <DurationPicker
- done={(time) => {
- updateDuration(time)
- }}
- dismiss={() => {
- setDurationPicker(false)
- }} time={getScenario(health.windows, health.mode).target.duration} />
- }
- </View>
- }
|