|
|
@@ -71,7 +71,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
|
|
|
|
|
|
useEffect(() => {
|
|
|
// if (props.type == 'FAST,SLEEP' || (props.fast_type && props.fast_type == 'LF')) {
|
|
|
-
|
|
|
+
|
|
|
// }
|
|
|
// else {
|
|
|
// global.refreshHistory = () => {
|
|
|
@@ -155,6 +155,26 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ function isTimestampInThisWeek(timestamp) {
|
|
|
+ const date = new Date(timestamp);
|
|
|
+
|
|
|
+ // 获取当前日期
|
|
|
+ const now = new Date();
|
|
|
+
|
|
|
+ // 获取本周的第一天(周一)
|
|
|
+ const startOfWeek = new Date(now);
|
|
|
+ startOfWeek.setDate(now.getDate() - now.getDay()+1); // 计算本周周一
|
|
|
+ startOfWeek.setHours(0, 0, 0, 0); // 设置为当天的开始时间
|
|
|
+
|
|
|
+ // 获取本周的最后一天(周日)
|
|
|
+ const endOfWeek = new Date(startOfWeek);
|
|
|
+ endOfWeek.setDate(startOfWeek.getDate() + 6); // 计算本周周日
|
|
|
+ endOfWeek.setHours(23, 59, 59, 999); // 设置为当天的结束时间
|
|
|
+
|
|
|
+ // 判断时间戳是否在本周范围内
|
|
|
+ return date >= startOfWeek && date <= endOfWeek;
|
|
|
+ }
|
|
|
+
|
|
|
function onScroll(e) {
|
|
|
// var top = e.detail.scrollTop
|
|
|
// myScrollTop = top
|
|
|
@@ -167,7 +187,15 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
|
|
|
list.forEach((item, index) => {
|
|
|
if (top >= itemLayouts[index] - 50) {
|
|
|
i = index
|
|
|
- date = dayjs(item.window_range.start_timestamp).format('YYYY年M月')
|
|
|
+ if (isTimestampInThisWeek(item.window_range.start_timestamp)) {
|
|
|
+ date = t('health.this_week')
|
|
|
+ }
|
|
|
+ else if (dayjs(item.window_range.start_timestamp).format('YYYY')==dayjs().format('YYYY')){
|
|
|
+ date = global.language=='en'?dayjs(item.window_range.start_timestamp).format('MMMM'):dayjs(item.window_range.start_timestamp).format('MMMM')
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ date = global.language == 'en' ? dayjs(item.window_range.start_timestamp).format('MMMM YYYY') : dayjs(item.window_range.start_timestamp).format('YYYY年M月')
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
if (props.updateDate) {
|
|
|
@@ -503,7 +531,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
|
|
|
}
|
|
|
}
|
|
|
if (showDate) {
|
|
|
- return <View className="history_year_month h42 bold" style={{marginBottom:rpxToPx(60)}}>{dateStr}</View>
|
|
|
+ return <View className="history_year_month h42 bold" style={{ marginBottom: rpxToPx(60) }}>{dateStr}</View>
|
|
|
}
|
|
|
return <View />
|
|
|
}
|
|
|
@@ -609,12 +637,12 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
|
|
|
var data = list[0]
|
|
|
jumpPage(`/_health/pages/timeline_detail?window_id=${data.window_id}&type=recent&isfastsleep=0×tamp=${data.publish.timestamp}`)
|
|
|
|
|
|
- getLatestJournal(false, {
|
|
|
- id: health.mode == 'EAT' ? global.eatTipId : global.activeTipId,
|
|
|
- user_confirmed: true
|
|
|
- }).then(res => {
|
|
|
+ // getLatestJournal(false, {
|
|
|
+ // id: health.mode == 'EAT' ? global.eatTipId : global.activeTipId,
|
|
|
+ // user_confirmed: true
|
|
|
+ // }).then(res => {
|
|
|
|
|
|
- })
|
|
|
+ // })
|
|
|
setTimeout(() => {
|
|
|
if (health.mode == 'EAT') {
|
|
|
dispatch(setEatTip(false))
|
|
|
@@ -710,10 +738,10 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
|
|
|
list.length == 0 && <NoRecord />
|
|
|
}
|
|
|
{
|
|
|
- list.length > 0 && <View style={{ minHeight: rpxToPx(464), backgroundColor: '#fff',paddingTop:rpxToPx(60) }}>
|
|
|
+ list.length > 0 && <View style={{ minHeight: rpxToPx(464), backgroundColor: '#fff', paddingTop: rpxToPx(60) }}>
|
|
|
{
|
|
|
list.map((item, index) => {
|
|
|
- if (itemLayouts.length >= index + 1 && index>5) {
|
|
|
+ if (itemLayouts.length >= index + 1 && index > 5) {
|
|
|
if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
|
|
|
return <View style={{ height: itemHeights[index] }} id={`history-${index}`} key={index}>
|
|
|
{
|
|
|
@@ -746,6 +774,6 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
|
|
|
|
|
|
|
|
|
{/* <View style={{ height: rpxToPx(40), flexShrink: 0, backgroundColor: '#fff' }} /> */}
|
|
|
- <ListFooter noMore={(list.length > 0) && (total == list.length)} loading={loading}/>
|
|
|
+ <ListFooter noMore={(list.length > 0) && (total == list.length)} loading={loading} />
|
|
|
</View>
|
|
|
})
|