Files
workspace/code/link/link-fronted/test.html
T
2025-10-10 21:43:09 +08:00

330 lines
8.6 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>企业三栏聊天页面</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Arial, sans-serif;
}
body {
background: #f0f2f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.chat-app {
display: flex;
width: 1300px;
height: 750px;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.15);
background: #fff;
}
/* 左侧列表 */
.sidebar {
width: 300px;
background: #2c3e50;
color: #fff;
display: flex;
flex-direction: column;
}
.sidebar-header {
padding: 20px;
font-size: 20px;
font-weight: bold;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.search-box {
padding: 10px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.search-box input {
width: 100%;
padding: 8px;
border-radius: 5px;
border: none;
outline: none;
}
/* 单聊/群聊列表 */
.list-section {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
padding: 10px 0;
}
.list-section h3 {
padding: 0 20px;
margin-bottom: 5px;
font-size: 14px;
color: #95a5a6;
text-transform: uppercase;
}
.list-item {
display: flex;
align-items: center;
padding: 10px 20px;
cursor: pointer;
transition: background 0.2s;
border-radius: 5px;
margin: 0 10px 5px 10px;
}
.list-item:hover,
.list-item.active {
background: #34495e;
}
.list-item img {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 12px;
}
.list-item .info {
flex: 1;
}
.list-item .info .name {
font-weight: bold;
font-size: 16px;
}
.list-item .unread {
background: #e74c3c;
color: #fff;
font-size: 12px;
min-width: 18px;
height: 18px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-left: 8px;
padding: 0 5px;
}
/* 中间聊天区 */
.chat-container {
flex: 2;
display: flex;
flex-direction: column;
background: #ecf0f1;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
}
.chat-header {
height: 60px;
display: flex;
align-items: center;
padding: 0 20px;
font-weight: bold;
font-size: 18px;
background: #fff;
border-bottom: 1px solid #ccc;
}
.chat-messages {
flex: 1;
padding: 20px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 10px;
}
.message {
display: flex;
max-width: 70%;
padding: 10px 14px;
border-radius: 15px;
line-height: 1.4;
word-wrap: break-word;
position: relative;
align-items: flex-start;
}
.message.from-me {
background: #2c3e50;
color: #fff;
align-self: flex-end;
border-bottom-right-radius: 0;
flex-direction: row-reverse;
}
.message.from-other {
background: #bdc3c7;
color: #000;
align-self: flex-start;
border-bottom-left-radius: 0;
}
.message .avatar {
width: 35px;
height: 35px;
border-radius: 50%;
margin: 0 8px;
}
.message .content {
display: flex;
flex-direction: column;
}
.message .content .sender {
font-size: 12px;
color: #555;
margin-bottom: 4px;
font-weight: bold;
}
.message .content .timestamp {
font-size: 10px;
color: #888;
align-self: flex-end;
margin-top: 4px;
}
/* 输入区 */
.chat-input {
height: 70px;
display: flex;
padding: 10px 15px;
border-top: 1px solid #ccc;
background: #fff;
gap: 10px;
}
.chat-input input {
flex: 1;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
outline: none;
font-size: 16px;
}
.chat-input button {
width: 80px;
border: none;
border-radius: 5px;
background: #1abc9c;
color: #fff;
cursor: pointer;
font-size: 16px;
transition: background 0.2s;
}
.chat-input button:hover {
background: #16a085;
}
/* 右侧详情栏 */
.chat-detail {
width: 250px;
background: #f7f9fa;
padding: 20px;
overflow-y: auto;
}
.chat-detail h3 {
font-size: 16px;
margin-bottom: 10px;
color: #333;
}
.chat-detail ul {
list-style: none;
}
.chat-detail li {
padding: 6px 0;
font-size: 14px;
color: #555;
border-bottom: 1px solid #eee;
}
/* 滚动条 */
.list-section::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.chat-detail::-webkit-scrollbar {
width: 6px;
}
.list-section::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.chat-detail::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 3px;
}
</style>
</head>
<body>
<div class="chat-app">
<!-- 左侧列表 -->
<div class="sidebar">
<div class="sidebar-header">企业通信</div>
<div class="search-box">
<input type="text" placeholder="搜索联系人或群组..." />
</div>
<!-- 单聊 -->
<div class="list-section" id="singleList">
<h3>单聊联系人</h3>
<div class="list-item" data-type="single" data-id="enterprise1">
<img src="https://i.pravatar.cc/40?img=1" />
<div class="info"><div class="name">企业A</div></div>
<span class="unread">2</span>
</div>
<div class="list-item" data-type="single" data-id="enterprise2">
<img src="https://i.pravatar.cc/40?img=3" />
<div class="info"><div class="name">企业B</div></div>
</div>
</div>
<!-- 群聊 -->
<div class="list-section" id="groupList">
<h3>群聊群组</h3>
<div class="list-item" data-type="group" data-id="group1">
<img src="https://i.pravatar.cc/40?img=2" />
<div class="info"><div class="name">项目组X</div></div>
</div>
<div class="list-item" data-type="group" data-id="group2">
<img src="https://i.pravatar.cc/40?img=4" />
<div class="info"><div class="name">项目组Y</div></div>
</div>
</div>
</div>
<!-- 中间聊天区 -->
<div class="chat-container">
<div class="chat-header" id="chatHeader">请选择聊天对象</div>
<div class="chat-messages" id="chatMessages">
<!-- 示例消息 -->
<div class="message from-other">
<img class="avatar" src="https://i.pravatar.cc/35?img=1" />
<div class="content">
<div class="sender">企业A</div>
<div class="text">欢迎使用企业聊天系统。</div>
<div class="timestamp">09:30</div>
</div>
</div>
<div class="message from-me">
<img class="avatar" src="https://i.pravatar.cc/35?img=10" />
<div class="content">
<div class="sender">我</div>
<div class="text">收到,确认。</div>
<div class="timestamp">09:31</div>
</div>
</div>
</div>
<div class="chat-input">
<input type="text" placeholder="输入消息..." />
<button>发送</button>
</div>
</div>
<!-- 右侧详情 -->
<div class="chat-detail" id="chatDetail">
<h3>聊天详情</h3>
<ul>
<li>企业名称:企业A</li>
<li>联系人:张三</li>
<li>部门:技术部</li>
<li>未读消息:2</li>
<li>加入时间:2025-10-10</li>
</ul>
</div>
</div>
</body>
</html>