From bdc94d853dd44125d9ff5d1d716a9c3f1f254d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Fri, 29 Aug 2025 10:49:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=BB=84=E4=BB=B6):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=BE=AE=E4=BF=A1=E5=A5=BD=E5=8F=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=92=8C=E8=81=8A=E5=A4=A9=E7=AA=97=E5=8F=A3=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构微信好友列表组件中的getCollapseItems方法,简化代码格式 将聊天窗口的菜单从JSX改为items数组配置方式,提高可维护性 --- .../pc/ckbox/components/ChatWindow/index.tsx | 58 ++++++++++++------- .../SidebarMenu/WechatFriends/index.tsx | 12 ++-- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx index f2880c69..2c52a897 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx @@ -780,26 +780,42 @@ const ChatWindow: React.FC = ({ ); }; - const chatMenu = ( - - }> - 查看资料 - - }> - 语音通话 - - }> - 视频通话 - - - 置顶聊天 - 消息免打扰 - - - 清空聊天记录 - - - ); + const chatMenuItems = [ + { + key: "profile", + icon: , + label: "查看资料", + }, + { + key: "call", + icon: , + label: "语音通话", + }, + { + key: "video", + icon: , + label: "视频通话", + }, + { + type: "divider", + }, + { + key: "pin", + label: "置顶聊天", + }, + { + key: "mute", + label: "消息免打扰", + }, + { + type: "divider", + }, + { + key: "clear", + danger: true, + label: "清空聊天记录", + }, + ]; // 模拟联系人详细信息 const contractInfo = { @@ -861,7 +877,7 @@ const ChatWindow: React.FC = ({ className={styles.headerButton} /> - +