|
@@ -1,4 +1,4 @@
|
|
|
-import { View, Text } from "@tarojs/components";
|
|
|
|
|
|
|
+import { View, Text, Image } from "@tarojs/components";
|
|
|
import { useEffect, useRef, useState } from "react";
|
|
import { useEffect, useRef, useState } from "react";
|
|
|
import HistoryEatItem from "./HistoryEatItem";
|
|
import HistoryEatItem from "./HistoryEatItem";
|
|
|
import HistoryFastItem from "./HistoryFastItem";
|
|
import HistoryFastItem from "./HistoryFastItem";
|
|
@@ -12,6 +12,7 @@ import HistoryItem from "./HistoryItem";
|
|
|
import { rpxToPx } from "@/utils/tools";
|
|
import { rpxToPx } from "@/utils/tools";
|
|
|
import { jumpPage } from "../trackTimeDuration/hooks/Common";
|
|
import { jumpPage } from "../trackTimeDuration/hooks/Common";
|
|
|
import Taro from "@tarojs/taro";
|
|
import Taro from "@tarojs/taro";
|
|
|
|
|
+import { getThemeColor } from "./hooks/health_hooks";
|
|
|
|
|
|
|
|
let lastMode = ''
|
|
let lastMode = ''
|
|
|
export default function MainHistory(props: { type: string }) {
|
|
export default function MainHistory(props: { type: string }) {
|
|
@@ -65,13 +66,13 @@ export default function MainHistory(props: { type: string }) {
|
|
|
setList([...list, ...(res as any).data])
|
|
setList([...list, ...(res as any).data])
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if ((res as any).data.length>0){
|
|
|
|
|
- setTimeout(()=>{
|
|
|
|
|
|
|
+ if ((res as any).data.length > 0) {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
const query = Taro.createSelectorQuery();
|
|
const query = Taro.createSelectorQuery();
|
|
|
query.select(('#demo1')).boundingClientRect((rect) => {
|
|
query.select(('#demo1')).boundingClientRect((rect) => {
|
|
|
console.log(rect)
|
|
console.log(rect)
|
|
|
}).exec();
|
|
}).exec();
|
|
|
- },1000)
|
|
|
|
|
|
|
+ }, 1000)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
})
|
|
})
|
|
@@ -80,7 +81,7 @@ export default function MainHistory(props: { type: string }) {
|
|
|
if (!loaded)
|
|
if (!loaded)
|
|
|
return <View />
|
|
return <View />
|
|
|
|
|
|
|
|
- return <View style={{ width: rpxToPx(750),marginTop:rpxToPx(35) }}>
|
|
|
|
|
|
|
+ return <View style={{ width: rpxToPx(750), marginTop: rpxToPx(35) }}>
|
|
|
{/* <Calendar year={2024} month={8}/> */}
|
|
{/* <Calendar year={2024} month={8}/> */}
|
|
|
{/* <View style={{
|
|
{/* <View style={{
|
|
|
// position: 'sticky',
|
|
// position: 'sticky',
|
|
@@ -90,17 +91,40 @@ export default function MainHistory(props: { type: string }) {
|
|
|
zIndex: 100
|
|
zIndex: 100
|
|
|
}} /> */}
|
|
}} /> */}
|
|
|
{
|
|
{
|
|
|
- list.length>0 && <View className="recent">
|
|
|
|
|
|
|
+ list.length > 0 && <View className="recent">
|
|
|
<Text className="recent_text">Recent</Text>
|
|
<Text className="recent_text">Recent</Text>
|
|
|
- <View className="border_footer_line"/>
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ health.mode == 'EAT' && <View onClick={() => {
|
|
|
|
|
+ jumpPage('/_health/pages/archive')
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <Image className="archive" src={require('@assets/_health/archive.png')} />
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ <View className="border_footer_line" />
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ health.mode == 'EAT' && health.eatArchived && health.eatArchived.archived && <View className="recent" style={{justifyContent:'center'}}>
|
|
|
|
|
+ <View className="archived_bg" onClick={() => {
|
|
|
|
|
+ jumpPage('/_health/pages/archive')
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <Text className="archived_text" style={{color:getThemeColor(health.mode)}}>[{health.eatArchived.real_count}/{health.eatArchived.target_count} Meals] Archived Yesterday</Text>
|
|
|
|
|
+ {
|
|
|
|
|
+ health.eatArchived.images.map((item,index)=>{
|
|
|
|
|
+ return <Image src={item} key={index} className="archived_img" mode="aspectFill"/>
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View className="border_footer_line" />
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
list.map((item, index) => {
|
|
list.map((item, index) => {
|
|
|
return <View ref={refDemo} id="demo1" key={index}>
|
|
return <View ref={refDemo} id="demo1" key={index}>
|
|
|
- <HistoryItem data={item} index={index} onClick={()=>{
|
|
|
|
|
|
|
+ <HistoryItem data={item} index={index} onClick={() => {
|
|
|
jumpPage('/_health/pages/moment_detail')
|
|
jumpPage('/_health/pages/moment_detail')
|
|
|
- }}/>
|
|
|
|
|
|
|
+ }} />
|
|
|
{/* {
|
|
{/* {
|
|
|
props.type == 'EAT' && <HistoryEatItem data={item} index={index} />
|
|
props.type == 'EAT' && <HistoryEatItem data={item} index={index} />
|
|
|
}
|
|
}
|
|
@@ -117,7 +141,7 @@ export default function MainHistory(props: { type: string }) {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
- (list.length>0)&&(total == list.length) && <Text className="no_more">没有更多了</Text>
|
|
|
|
|
|
|
+ (list.length > 0) && (total == list.length) && <Text className="no_more">没有更多了</Text>
|
|
|
}
|
|
}
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|