diff --git a/Cunkebao/src/components/Layout/LayoutFiexd.tsx b/Cunkebao/src/components/Layout/LayoutFiexd.tsx new file mode 100644 index 000000000..9a5cefd57 --- /dev/null +++ b/Cunkebao/src/components/Layout/LayoutFiexd.tsx @@ -0,0 +1,48 @@ +import React from "react"; +import { SpinLoading } from "antd-mobile"; +import styles from "./layout.module.scss"; + +interface LayoutProps { + loading?: boolean; + children?: React.ReactNode; + header?: React.ReactNode; + footer?: React.ReactNode; +} + +const LayoutFiexd: React.FC = ({ + header, + children, + footer, + loading = false, +}) => { + return ( +
+
{header}
+
+ {loading ? ( +
+ +
加载中...
+
+ ) : ( + children + )} +
+
{footer}
+
+ ); +}; + +export default LayoutFiexd; diff --git a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/CustomLayout.module.scss b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/CustomLayout.module.scss new file mode 100644 index 000000000..e69de29bb diff --git a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/SidebarMenu.module.scss b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/SidebarMenu.module.scss index 1b77fa4d3..6a60b1ef5 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/SidebarMenu.module.scss +++ b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/SidebarMenu.module.scss @@ -1,63 +1,61 @@ -.sidebar { +.headerContainer { background: #fff; - border-right: 1px solid #f0f0f0; - display: flex; - flex-direction: column; + border-bottom: 1px solid #f0f0f0; +} - .searchBar { - padding: 16px; - border-bottom: 1px solid #f0f0f0; - background: #fff; +.searchBar { + padding: 16px 16px 8px; + background: #fff; - :global(.ant-input) { - border-radius: 20px; - background: #f5f5f5; - border: none; + :global(.ant-input) { + border-radius: 20px; + background: #f5f5f5; + border: none; - &:focus { - background: #fff; - border: 1px solid #1890ff; - box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); - } - } - } - - .tabs { - flex: 1; - display: flex; - flex-direction: column; - - :global(.ant-tabs-content) { - flex: 1; - overflow: hidden; - } - - :global(.ant-tabs-tabpane) { - height: 100%; - overflow: hidden; - } - - :global(.ant-tabs-nav) { - margin: 0; - padding: 0 16px; + &:focus { background: #fff; - border-bottom: 1px solid #f0f0f0; - - :global(.ant-tabs-tab) { - padding: 12px 0; - margin: 0 16px 0 0; - } + border: 1px solid #1890ff; + box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); } } - - .emptyState { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - height: 100%; - color: #999; - padding: 20px; - text-align: center; - } +} + +.tabsContainer { + display: flex; + padding: 0 16px 8px; + border-bottom: 1px solid #f0f0f0; + + .tabItem { + display: flex; + align-items: center; + padding: 8px 12px; + cursor: pointer; + border-radius: 4px; + transition: all 0.3s; + + &:hover { + color: #1890ff; + background-color: rgba(24, 144, 255, 0.1); + } + + &.active { + color: #1890ff; + background-color: rgba(24, 144, 255, 0.1); + } + + span { + margin-left: 4px; + } + } +} + +.emptyState { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; + color: #999; + padding: 20px; + text-align: center; } diff --git a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx index c93fd09a2..815603099 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/SidebarMenu/index.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { Layout, Input, Tabs } from "antd"; +import { Layout as AntLayout, Input, Tabs } from "antd"; import { SearchOutlined, UserOutlined, @@ -9,9 +9,10 @@ import { import { ContactData } from "./data"; import WechatFriendsModule from "./WechatFriendsModule"; import MessageList from "../MessageList/index"; +import LayoutFiexd from "@/components/Layout/LayoutFiexd"; import styles from "./SidebarMenu.module.scss"; -const { Sider } = Layout; +const { Sider } = AntLayout; const { TabPane } = Tabs; interface SidebarMenuProps { @@ -54,8 +55,9 @@ const SidebarMenu: React.FC = ({ ); }; - return ( - + // 渲染Header部分,包含搜索框和标签页切换 + const renderHeader = () => ( +
{/* 搜索栏 */}
= ({ />
- {/* 标签页 */} - - - - 聊天 - - } - key="chats" + {/* 标签页切换 */} +
+
setActiveTab("chats")} > + + 聊天 +
+
setActiveTab("contacts")} + > + + 联系人 +
+
setActiveTab("groups")} + > + + 群组 +
+
+
+ ); + + // 渲染内容部分 + const renderContent = () => { + switch (activeTab) { + case "chats": + return ( - - - - 联系人 - - } - key="contacts" - > + ); + case "contacts": + return ( - - - - 群组 - - } - key="groups" - > + ); + case "groups": + return (

暂无群组

-
- -
+ ); + default: + return null; + } + }; + + return ( + + {renderContent()} + ); }; diff --git a/Cunkebao/src/pages/pc/ckbox/index.module.scss b/Cunkebao/src/pages/pc/ckbox/index.module.scss index 2237cce91..113abc019 100644 --- a/Cunkebao/src/pages/pc/ckbox/index.module.scss +++ b/Cunkebao/src/pages/pc/ckbox/index.module.scss @@ -1,10 +1,27 @@ .ckboxLayout { height: 100vh; background: #fff; + display: flex; + flex-direction: column; - .sidebar { + .header { + background: #1890ff; + color: #fff; + height: 64px; + line-height: 64px; + padding: 0 24px; + font-size: 18px; + font-weight: bold; + } + + .sider { background: #fff; border-right: 1px solid #f0f0f0; + overflow: auto; + } + + .sidebar { + height: 100%; display: flex; flex-direction: column; @@ -87,6 +104,8 @@ background: #f5f5f5; display: flex; flex-direction: column; + padding: 16px; + overflow: auto; .chatContainer { height: 100%; diff --git a/Cunkebao/src/pages/pc/ckbox/index.tsx b/Cunkebao/src/pages/pc/ckbox/index.tsx index 32e7ced68..fb5f392c6 100644 --- a/Cunkebao/src/pages/pc/ckbox/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/index.tsx @@ -7,7 +7,7 @@ import ChatWindow from "./components/ChatWindow/index"; import SidebarMenu from "./components/SidebarMenu/index"; import styles from "./index.module.scss"; -const { Content } = Layout; +const { Header, Content, Sider } = Layout; import { loginWithToken, clearUnreadCount, getMessages } from "./api"; import { useUserStore } from "@/store/module/user"; import { chatInitAPIdata } from "./main"; @@ -85,53 +85,57 @@ const CkboxPage: React.FC = () => { return ( - {/* */} {contextHolder} - {/* 左侧边栏 */} - +
触客宝
+ + {/* 左侧边栏 */} + + + - {/* 主内容区 */} - - {currentChat ? ( -
-
- - - - - + {/* 主内容区 */} + + {currentChat ? ( +
+
+ + + + + +
+ setShowProfile(!showProfile)} + />
- setShowProfile(!showProfile)} - /> -
- ) : ( -
-
- -

欢迎使用触客宝

-

选择一个联系人开始聊天

+ ) : ( +
+
+ +

欢迎使用触客宝

+

选择一个联系人开始聊天

+
-
- )} - + )} + + ); };