[feat]:[FL-154][系统消息页面一致性优化]

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
chengkai3
2026-06-20 06:56:17 +08:00
parent 012b62fab9
commit a9a2d32fd5
8 changed files with 227 additions and 62 deletions
+25
View File
@@ -103,3 +103,28 @@
- 风险与关注点:
- 改动涉及系统参数列表接口分页契约,但不改变请求/响应字段结构、权限码或 CRUD 语义。
- 当前本机 `python3` 为 3.7.9,不满足 `api/pyproject.toml``requires-python >=3.10`;后端单测使用 `uv` 管理的 Python 3.11 环境验证。
# Work Log - 系统消息页面一致性优化(FL-154)
- 背景:
- 系统消息页面需对齐用户管理页的后台列表页布局、动态表格高度、移动卡片视图和无限滚动交互。
- 本次处理:
- 系统消息页补齐表格 body 最小高度 CSS 钩子,动态 `scroll.y` 对应的 CSS 变量现已生效。
- 移动端卡片视图改为与用户管理页一致的容器、空态、卡片视觉和字段网格样式,移除卡片字段内散落的内联间距。
- 移动卡片累积列表改为 `requestAnimationFrame` 内更新,避免 React hooks lint 的同步 effect 更新错误;筛选切换直接重置卡片分页和累积数据。
- 系统消息列表 API 增加可选 `message_type` 查询参数,服务端按类型/未读状态返回匹配 `items``total`,保证移动端无限滚动的 total 与当前筛选一致;`unread_count` 仍保持用户全局未读数。
- 补充系统消息服务层测试覆盖类型筛选后的 total 行为。
- 验证:
- 基线:`npm --workspace web exec eslint src/app/admin/users/page.tsx src/app/admin/system-messages/page.tsx` 失败,系统消息页存在 2 个 `react-hooks/set-state-in-effect` 既有错误;用户页存在 1 条既有 unused eslint-disable warning。
- 基线:`npm --workspace web exec tsc --noEmit` 通过。
- 基线:`python -m pytest api/tests/test_system_message_service.py api/tests/test_system_message_schema.py` 因系统 `python` 缺少 pytest 无法执行。
- 修改后:`npm --workspace web exec eslint src/app/admin/system-messages/page.tsx --max-warnings=0` 通过。
- 修改后:`npm --workspace web exec eslint src/app/admin/users/page.tsx src/app/admin/system-messages/page.tsx` 通过,仍仅用户页 1 条既有 warning。
- 修改后:`npm --workspace web exec tsc --noEmit` 通过。
- 修改后:`UV_CACHE_DIR=/tmp/fquiz-uv-cache UV_PYTHON_INSTALL_DIR=/tmp/fquiz-uv-python /home/jenkins/.local/bin/uv run --python 3.11 --with pytest --with fastapi --with pydantic-settings --with sqlalchemy --with PyJWT --with argon2-cffi --with email-validator --with python-multipart --with psycopg[binary] pytest api/tests/test_system_message_service.py api/tests/test_system_message_schema.py` 通过,4 passed,存在 1 条既有 SQLAlchemy relationship warning。
- 风险与关注点:
- `/api/v1/system-messages/me` 新增可选 `message_type` 参数,未传参时保持原列表语义;前端不再做本地类型过滤,分页 total 与服务端过滤结果一致。
- 改动影响系统消息列表展示与筛选,不改变创建、删除、标记已读接口字段。