|
@@ -139,7 +139,10 @@ export default function Journal() {
|
|
|
function measureItemLayouts() {
|
|
function measureItemLayouts() {
|
|
|
const query = Taro.createSelectorQuery()
|
|
const query = Taro.createSelectorQuery()
|
|
|
journals.forEach((item, index) => {
|
|
journals.forEach((item, index) => {
|
|
|
- query.select(`#history-${index}`).boundingClientRect()
|
|
|
|
|
|
|
+ if (index >= itemLayouts.length) {
|
|
|
|
|
+ query.select(`#history-${index}`).boundingClientRect()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
});
|
|
});
|
|
|
query.exec((res) => {
|
|
query.exec((res) => {
|
|
|
|
|
|
|
@@ -151,8 +154,8 @@ export default function Journal() {
|
|
|
heights[index] = rect.height
|
|
heights[index] = rect.height
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- setItemLayouts(layouts)
|
|
|
|
|
- setItemHeights(heights)
|
|
|
|
|
|
|
+ setItemLayouts([...itemLayouts, ...layouts])
|
|
|
|
|
+ setItemHeights([...itemHeights, ...heights])
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -305,106 +308,8 @@ export default function Journal() {
|
|
|
return <View />
|
|
return <View />
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function historyDate(item, index) {
|
|
|
|
|
- if (index == 0) {
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
|
|
|
|
|
- return '今天'
|
|
|
|
|
- }
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
|
|
|
|
|
- return '昨天'
|
|
|
|
|
- }
|
|
|
|
|
- return dayjs(item.timestamp).format('DD')
|
|
|
|
|
- }
|
|
|
|
|
- if (dayjs(item.timestamp).format('MM-DD') ==
|
|
|
|
|
- dayjs(journals[index - 1].timestamp).format('MM-DD')) {
|
|
|
|
|
- return ''
|
|
|
|
|
- }
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
|
|
|
|
|
- return '今天'
|
|
|
|
|
- }
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
|
|
|
|
|
- return '昨天'
|
|
|
|
|
- }
|
|
|
|
|
- return dayjs(item.timestamp).format('DD')
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function historyMonth(item, index) {
|
|
|
|
|
- if (index == 0) {
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
|
|
|
|
|
- return ''
|
|
|
|
|
- }
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
|
|
|
|
|
- return ''
|
|
|
|
|
- }
|
|
|
|
|
- return dayjs(item.timestamp).format('MMM')
|
|
|
|
|
- }
|
|
|
|
|
- if (dayjs(item.timestamp).format('MM-DD') ==
|
|
|
|
|
- dayjs(journals[index - 1].timestamp).format('MM-DD')) {
|
|
|
|
|
- return ''
|
|
|
|
|
- }
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isToday(item.timestamp)) {
|
|
|
|
|
- return ''
|
|
|
|
|
- }
|
|
|
|
|
- if (global.language == 'zh' && TimeFormatter.isYesterday(item.timestamp)) {
|
|
|
|
|
- return ''
|
|
|
|
|
- }
|
|
|
|
|
- return dayjs(item.timestamp).format('MMM')
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function journalCellText(index) {
|
|
|
|
|
- var windows = journals[index].windows
|
|
|
|
|
- var array: any = []
|
|
|
|
|
- windows.map(window => {
|
|
|
|
|
- window.events.map(event => {
|
|
|
|
|
- event.moments && event.moments.map(moment => {
|
|
|
|
|
- array.push({
|
|
|
|
|
- title: moment.title,
|
|
|
|
|
- description: moment.description
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
- return array
|
|
|
|
|
- if (array.length > 0) {
|
|
|
|
|
- return <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
|
|
- {
|
|
|
|
|
- array.map((item, index) => {
|
|
|
|
|
- if (index >= 3) return <View key={index * 10000} />
|
|
|
|
|
- return <TimeTitleDesc key={index * 10000}
|
|
|
|
|
- time=''
|
|
|
|
|
- title={item.title}
|
|
|
|
|
- desc={item.description}
|
|
|
|
|
- />
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- </View>
|
|
|
|
|
- }
|
|
|
|
|
- return <View />
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
function journalCell(item, index) {
|
|
function journalCell(item, index) {
|
|
|
- // if (item.show_ring) {
|
|
|
|
|
- // if (item.windows) {
|
|
|
|
|
- // return <View key={index}>{
|
|
|
|
|
- // item.windows.map((temp, i) => {
|
|
|
|
|
- // return <TargetProgress key={i * 1000} showLine={i < item.windows.length - 1 ? true : false}
|
|
|
|
|
- // color={getThemeColor(temp.window)}
|
|
|
|
|
- // showRing={true}
|
|
|
|
|
- // desc={temp.description}
|
|
|
|
|
- // icon={
|
|
|
|
|
- // null
|
|
|
|
|
- // }
|
|
|
|
|
- // canvasId={`${temp.window}${temp.window_range.start_timestamp}${index}`}
|
|
|
|
|
- // startTimestamp={temp.window_range.start_timestamp}
|
|
|
|
|
- // endTimerstamp={temp.window_range.end_timestamp}
|
|
|
|
|
- // />
|
|
|
|
|
- // })
|
|
|
|
|
- // }</View>
|
|
|
|
|
-
|
|
|
|
|
- // }
|
|
|
|
|
- // return <View key={index} />
|
|
|
|
|
- // }
|
|
|
|
|
return <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
return <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
{
|
|
{
|
|
|
(item.pics.length > 0 || item.texts.length > 0) && <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), overflow: 'hidden', flexShrink: 0 }} key={index}>
|
|
(item.pics.length > 0 || item.texts.length > 0) && <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), overflow: 'hidden', flexShrink: 0 }} key={index}>
|
|
@@ -447,11 +352,6 @@ export default function Journal() {
|
|
|
/>
|
|
/>
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- {/* <Text style={{backgroundColor:'pink'}}>...</Text> */}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|
@@ -593,12 +493,32 @@ export default function Journal() {
|
|
|
// </recycle-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) {
|
|
|
|
|
|
|
+ if (itemLayouts.length >= index + 1) {
|
|
|
|
|
+ if (Math.abs(itemLayouts[index] - pageTop) > 3000) {
|
|
|
return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
|
|
return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
|
|
|
{/* {index} */}
|
|
{/* {index} */}
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
+ if (Math.abs(itemLayouts[index] - pageTop) > 1500) {
|
|
|
|
|
+ return <View style={{
|
|
|
|
|
+ height: itemHeights[index], display: 'flex',
|
|
|
|
|
+ paddingLeft: rpxToPx(40),
|
|
|
|
|
+ paddingRight: rpxToPx(40),
|
|
|
|
|
+ boxSizing: 'border-box',
|
|
|
|
|
+ flexDirection: 'row'
|
|
|
|
|
+ }} id={`history-${index}`}>
|
|
|
|
|
+ <TimelineDate
|
|
|
|
|
+ timestamp={item.timestamp}
|
|
|
|
|
+ pre_timestamp={index > 0 ? journals[index - 1].timestamp : null}
|
|
|
|
|
+ isJournal
|
|
|
|
|
+ />
|
|
|
|
|
+ <View style={{
|
|
|
|
|
+ display: 'flex', flexDirection: 'column', flex: 1,
|
|
|
|
|
+ width: rpxToPx(552), height: itemHeights[index] - rpxToPx(60), backgroundColor: '#fafafa'
|
|
|
|
|
+ }}>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return <View className="history_item2" id={`history-${index}`} onClick={() => {
|
|
return <View className="history_item2" id={`history-${index}`} onClick={() => {
|
|
|
jumpPage('/pages/account/JournalDetail?date=' + item.date + '&window=' + window) //JSON.stringify(item))
|
|
jumpPage('/pages/account/JournalDetail?date=' + item.date + '&window=' + window) //JSON.stringify(item))
|