This commit is contained in:
oneao committed 2026-01-03 22:02:11 +08:00
1 parent c26d1b3c81
commit fac3206497
24 files changed
+364 -284

No files matched your search

+125 -217
View File
@@ -1,246 +1,154 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>私聊界面示例</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
height: 100vh;
display: flex;
}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC";
background: #f0f2f5;
}
/* 左侧聊天列表 */
.chat-list {
width: 280px;
background-color: #fff;
border-right: 1px solid #ddd;
overflow-y: auto;
display: flex;
flex-direction: column;
}
.mask {
position: fixed;
inset: 0;
background: rgba(0,0,0,.45);
display: flex;
align-items: center;
justify-content: center;
}
.chat-list .user-card {
display: flex;
align-items: center;
padding: 12px 16px;
cursor: pointer;
transition: background-color 0.2s;
border-bottom: 1px solid #f0f0f0;
}
.modal {
width: 480px;
background: #fff;
border-radius: 8px;
box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
.chat-list .user-card:hover,
.chat-list .user-card.active {
background-color: #f0f8ff;
}
/* 用户区 */
.header {
display: flex;
gap: 14px;
padding: 16px 20px;
border-bottom: 1px solid #f0f0f0;
}
.chat-list .avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 12px;
object-fit: cover;
border: 2px solid #4caf50;
/* 默认在线状态绿色 */
}
.avatar {
width: 52px;
height: 52px;
border-radius: 50%;
background: #ddd;
}
.chat-list .user-info {
flex: 1;
}
.user-main {
flex: 1;
}
.chat-list .user-name {
margin: 0;
font-size: 14px;
font-weight: bold;
}
.user-line {
font-size: 16px;
font-weight: 600;
color: #262626;
}
.chat-list .user-position {
margin: 2px 0 0 0;
font-size: 12px;
color: #666;
}
.user-line .role {
font-weight: 400;
color: #595959;
}
.chat-list .status {
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #4caf50;
}
.status {
font-size: 12px;
color: #52c41a;
margin-left: 6px;
}
.chat-list .offline {
background-color: #ccc;
}
.contact-line {
margin-top: 6px;
font-size: 13px;
color: #595959;
display: flex;
gap: 16px;
}
/* 右侧聊天详情 */
.chat-detail {
flex: 1;
display: flex;
flex-direction: column;
background-color: #f9f9f9;
}
.action {
margin-top: 10px;
}
.chat-header {
display: flex;
align-items: center;
padding: 12px 16px;
background-color: #fff;
border-bottom: 1px solid #ddd;
}
.btn {
padding: 6px 14px;
border-radius: 6px;
border: none;
background: #1677ff;
color: #fff;
font-size: 13px;
cursor: pointer;
}
.chat-header .avatar {
width: 50px;
height: 50px;
border-radius: 50%;
margin-right: 12px;
border: 2px solid #4caf50;
}
/* 公司区 */
.company {
padding: 14px 20px 18px;
}
.chat-header .info {
flex: 1;
}
.company-name {
font-size: 14px;
font-weight: 500;
color: #262626;
}
.chat-header .info .name {
font-size: 16px;
font-weight: bold;
margin: 0;
}
.company-meta {
margin-top: 4px;
font-size: 12px;
color: #8c8c8c;
}
.chat-header .info .position {
font-size: 12px;
color: #666;
margin: 2px 0;
}
.desc {
margin-top: 8px;
font-size: 13px;
color: #595959;
line-height: 1.6;
.chat-header .info .company-info {
font-size: 12px;
color: #999;
display: flex;
align-items: center;
}
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
</style>
</head>
.chat-header .info .company-logo {
width: 16px;
height: 16px;
margin-right: 4px;
border-radius: 2px;
object-fit: cover;
}
<body>
<div class="mask">
<div class="modal">
.messages {
flex: 1;
padding: 16px;
overflow-y: auto;
}
.message {
margin-bottom: 12px;
max-width: 70%;
padding: 8px 12px;
border-radius: 12px;
background-color: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.message.self {
background-color: #dcf8c6;
margin-left: auto;
}
.message.other {
background-color: #fff;
margin-right: auto;
}
.chat-input {
padding: 12px 16px;
border-top: 1px solid #ddd;
background-color: #fff;
display: flex;
gap: 8px;
}
.chat-input input {
flex: 1;
padding: 8px 12px;
border: 1px solid #ccc;
border-radius: 20px;
outline: none;
}
.chat-input button {
padding: 8px 16px;
border: none;
background-color: #4caf50;
color: #fff;
border-radius: 20px;
cursor: pointer;
}
</style>
</head>
<body>
<!-- 左侧聊天列表 -->
<div class="chat-list">
<div class="user-card active">
<img class="avatar" src="https://i.pravatar.cc/40?img=1" alt="头像" />
<div class="user-info">
<p class="user-name">张三</p>
<p class="user-position">前端工程师</p>
<!-- 用户 -->
<div class="header">
<div class="avatar"></div>
<div class="user-main">
<div class="user-line">
张三 · <span class="role">产品经理</span>
<span class="status">● 在线</span>
</div>
<div class="status"></div>
</div>
<div class="user-card">
<img class="avatar" src="https://i.pravatar.cc/40?img=2" alt="头像" />
<div class="user-info">
<p class="user-name">李四</p>
<p class="user-position">产品经理</p>
<div class="contact-line">
<span>📧 zhangsan@company.com</span>
<span>📞 138****8888</span>
</div>
<div class="status offline"></div>
</div>
<div class="user-card">
<img class="avatar" src="https://i.pravatar.cc/40?img=3" alt="头像" />
<div class="user-info">
<p class="user-name">王五</p>
<p class="user-position">设计师</p>
<div class="action">
<button class="btn">发起聊天</button>
</div>
<div class="status"></div>
</div>
</div>
<!-- 右侧聊天详情 -->
<div class="chat-detail">
<!-- 聊天头部 -->
<div class="chat-header">
<img class="avatar" src="https://i.pravatar.cc/50?img=1" alt="头像" />
<div class="info">
<p class="name">张三</p>
<p class="position">前端工程师</p>
<div class="company-info">
<img class="company-logo" src="https://via.placeholder.com/16" alt="公司logo" />
<span>ABC科技公司</span>
</div>
</div>
</div>
<!-- 消息区域 -->
<div class="messages">
<div class="message other">你好!这是张三的消息。</div>
<div class="message self">你好,我是自己发的消息。</div>
<div class="message other">我们下午开会吗?</div>
<div class="message self">好的,下午三点。</div>
</div>
<!-- 输入框 -->
<div class="chat-input">
<input type="text" placeholder="输入消息..." />
<button>发送</button>
<!-- 公司 -->
<div class="company">
<div class="company-name">北京某某科技有限公司</div>
<div class="company-meta">互联网 / SaaS · 北京</div>
<div class="desc">
专注于为中大型企业提供数字化解决方案,覆盖供应链、协同办公与数据分析等多个领域,
服务客户超过 3000 家。
</div>
</div>
</body>
</div>
</div>
</body>
</html>