From 909e0fd43f09e3274f37abc1a6567abb59f56cac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com>
Date: Wed, 15 Jul 2026 23:02:15 +0800
Subject: [PATCH] =?UTF-8?q?fix(user):=20=E4=BC=98=E5=8C=96=E6=88=91?=
=?UTF-8?q?=E7=9A=84=E8=AE=A2=E5=8D=95=E8=A7=92=E6=A0=87=E6=A0=B7=E5=BC=8F?=
=?UTF-8?q?=E5=92=8C0=E5=80=BC=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 角标位置从 top-0 right-2 调整为 -top-1 -right-1,使小红点更贴近右上角边缘
- 角标尺寸改为 min-w-[16px] h-4 并固定字体大小,保证单数字圆形,多数字椭圆形
- 0 的判断改用 Number(item.count) > 0,防止后端字符串形式的 "0" 被误判显示
- 0 数量时角标不再渲染,避免显示多余的“0”数字
---
.workbuddy/memory/2026-07-15.md | 8 ++++++++
src/pages/user/user.tsx | 8 ++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/.workbuddy/memory/2026-07-15.md b/.workbuddy/memory/2026-07-15.md
index 2c82a9d..e6f0b95 100644
--- a/.workbuddy/memory/2026-07-15.md
+++ b/.workbuddy/memory/2026-07-15.md
@@ -278,3 +278,11 @@
3. user.tsx 订单快捷入口 count 改用 `waitPay/waitDeliver/waitReceive/completed`,status 改为 `0/1/3/5` 与 `OrderListStatus` 对齐
4. localStorage 缓存 key 从 `user_order_stats_v2` 升级到 `v3`,让旧格式缓存自动失效,避免冷启动先渲染旧格式导致仍是 0
- 关键约定:`OrderListStatus` 是前端订单 Tab 筛选状态的唯一真相源(-1全部/0待付款/1待发货/2待核销/3待收货/4待评价/5已完成/6退款/7已删除),所有跳订单列表的入口传 status 都要对齐它
+
+## 优化「我的订单」角标样式(2026-07-15 22:55)
+- 文件:`src/pages/user/user.tsx`
+- 用户反馈:截图中「已完成」下方出现了一个"0"字(hot reload 之前旧版代码里 `{item.count}` 直接渲染了 count,0 也会显示)。同时希望统计数字更"右上角"
+- 修改:
+ 1. 角标位置 `top-0 right-2` → `-top-1 -right-1`:让小红点紧贴 cell 右上角外缘,更像标准徽标
+ 2. 角标尺寸 `text-xs` + 自由拉伸 → `min-w-[16px] h-4` + 10px/12px 字体:单数字也保持圆形,多位数字自动变椭圆
+ 3. 0 判断 `item.count && item.count > 0` → `item.count && Number(item.count) > 0`:用 `Number()` 包一层,防止后端返回字符串 "0" 时 `> 0` 误判
diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx
index 1dd62da..a8020eb 100644
--- a/src/pages/user/user.tsx
+++ b/src/pages/user/user.tsx
@@ -277,10 +277,10 @@ const UserPage: React.FC = () => {
>
{item.icon}
{item.label}
- {/* 数量角标 */}
- {item.count && item.count > 0 && (
-
- {item.count > 99 ? '99+' : item.count}
+ {/* 数量角标:紧贴图标右上角;为 0 时不渲染 */}
+ {item.count && Number(item.count) > 0 && (
+
+ {Number(item.count) > 99 ? '99+' : item.count}
)}