|
@@ -1,4 +1,4 @@
|
|
|
-import { View, Text,Image } from "@tarojs/components";
|
|
|
|
|
|
|
+import { View, Text, Image } from "@tarojs/components";
|
|
|
import './MainCard.scss'
|
|
import './MainCard.scss'
|
|
|
import { useEffect, useRef, useState } from "react";
|
|
import { useEffect, useRef, useState } from "react";
|
|
|
import Modal from "@/components/layout/Modal.weapp";
|
|
import Modal from "@/components/layout/Modal.weapp";
|
|
@@ -9,13 +9,15 @@ import moment from 'moment-timezone'
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
import { fastWindow, setSchedule, updateRecord } from "@/services/trackTimeDuration";
|
|
import { fastWindow, setSchedule, updateRecord } from "@/services/trackTimeDuration";
|
|
|
import { useSelector } from "react-redux";
|
|
import { useSelector } from "react-redux";
|
|
|
-import { jumpPage } from "../hooks/Common";
|
|
|
|
|
-import ConsolePicker from "./ConsolePicker";
|
|
|
|
|
-import { endFast, startFast } from "../actions/TrackTimeActions";
|
|
|
|
|
|
|
+import { jumpPage } from "../trackTimeDuration/hooks/Common";
|
|
|
|
|
+import ConsolePicker from "../trackTimeDuration/components/ConsolePicker";
|
|
|
|
|
+import { endFast, startFast } from "../trackTimeDuration/actions/TrackTimeActions";
|
|
|
import formatMilliseconds from "@/utils/format_time";
|
|
import formatMilliseconds from "@/utils/format_time";
|
|
|
import TimePicker from "@/features/common/TimePicker";
|
|
import TimePicker from "@/features/common/TimePicker";
|
|
|
import showAlert from "@/components/basic/Alert";
|
|
import showAlert from "@/components/basic/Alert";
|
|
|
import showActionSheet from "@/components/basic/ActionSheet";
|
|
import showActionSheet from "@/components/basic/ActionSheet";
|
|
|
|
|
+import { records } from "@/services/health";
|
|
|
|
|
+import MainHistory from "./MainHistory";
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
|
|
|
|
|
|
let Linking, PushNotification;
|
|
let Linking, PushNotification;
|
|
@@ -53,10 +55,12 @@ export default function MainFastEatCard(props: { count: any }) {
|
|
|
const [showPicker, setShowPicker] = useState(false)
|
|
const [showPicker, setShowPicker] = useState(false)
|
|
|
const [isStart, setIsStart] = useState(true)
|
|
const [isStart, setIsStart] = useState(true)
|
|
|
const [loaded, setLoaded] = useState(false)
|
|
const [loaded, setLoaded] = useState(false)
|
|
|
|
|
+ const [eats, setEats] = useState<any>([])
|
|
|
|
|
+ const [fasts, setFasts] = useState<any>([])
|
|
|
|
|
|
|
|
const user = useSelector((state: any) => state.user);
|
|
const user = useSelector((state: any) => state.user);
|
|
|
|
|
|
|
|
- let navigation,showActionSheetWithOptions;
|
|
|
|
|
|
|
+ let navigation, showActionSheetWithOptions;
|
|
|
if (useNavigation) {
|
|
if (useNavigation) {
|
|
|
navigation = useNavigation()
|
|
navigation = useNavigation()
|
|
|
showActionSheetWithOptions = useActionSheet()
|
|
showActionSheetWithOptions = useActionSheet()
|
|
@@ -91,10 +95,13 @@ export default function MainFastEatCard(props: { count: any }) {
|
|
|
}
|
|
}
|
|
|
}, [props.count])
|
|
}, [props.count])
|
|
|
|
|
|
|
|
|
|
+
|
|
|
global.refreshFastEat = () => {
|
|
global.refreshFastEat = () => {
|
|
|
refresh()
|
|
refresh()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
function refresh() {
|
|
function refresh() {
|
|
|
fastWindow().then(res => {
|
|
fastWindow().then(res => {
|
|
|
const { eat_win, fast_win } = res
|
|
const { eat_win, fast_win } = res
|
|
@@ -590,10 +597,10 @@ export default function MainFastEatCard(props: { count: any }) {
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function more(){
|
|
|
|
|
|
|
+ function more() {
|
|
|
showActionSheet({
|
|
showActionSheet({
|
|
|
showActionSheetWithOptions: showActionSheetWithOptions,
|
|
showActionSheetWithOptions: showActionSheetWithOptions,
|
|
|
- title:'Oprate Title',
|
|
|
|
|
|
|
+ title: 'Oprate Title',
|
|
|
itemList: [
|
|
itemList: [
|
|
|
'Add Snack',
|
|
'Add Snack',
|
|
|
'自定义餐次列表',
|
|
'自定义餐次列表',
|
|
@@ -670,17 +677,17 @@ export default function MainFastEatCard(props: { count: any }) {
|
|
|
!isFastMode && <View>
|
|
!isFastMode && <View>
|
|
|
{
|
|
{
|
|
|
eatData.meals.map((item, index) => {
|
|
eatData.meals.map((item, index) => {
|
|
|
- return <View className="log_row" style={{justifyContent:'flex-start'}} key={index}>
|
|
|
|
|
|
|
+ return <View className="log_row" style={{ justifyContent: 'flex-start' }} key={index}>
|
|
|
{
|
|
{
|
|
|
- item.real_start_time && item.media && item.media.length>0 && item.media[0].url && <Image src={item.media[0].url} style={{width:50,height:50,marginRight:10}}/>
|
|
|
|
|
|
|
+ item.real_start_time && item.media && item.media.length > 0 && item.media[0].url && <Image src={item.media[0].url} style={{ width: 50, height: 50, marginRight: 10 }} />
|
|
|
}
|
|
}
|
|
|
<View className="schedule">
|
|
<View className="schedule">
|
|
|
<Text className="schedule_name">{item.name}</Text>
|
|
<Text className="schedule_name">{item.name}</Text>
|
|
|
<Text className="schedule_time">
|
|
<Text className="schedule_time">
|
|
|
- {item.real_start_time ?dayjs(item.real_start_time).format('HH:mm')+' - '+dayjs(item.real_end_time).format('HH:mm'):item.schedule_start_time}
|
|
|
|
|
|
|
+ {item.real_start_time ? dayjs(item.real_start_time).format('HH:mm') + ' - ' + dayjs(item.real_end_time).format('HH:mm') : item.schedule_start_time}
|
|
|
</Text>
|
|
</Text>
|
|
|
</View>
|
|
</View>
|
|
|
- <View style={{flex:1}}/>
|
|
|
|
|
|
|
+ <View style={{ flex: 1 }} />
|
|
|
{
|
|
{
|
|
|
item.real_start_time ? <View className="fast_log_btn fast_log_btn_disable">已记录</View> : <View onClick={() => goAddEat(item, index)} className={enableMeal(item) ? "fast_log_btn fast_log_eat_btn" : "fast_log_btn fast_log_btn_disable"}>Add</View>
|
|
item.real_start_time ? <View className="fast_log_btn fast_log_btn_disable">已记录</View> : <View onClick={() => goAddEat(item, index)} className={enableMeal(item) ? "fast_log_btn fast_log_eat_btn" : "fast_log_btn fast_log_btn_disable"}>Add</View>
|
|
|
}
|
|
}
|
|
@@ -697,6 +704,7 @@ export default function MainFastEatCard(props: { count: any }) {
|
|
|
{
|
|
{
|
|
|
!isFastMode && <Text onClick={more}>更多</Text>
|
|
!isFastMode && <Text onClick={more}>更多</Text>
|
|
|
}
|
|
}
|
|
|
|
|
+ <MainHistory type={isFastMode ? 'FAST' : 'EAT'} />
|
|
|
{
|
|
{
|
|
|
showModal && <Modal dismiss={() => setShowModal(false)}>
|
|
showModal && <Modal dismiss={() => setShowModal(false)}>
|
|
|
<View style={{ width: 100, height: 100, backgroundColor: 'red' }}>{props.count}</View>
|
|
<View style={{ width: 100, height: 100, backgroundColor: 'red' }}>{props.count}</View>
|