修复全页面走查发现的 P0 前端问题(第一批)
八个 agent 对 11 章逐页对照设计稿+后端源码后,先修其中"功能不可用/崩溃/谎报成功"级别的:
崩溃与数据错误
- content-library-view: Highlight 按 [start,len] 数组解构后端返回的 {start,end} 对象,
对象不可迭代会直接抛 TypeError,任何文本搜索命中都让整个结果区渲染崩掉。服务端偏移还叠加
两个问题(Go 字节下标 vs JS UTF-16;偏移基准是全文但 snippet 会被开窗截断),改为在展示
文本上本地匹配关键词。
- content-library-view: firstAttachment 用 Drafty.attachments,SDK 里硬过滤 tp=='EX'
只认文件附件,图片(IM)/视频(VD)/语音(AU) 一个都取不到——收藏缩略图、语音播放源、聊天记录
图片视频宫格全部拿不到资源。改用 Drafty.entities 按类型分派(chat-message.jsx 已有先例)。
- message-center-view: 系统通知的机器码兜底会把真实数据吞掉(日报提醒的 summary 就是日期
字符串 "2026-08-20",会议通知的 summary 是标题),改为查表命中才替换。
- message-center-view: 会话列表漏了 avatar 字段,每行都只能落到兜底图标;同文件
frequentContacts() 本来就是对的,照它补上。
功能不可用
- auth-onboarding-view: 首次开启青少年模式是死路——设完密码丢弃了服务端返回的
enable_action_token,从不调 enableYouthMode,用户走完短信验证+设密码后模式仍是关的。
现在拿着这个 token 把最后一步做完。
- group-management-view: "投诉/举报"是个 onToast('暂未开放') 死桩,而 target_type='group'
这条链路早就通了。接上真实举报页。
- tinode-web: 刷新/深链会被弹回首页。两个原因叠加:初始化白名单还是上游 Tinode 的
['cred','reset','register'];handleLoginSuccessful 无条件把 hash 改写成 workbench,
刷新触发的自动登录也走这条。抽出 SIDE_PANEL_VIEWS 常量复用,并区分登录流程与自动登录。
- widgets/meta-message: deleted 分支从未实现,撤回一条消息后时间线上什么都不剩。
谎报成功 / 判定错误
- tinode-web + personal-settings-view: 改密码不返回 Promise,服务端拒绝时照样弹"密码已更新"。
- group-management-view: 禁言批量读 result.succeeded,但该接口返回的是 {topic, items},
succeeded 恒为 undefined,不管成没成都弹"设置成功"。两个接口结构不同,分开判定。
- workplace-collaboration-view: 会议取消状态写成 'cancelled',后端是 'canceled' 单 l,
会议取消后"取消会议"按钮还挂着。
样式与显示
- base.css: 删掉旧版 .organization-department 的 padding-left !important,它压过按层级算出的
内联缩进,导致部门行全平、只有人员行缩进。
- base.css: 补 .youth-password-gate(原来 0 条规则),PIN 框缺 position:relative 和居中。
- security-support-view: shield_lock 不在经典 Material Icons 里(只有 Symbols),会显示成
字面文本;.risk-info-page 也是 0 条规则,整页渲染成裸项目符号列表。改用 verified_user 并
补上 .risk-dialog。
- contact-management-view: 好友资料页性别直接输出后端枚举,显示成 "male"。
- workplace-collaboration-view: 层级标注两条路径两种格式(树形深三层变"3级"、搜索硬传"三"),
统一成一个 helper。
已记录不在前端修的后端缺口:recallMessage 的 version 只能传 1,因为所有消息读取接口
(messagePayload/messageSearchPayload/mediaMessagePayload/favoriteSnapshot)都不下发 version,
冲突错误里也不回传真实值,被编辑过的消息撤回必然失败。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c4189646f4
commit
5a07bb4e3b
@@ -183,12 +183,17 @@ function ImgFromFile({fileId, className}) {
|
||||
// hollow diamond / (expanded) = filled blue diamond, level 3+ (a person, not a sub-department) =
|
||||
// hollow circle. The backend never returns a depth field (confirmed against organizationDepartmentPayload),
|
||||
// so depth is purely how far this node is from the root in the client's own recursion.
|
||||
// 层级标注统一用中文数字。原来树形分支只手写到"二级"、更深就退化成"3级",
|
||||
// 而搜索分支又硬传字符串 "三",同一个标注两条路径两种格式。
|
||||
const LEVEL_NUMERALS = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
|
||||
const levelLabel = n => LEVEL_NUMERALS[n - 1] || String(n);
|
||||
|
||||
function DeptRow({dept, depth, expanded, onToggle}) {
|
||||
const icon = depth === 0 ? 'business' : 'diamond';
|
||||
return <button type="button" className={`organization-department depth-${depth}${expanded ? ' expanded' : ''}`}
|
||||
style={{paddingLeft: `${1 + depth * 1.1}rem`}} onClick={onToggle}>
|
||||
<Icon>{icon}</Icon>
|
||||
<span><strong>{dept.name}{typeof dept.member_count === 'number' ? `${dept.member_count}人` : ''}({depth === 0 ? '一级' : depth === 1 ? '二级' : `${depth + 1}级`})</strong></span>
|
||||
<span><strong>{dept.name}{typeof dept.member_count === 'number' ? `${dept.member_count}人` : ''}({levelLabel(depth + 1)}级)</strong></span>
|
||||
<Icon>{expanded ? 'expand_more' : 'chevron_right'}</Icon>
|
||||
</button>;
|
||||
}
|
||||
@@ -206,7 +211,7 @@ function PersonRow({person, depth, isMe, level}) {
|
||||
return <button type="button" className={`organization-person${isMe ? ' me' : ''}`}
|
||||
style={{paddingLeft: `${1 + depth * 1.1}rem`}} onClick={() => navigate('group-member-profile', {uid: person.user_id})}>
|
||||
<Icon>radio_button_unchecked</Icon>
|
||||
<span><strong>{person.display_name}({level}级)</strong></span>
|
||||
<span><strong>{person.display_name}({levelLabel(level)}级)</strong></span>
|
||||
<Icon>chevron_right</Icon>
|
||||
</button>;
|
||||
}
|
||||
@@ -390,7 +395,9 @@ function MeetingDetail({hashParams, onToast}) {
|
||||
<div><span><b>{counts.accepted}</b><small>已接受</small></span><span><b>{counts.pending}</b><small>待响应</small></span><span><b>{counts.declined}</b><small>已拒绝</small></span></div>
|
||||
<footer>
|
||||
{meeting.permissions && meeting.permissions.can_remind ? <button type="button" disabled={busy} onClick={remind}><Icon>notifications</Icon>提醒未响应</button> : null}
|
||||
{meeting.permissions && meeting.permissions.can_cancel && meeting.state !== 'cancelled' ? <button type="button" className="danger" disabled={busy} onClick={cancel}>取消会议</button> : null}
|
||||
{/* 后端常量是 "canceled" 单 l(store/types/meetings.go:7),原来写成 "cancelled" 永远不相等,
|
||||
会议取消之后"取消会议"按钮还挂在那儿 */}
|
||||
{meeting.permissions && meeting.permissions.can_cancel && meeting.state !== 'canceled' ? <button type="button" className="danger" disabled={busy} onClick={cancel}>取消会议</button> : null}
|
||||
</footer>
|
||||
</section> : null}
|
||||
</main>
|
||||
@@ -503,7 +510,7 @@ function OrganizationDirectory({myUserId}) {
|
||||
{searchResults.length === 0 ? <p className="organization-loading">未找到匹配的成员</p> :
|
||||
searchResults.map((item, idx) => item.type === 'department' ?
|
||||
<SearchDeptRow key={'d' + (item.department && item.department.department_id || idx)} dept={item.department} /> :
|
||||
<PersonRow key={'u' + (item.user && item.user.user_id || idx)} person={item.user} depth={0} level="三"
|
||||
<PersonRow key={'u' + (item.user && item.user.user_id || idx)} person={item.user} depth={0} level={3}
|
||||
isMe={item.user && (item.user.user_id === myUserId || 'usr' + item.user.user_id === myUserId)} />)}
|
||||
</section> :
|
||||
<section className="organization-tree">
|
||||
|
||||
Reference in New Issue
Block a user