From c4ba459b20c92409ad0ea67f4cbd34f604dff91e 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, 5 Sep 2025 17:04:34 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ckbox):=20=E7=A7=BB=E9=99=A4=E5=85=A8?= =?UTF-8?q?=E5=B1=80profile=E7=8A=B6=E6=80=81=E5=B9=B6=E7=A7=BB=E8=87=B3Ch?= =?UTF-8?q?atWindow=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将profile显示状态从父组件移至ChatWindow组件内部管理,简化组件间通信 --- .../pc/ckbox/components/ChatWindow/index.tsx | 24 ++++++++++++------- Cunkebao/src/pages/pc/ckbox/index.tsx | 11 +++------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx index 11f817f4..9019a963 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import { Layout, Button, Avatar, Space, Dropdown, Menu, Tooltip } from "antd"; import { PhoneOutlined, @@ -6,6 +6,7 @@ import { MoreOutlined, UserOutlined, TeamOutlined, + InfoCircleOutlined, } from "@ant-design/icons"; import { ContractData, weChatGroup } from "@/pages/pc/ckbox/data"; import styles from "./ChatWindow.module.scss"; @@ -18,15 +19,13 @@ const { Header, Content } = Layout; interface ChatWindowProps { contract: ContractData | weChatGroup; - showProfile?: boolean; - onToggleProfile?: () => void; } -const ChatWindow: React.FC = ({ - contract, - showProfile = true, - onToggleProfile, -}) => { +const ChatWindow: React.FC = ({ contract }) => { + const [showProfile, setShowProfile] = useState(true); + const onToggleProfile = () => { + setShowProfile(!showProfile); + }; const chatMenu = ( }> @@ -76,6 +75,7 @@ const ChatWindow: React.FC = ({ className={styles.headerButton} /> + - - setShowProfile(!showProfile)} - /> + */} + ) : (