v0.2.3 - 修复成交行情统计表格排序

This commit is contained in:
甲辰生产 2026-05-11 21:31:23 +08:00
parent 33ca624e70
commit 9b7f634ad3
3 changed files with 16 additions and 3 deletions

View File

@ -1,5 +1,12 @@
# 版本更新记录
## v0.2.3 (2026-05-11)
### 前端更新
- **News.jsx**
- 修复:统计表格点击均价弹出的成交详情列表按成交日期倒序排序
- 更新calcAvg函数过滤后对items按deal_date排序
## v0.2.2 (2026-05-11)
### 后端更新

View File

@ -1,12 +1,12 @@
{
"version": "0.2.2",
"version": "0.2.3",
"updated": "2026-05-11",
"modules": {
"frontend": {
"version": "0.1.9",
"version": "0.2.0",
"pages": {
"Add": "0.0.2",
"News": "0.1.0"
"News": "0.2.0"
}
},
"backend": {

View File

@ -588,6 +588,12 @@ export default function News() {
return p === pkg && c === cat
})
if (items.length === 0) return null
//
items.sort((a, b) => {
const dateA = a.deal_date || a.created_at?.split('T')[0] || ''
const dateB = b.deal_date || b.created_at?.split('T')[0] || ''
return dateB.localeCompare(dateA)
})
const sum = items.reduce((a, b) => a + (b.deal_price || 0), 0)
return { avg: Math.round(sum / items.length), count: items.length, items }
}