# P9→NS1/RNS1 缺失项 #4:备注 AI 评分的星级展示规范 ## 简要结论 - 状态:⚠️ 部分解决 - 风险等级:🟠 中 - `star-rating` 组件已实现(0-10 分→0-5 星,支持半星),设计规范文档已定义评分展示规范,但客户详情页备注区域未使用该组件,后端备注 API 未返回 `ai_score` 字段。 ## 详细审查 ### 审查范围 - `apps/miniprogram/miniprogram/components/star-rating/` — 星级评分组件 - `apps/backend/app/services/customer_service.py` — `_build_notes()` 实现 - `apps/backend/app/schemas/xcx_customers.py` — `CustomerNote` schema - `apps/miniprogram/miniprogram/pages/customer-detail/customer-detail.wxml` — 备注区域 - `docs/miniprogram-dev/design-system/DISPLAY-STANDARDS-2.md` — 评分展示规范 ### 发现 1. **组件层:star-rating 已完整实现** - 接收 `score`(0-10),内部转换为 0-5 星,支持半星 - 使用 TDesign `t-rate` 组件渲染,金黄色(`#fbbf24`) - 支持只读模式 2. **设计规范:评分展示规范已定义** - `DISPLAY-STANDARDS-2.md` 第 8 节定义了: - 分制约定(后端 0-10 分,UI 0-5 星) - 展示场景(任务卡片、备注满意度等) - 半星映射规则(`scoreToHalfStar()`) - 未评分态处理(`score=0/null/undefined` → 展示 `--`) 3. **后端:备注 API 未返回 ai_score** - `_build_notes()` 查询 `biz.notes` 表,只返回 `id`、`tag_label`、`created_at`、`content` - `CustomerNote` schema 无 `ai_score` / `score` 字段 - 数据库 `biz.notes` 表是否有 `ai_score` 列未确认 4. **前端:备注区域未使用 star-rating 组件** - `customer-detail.wxml` 备注列表只展示 `tagLabel`、`createdAt`、`content` - 无 `` 组件引用 - `customer-detail.json` 未注册 `star-rating` 组件(需确认) ### 证据 后端 `_build_notes()` 无 score 字段: ```python return [ { "id": r[0], "tag_label": r[1] or "", "created_at": r[2].isoformat() if r[2] else "", "content": r[3] or "", # 缺少 ai_score / score 字段 } for r in rows ] ``` 前端备注展示无星级: ```html {{item.tagLabel}} {{item.createdAt}} {{item.content}} ``` ### 建议(如未完全解决) 1. **后端**:`_build_notes()` 查询中增加 `ai_score` 字段(如 `biz.notes` 表有该列) 2. **Schema**:`CustomerNote` 添加 `score: int | None = None` 3. **前端**:备注卡片中添加 ``,未评分时展示 `--` 4. **tooltip**:P9 定义的评分说明 tooltip 需额外实现(小程序原生不支持 tooltip,可用长按弹窗替代)