From 18d21a03bbb2306b9c43956676db35d33e6586bf Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 16 Sep 2026 12:41:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E7=AC=AC9=E8=BD=AE=E5=AE=A1?= =?UTF-8?q?=E6=9F=A5=E6=89=B9=E6=AC=A13=E2=80=94=E2=80=94=E9=80=9A?= =?UTF-8?q?=E8=AE=AF=E5=BD=95=E5=9F=9F=E4=B8=80=E6=89=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 手机号搜索加好友时来源永远上报"search"(账号搜索),NewFriendsView 早就有phone的文案映射但一直用不到——现在按searchType正确区分 - 添加好友弹层三个快捷按钮布局改成横向(原来是纵向堆叠,和设计稿方向 不一致),图标颜色改成强调色 - "已选择"状态标签的圆角从胶囊改成6px小圆角,和同弹层其它按钮风格一致 - 通讯录头部"加好友"按钮补上移动端尺寸(40px/桌面36px),之前和旁边 FIXED_ENTRIES的断点处理不一致 - 我的二维码/名片二维码生成失败没有重试入口,只能关掉弹层重开——补上 重试按钮,同时处理"铸造失败"和"canvas绘制失败"两种情况 - 通讯录域几乎所有列表(好友列表/新朋友/群聊列表/黑名单/好友主页/加 好友搜索)都把请求失败误判成"没有数据",统一补上isError态+重试按 钮;好友主页额外区分403(资料保护)/404(真的不存在)/其它错误三种情况, 之前网络错误也会显示"未找到该用户" Co-Authored-By: Claude Sonnet 5 --- web/src/features/contacts/AddFriendModal.tsx | 22 ++++++++++++++----- web/src/features/contacts/BlocklistView.tsx | 7 ++++++ .../features/contacts/ContactsListColumn.tsx | 9 +++++++- .../features/contacts/FriendProfileView.tsx | 22 ++++++++++++++++--- web/src/features/contacts/GroupListView.tsx | 7 ++++++ web/src/features/contacts/NewFriendsView.tsx | 7 ++++++ web/src/features/contacts/QRCodeModal.tsx | 15 +++++++++++-- 7 files changed, 78 insertions(+), 11 deletions(-) diff --git a/web/src/features/contacts/AddFriendModal.tsx b/web/src/features/contacts/AddFriendModal.tsx index 3a58ba96..38325b3a 100644 --- a/web/src/features/contacts/AddFriendModal.tsx +++ b/web/src/features/contacts/AddFriendModal.tsx @@ -47,7 +47,7 @@ export function AddFriendModal({ onClose, onSent, initialTarget }: AddFriendModa // Tracks HOW `selected` was populated so the eventual sendFriendRequest can report the real // provenance instead of always claiming "search" -- NewFriendsView's own SOURCE_LABEL map has a // dedicated "扫码添加" entry for the qr case that was otherwise dead/unreachable. - const [selectedSource, setSelectedSource] = useState<'search' | 'qr'>('search'); + const [selectedSource, setSelectedSource] = useState<'search' | 'phone' | 'qr'>('search'); const [message, setMessage] = useState(''); const [error, setError] = useState(''); const [sent, setSent] = useState(false); @@ -194,9 +194,9 @@ export function AddFriendModal({ onClose, onSent, initialTarget }: AddFriendModa key={action.label} type="button" onClick={action.onClick} - className="flex flex-col items-center gap-1.5 rounded-lg bg-surface-input py-3 text-xs text-text-secondary" + className="flex items-center justify-center gap-2 rounded-lg bg-surface-input py-3 text-xs text-text-secondary" > - + {action.label} ))} @@ -208,6 +208,13 @@ export function AddFriendModal({ onClose, onSent, initialTarget }: AddFriendModa
{searchQuery.isLoading ? (
搜索中…
+ ) : searchQuery.isError ? ( +
+ 搜索失败,请重试 + +
) : !searchQuery.data?.items.length ? (
未找到相关用户
) : ( @@ -220,7 +227,12 @@ export function AddFriendModal({ onClose, onSent, initialTarget }: AddFriendModa type="button" disabled={!selectable} onClick={() => { - setSelectedSource('search'); + // `searchType` (already computed above from the query itself) is the real + // signal for which channel actually found this person -- NewFriendsView's + // own SOURCE_LABEL table already has a `phone` entry ("通过手机号搜索") + // that this path never reached because every search result was tagged + // 'search' regardless of how it was found. + setSelectedSource(searchType === 'phone' ? 'phone' : 'search'); setSelected(item); }} className="flex items-center gap-3 rounded-lg px-2 py-2 text-left disabled:opacity-70" @@ -231,7 +243,7 @@ export function AddFriendModal({ onClose, onSent, initialTarget }: AddFriendModa {item.public_account ? ID: {item.public_account} : null} {selectable ? ( - + {isSelected ? '已选择' : '选择'} ) : ( diff --git a/web/src/features/contacts/BlocklistView.tsx b/web/src/features/contacts/BlocklistView.tsx index 544b7658..cce84d6b 100644 --- a/web/src/features/contacts/BlocklistView.tsx +++ b/web/src/features/contacts/BlocklistView.tsx @@ -103,6 +103,13 @@ export function BlocklistView() {
{query.isLoading ? (
加载中…
+ ) : query.isError ? ( +
+ 加载失败,请重试 + +
) : items.length === 0 ? (
黑名单是空的
) : ( diff --git a/web/src/features/contacts/ContactsListColumn.tsx b/web/src/features/contacts/ContactsListColumn.tsx index 40b6f8d6..20bda27c 100644 --- a/web/src/features/contacts/ContactsListColumn.tsx +++ b/web/src/features/contacts/ContactsListColumn.tsx @@ -65,7 +65,7 @@ export function ContactsListColumn() {