From faefefe186fc1bf10f08930e4501b202b72b66f8 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 09:43:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ckbox):=20=E4=BC=98=E5=8C=96=E4=BE=A7?= =?UTF-8?q?=E8=BE=B9=E6=A0=8F=E8=8F=9C=E5=8D=95=E7=BB=84=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E8=81=94=E7=B3=BB=E4=BA=BA=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将群组图标和文字替换为朋友圈 - 移除未使用的response变量 - 重构联系人列表组件,使用Collapse的items属性替代Panel组件 - 添加CollapseProps类型导入 --- .../SidebarMenu/WechatFriends/index.tsx | 70 ++++++++++--------- .../pc/ckbox/components/SidebarMenu/index.tsx | 8 +-- Cunkebao/src/pages/pc/ckbox/index.tsx | 1 - 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/WechatFriends/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/WechatFriends/index.tsx index 6b19a4ac..76d94888 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/WechatFriends/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/WechatFriends/index.tsx @@ -1,5 +1,6 @@ import React, { useState, useCallback, useEffect } from "react"; import { List, Avatar, Collapse, Button } from "antd"; +import type { CollapseProps } from "antd"; import { ContractData } from "@/pages/pc/ckbox/data"; import styles from "./WechatFriends.module.scss"; import { useCkChatStore } from "@/store/module/ckchat"; @@ -10,8 +11,6 @@ interface WechatFriendsProps { selectedContactId?: ContractData; } -const { Panel } = Collapse; - const ContactListSimple: React.FC = ({ contracts, onContactClick, @@ -130,6 +129,39 @@ const ContactListSimple: React.FC = ({ ); }; + // 构建Collapse的items属性 + const getCollapseItems = (): CollapseProps['items'] => { + if (!newContractList || newContractList.length === 0) return []; + + return newContractList.map((group, index) => { + const groupKey = index.toString(); + const isActive = activeKey.includes(groupKey); + + return { + key: groupKey, + label: ( +
+ {group.groupName} + + {group.contacts.length} + +
+ ), + className: styles.groupPanel, + children: isActive ? ( + <> + + {renderLoadMoreButton(groupKey)} + + ) : null + }; + }); + }; + return (
{newContractList && newContractList.length > 0 ? ( @@ -137,38 +169,8 @@ const ContactListSimple: React.FC = ({ className={styles.groupCollapse} activeKey={activeKey} onChange={keys => setActiveKey(keys as string[])} - > - {newContractList.map((group, index) => { - const groupKey = index.toString(); - const isActive = activeKey.includes(groupKey); - - return ( - - {group.groupName} - - {group.contacts.length} - -
- } - key={groupKey} - className={styles.groupPanel} - > - {isActive && ( - <> - - {renderLoadMoreButton(groupKey)} - - )} - - ); - })} - + items={getCollapseItems()} + /> ) : ( <>
全部好友
diff --git a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx index 7b5e890c..7114f7b1 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx @@ -3,7 +3,7 @@ import { Input, Skeleton } from "antd"; import { SearchOutlined, UserOutlined, - TeamOutlined, + ChromeOutlined, MessageOutlined, } from "@ant-design/icons"; import { ContractData } from "@/pages/pc/ckbox/data"; @@ -131,8 +131,8 @@ const SidebarMenu: React.FC = ({ className={`${styles.tabItem} ${activeTab === "groups" ? styles.active : ""}`} onClick={() => setActiveTab("groups")} > - - 群组 + + 朋友圈 @@ -160,7 +160,7 @@ const SidebarMenu: React.FC = ({ case "groups": return (
- +

暂无群组

); diff --git a/Cunkebao/src/pages/pc/ckbox/index.tsx b/Cunkebao/src/pages/pc/ckbox/index.tsx index 8b4ba820..7869f537 100644 --- a/Cunkebao/src/pages/pc/ckbox/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/index.tsx @@ -34,7 +34,6 @@ const CkboxPage: React.FC = () => { newContractList: { groupName: string; contacts: any[] }[]; }; const { contractList, groupList, kfUserList, newContractList } = data; - response; console.log(contractList, groupList, kfUserList, newContractList);