From 8bd4af9b9a6280e393f12727e5e2154727c88a31 Mon Sep 17 00:00:00 2001 From: wangxiaogang <1433729587@qq.com> Date: Thu, 4 Jun 2026 17:45:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20onShow=E9=9D=99=E9=BB=98=E5=88=B7?= =?UTF-8?q?=E6=96=B0=20+=20=E7=BE=A4=E7=BB=84=E9=A2=84=E7=AE=97=E5=8F=8C?= =?UTF-8?q?=E6=98=BE=20+=20TransactionItem=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit onShow 静默刷新(首次有loading,后续静默): - budget: 添加 initialLoaded 守卫,避免首次双重请求 - profile: 添加 onShow 刷新概览/预算/账单/群组 - group-manage: 添加 onShow 刷新群组列表 - category-manage: 添加 onShow 刷新分类列表 - add: 添加 onShow 刷新分类(可能新增了分类) 群组模式预算双显: - 服务端 GET /budget 群组模式额外返回 myAmount(本人预算) - 客户端 Budget 类型添加 myAmount 字段 - 预算页群组模式:群组总预算卡片(只读)+ 我的预算卡片(可编辑) - 个人模式保持原样 TransactionItem 群组模式优化: - 主图标始终显示分类图标(不再显示创建者头像) - 他人记录在昵称旁显示小头像(28rpx圆形) --- client/src/api/budget.ts | 1 + .../TransactionItem/TransactionItem.vue | 42 ++++++------ client/src/pages/add/index.vue | 6 ++ client/src/pages/budget/index.vue | 67 ++++++++++++++----- client/src/pages/category-manage/index.vue | 11 ++- client/src/pages/group-manage/index.vue | 10 ++- client/src/pages/profile/index.vue | 16 +++++ server/src/routes/budget.ts | 16 +++-- 8 files changed, 125 insertions(+), 44 deletions(-) diff --git a/client/src/api/budget.ts b/client/src/api/budget.ts index 915b32f..8cb4966 100644 --- a/client/src/api/budget.ts +++ b/client/src/api/budget.ts @@ -4,6 +4,7 @@ import { request } from '@/utils/request' export interface Budget { id: number amount: number + myAmount?: number month: string } diff --git a/client/src/components/TransactionItem/TransactionItem.vue b/client/src/components/TransactionItem/TransactionItem.vue index a561384..f1edd2e 100644 --- a/client/src/components/TransactionItem/TransactionItem.vue +++ b/client/src/components/TransactionItem/TransactionItem.vue @@ -8,13 +8,8 @@ @touchmove="!disableSwipe && onTouchMove($event)" @touchend="!disableSwipe && onTouchEnd()" > - - - - {{ item.creator_nickname?.[0] }} - + {{ item.note || item.category_name || '未分类' }} + + {{ item.creator_nickname?.[0] }} {{ item.creator_nickname }} · {{ item.category_name || '未分类' }}{{ hideDate ? '' : ' · ' + formatDate(item.date) }} @@ -151,27 +148,26 @@ function onTouchEnd() { } } -.creator-avatar { - width: 80rpx; - height: 80rpx; +.creator-mini-avatar { + width: 28rpx; + height: 28rpx; + border-radius: 50%; + vertical-align: middle; + margin-right: 4rpx; +} + +.creator-mini-initial { + display: inline-flex; + width: 28rpx; + height: 28rpx; border-radius: 50%; background: #FFF0E6; - display: flex; + font-size: 16rpx; + color: #FF8C69; align-items: center; justify-content: center; - overflow: hidden; - flex-shrink: 0; -} - -.creator-img { - width: 100%; - height: 100%; -} - -.creator-initial { - font-size: 28rpx; - font-weight: 600; - color: #FF8C69; + vertical-align: middle; + margin-right: 4rpx; } .info { diff --git a/client/src/pages/add/index.vue b/client/src/pages/add/index.vue index 11cc0e4..def4e9d 100644 --- a/client/src/pages/add/index.vue +++ b/client/src/pages/add/index.vue @@ -55,6 +55,7 @@