|
|
@@ -161,35 +161,49 @@ export default function Journal() {
|
|
|
myScrollTop = e.detail.scrollTop
|
|
|
setPageTop(top)
|
|
|
|
|
|
- if (top > 60) {
|
|
|
-
|
|
|
- Taro.setNavigationBarTitle({
|
|
|
- title: pageTitle()
|
|
|
- })
|
|
|
- }
|
|
|
- else {
|
|
|
- Taro.setNavigationBarTitle({
|
|
|
- title: ''
|
|
|
- })
|
|
|
- }
|
|
|
|
|
|
|
|
|
+ var showT = false
|
|
|
if (itemLayouts.length > 0) {
|
|
|
var i = -1
|
|
|
var dt = ''
|
|
|
journals.forEach((item, index) => {
|
|
|
if (top >= itemLayouts[index] - 50) {
|
|
|
i = index
|
|
|
- dt = global.language=='en'?dayjs(item.timestamp).format('MMMM YYYY'):dayjs(item.timestamp).format('YYYY年M月')
|
|
|
+ dt = global.language == 'en' ? dayjs(item.timestamp).format('MMMM YYYY') : dayjs(item.timestamp).format('YYYY年M月')
|
|
|
}
|
|
|
})
|
|
|
|
|
|
setShowDate(i != -1)
|
|
|
setDate(dt)
|
|
|
+ showT = i != -1
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
setShowDate(false)
|
|
|
setDate('')
|
|
|
+ showT = false
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (showT) {
|
|
|
+ Taro.setNavigationBarTitle({
|
|
|
+ title: pageTitle()
|
|
|
+ })
|
|
|
+ Taro.setNavigationBarColor({
|
|
|
+ backgroundColor: '#f5f5f5',
|
|
|
+ frontColor: '#000000'
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Taro.setNavigationBarTitle({
|
|
|
+ title: ''
|
|
|
+ })
|
|
|
+ Taro.setNavigationBarColor({
|
|
|
+ backgroundColor: '#ffffff',
|
|
|
+ frontColor: '#000000'
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// if (itemLayouts.length > 0 && itemLayouts[0] > top) {
|
|
|
@@ -476,10 +490,10 @@ export default function Journal() {
|
|
|
return t('health.title_journal')
|
|
|
}
|
|
|
|
|
|
- function pageYear(){
|
|
|
+ function pageYear() {
|
|
|
if (!loaded) return ''
|
|
|
- if (journals.length==0) return global.language == 'en'?dayjs().format('YYYY'):dayjs().format('YYYY年')
|
|
|
- if (journals[0].timestamp) return global.language == 'en'?dayjs(journals[0].timestamp).format('YYYY'):dayjs(journals[0].timestamp).format('YYYY年')
|
|
|
+ if (journals.length == 0) return global.language == 'en' ? dayjs().format('YYYY') : dayjs().format('YYYY年')
|
|
|
+ if (journals[0].timestamp) return global.language == 'en' ? dayjs(journals[0].timestamp).format('YYYY') : dayjs(journals[0].timestamp).format('YYYY年')
|
|
|
return ''
|
|
|
}
|
|
|
|
|
|
@@ -578,7 +592,7 @@ export default function Journal() {
|
|
|
// <View>长列表后面的内容</View>
|
|
|
// </recycle-view>
|
|
|
|
|
|
- function itemData(index,item) {
|
|
|
+ function itemData(index, item) {
|
|
|
if (itemLayouts.length >= index + 1 && index > 5) {
|
|
|
if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
|
|
|
return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
|
|
|
@@ -589,9 +603,9 @@ export default function Journal() {
|
|
|
return <View className="history_item2" id={`history-${index}`} onClick={() => {
|
|
|
jumpPage('/pages/account/JournalDetail?date=' + item.date + '&window=' + window) //JSON.stringify(item))
|
|
|
}}>
|
|
|
- <TimelineDate
|
|
|
+ <TimelineDate
|
|
|
timestamp={item.timestamp}
|
|
|
- pre_timestamp={index>0?journals[index - 1].timestamp:null}
|
|
|
+ pre_timestamp={index > 0 ? journals[index - 1].timestamp : null}
|
|
|
isJournal
|
|
|
/>
|
|
|
{/* <View className="cell_date" >
|
|
|
@@ -619,7 +633,7 @@ export default function Journal() {
|
|
|
}}
|
|
|
><View style={{ display: 'flex', flexDirection: 'column', minHeight: rpxToPx(464), backgroundColor: '#f5f5f5' }}>
|
|
|
|
|
|
- <NewHeader type={NewHeaderType.left} title={pageYear()} whiteBg/>
|
|
|
+ <NewHeader type={NewHeaderType.left} title={pageYear()} whiteBg />
|
|
|
{
|
|
|
markDoneTip()
|
|
|
}
|
|
|
@@ -633,10 +647,10 @@ export default function Journal() {
|
|
|
historyYear(index)
|
|
|
}
|
|
|
{
|
|
|
- itemData(index,item)
|
|
|
+ itemData(index, item)
|
|
|
}
|
|
|
- </View>
|
|
|
-
|
|
|
+ </View>
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
{
|