Commit da860c42 by weiw

fix:处理一下 历史记录 数据排列问题

parent 803563af
......@@ -12,8 +12,8 @@ export function processConversationData(records: Conversation[]): Conversation[]
records.forEach((item) => {
const endDate = new Date(item.endTime)
let timeLabel = ''
// 今天的数据
if (isToday(endDate)) {
if (!hasToday) {
processedData.push({
......@@ -24,8 +24,11 @@ export function processConversationData(records: Conversation[]): Conversation[]
} as any)
hasToday = true
}
timeLabel = '今天'
processedData.push({
...item,
})
}
// 最近一周但不是今天的数据
else if (isThisWeek(endDate, { weekStartsOn: 1 })) {
if (!hasThisWeek) {
processedData.push({
......@@ -36,8 +39,11 @@ export function processConversationData(records: Conversation[]): Conversation[]
} as Conversation)
hasThisWeek = true
}
timeLabel = '最近一周'
processedData.push({
...item,
})
}
// 最近30天但不是本周的数据
else if (isWithinInterval(endDate, { start: thirtyDaysAgo, end: today })) {
if (!hasLast30Days) {
processedData.push({
......@@ -48,16 +54,10 @@ export function processConversationData(records: Conversation[]): Conversation[]
} as Conversation)
hasLast30Days = true
}
// eslint-disable-next-line unused-imports/no-unused-vars
timeLabel = '最近30天'
}
else {
return
}
processedData.push({
...item,
})
}
})
return processedData
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment