消息首页:群聊头像图标、昨天的时间格式、常联系的人名字截断

对照 docs/images/消息.png 逐项核对消息首页,实测 DOM 后确认三处:

1. 群聊会话的兜底头像画成了单人像:normalizeConversations 没给任何会话设 icon,全部落到
   Avatar 的默认值 person,列表里分不出哪条是群。按 topic 的 grp 前缀区分,群用 group 图标。
   顺带把群的 online 传 undefined——群不存在"在线"概念,之前会给群也渲染一个状态点。

2. 昨天的会话只显示"昨天",参考图是"昨天21:03"带具体时间。实测修复后显示"昨天17:40"。

3. "常联系的人"的名字被截断:格子 3.75rem(50px),而 "kcg051307" 这类用户名需要 52px,
   显示成 "kcg0513...";参考图里这一栏名字是完整显示的。加宽到 4.4rem,实测 59px 可见宽、
   59px 实际宽,不再截断。

另外记录一个未改的观感偏差供决策:这一栏的头像实测占视口宽 10.1%(42.7px / 424px),参考图
里约占 17%,明显小一号。放大属于观感调整不是缺陷修复,没有自行改动。

本轮还做了一次全局层叠扫描(遍历 19 个页面,自动检测图标在容器内不居中、文字被压成 0 高度、
元素溢出视口、意外截断四类问题):除上面这处截断外没有新命中,说明之前群设置页那组 CSS 层叠
冲突是孤立的,没有蔓延到其他页面。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-09-03 18:09:00 +08:00
co-authored by Claude Opus 5
parent 0ba3577c96
commit c4189646f4
5 changed files with 22 additions and 11 deletions
+6 -3
View File
@@ -12604,11 +12604,12 @@ function formatConversationTime(ts) {
const now = new Date();
const startOfDay = d => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
const days = Math.round((startOfDay(now) - startOfDay(date)) / 86400000);
if (days === 0) return date.toLocaleTimeString('zh-CN', {
const hhmm = () => date.toLocaleTimeString('zh-CN', {
hour: '2-digit',
minute: '2-digit'
});
if (days === 1) return '昨天';
if (days === 0) return hhmm();
if (days === 1) return '昨天' + hhmm();
if (days < 7) return ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][date.getDay()];
return date.toLocaleDateString('zh-CN', {
month: 'numeric',
@@ -12652,13 +12653,15 @@ function normalizeConversations(chatList, myUserId) {
let summary = item.private && item.private.comment ? item.private.comment : '暂无消息';
if (latest) summary = draftyPreview(latest.content);
if (latest && latest.from === myUserId) summary = '我:' + summary;
const isGroup = typeof item.topic === 'string' && item.topic.startsWith('grp');
return {
id: item.topic || item.user || String(index),
title: (0,_lib_utils_js__WEBPACK_IMPORTED_MODULE_6__.topicDisplayName)(item.topic, item.public, '未命名会话'),
summary,
time: formatConversationTime(item.touched),
unread: Math.max(Number(item.unread) || 0, 0),
online: !!item.online,
icon: isGroup ? 'group' : 'person',
online: isGroup ? undefined : !!item.online,
muted: !!(item.acs && item.acs.isMuted && item.acs.isMuted()),
pinned: !!item.pinned
};