You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1090 lines
42 KiB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>青核 Youthome - 聊天详情</title>
<link rel="stylesheet" href="../colors_and_type.css">
<script src="https://cdn.tailwindcss.com"></script>
<style>
* {
-webkit-tap-highlight-color: transparent;
box-sizing: border-box;
}
:root {
/* Traework 设计令牌 - 圆角/间距/阴影/高度 */
--radius-xs: 4px;
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--radius-xl: 20px;
--radius-full: 9999px;
--height-btn: 44px;
--height-input: 44px;
--height-nav: 64px;
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 24px;
--shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
--shadow-card-hover: 0 6px 20px rgba(0, 0, 0, 0.06);
--shadow-btn: 0 2px 8px rgba(38, 194, 187, 0.25);
--shadow-btn-hover: 0 4px 16px rgba(38, 194, 187, 0.35);
--shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.12);
--shadow-float: 0 4px 24px rgba(0, 0, 0, 0.08);
--shadow-inset: inset 0 1px 3px rgba(0, 0, 0, 0.03);
--glass-bg: rgba(255, 255, 255, 0.72);
--glass-blur: blur(20px);
--glass-border: rgba(255, 255, 255, 0.3);
}
body {
font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--youth-bg-page);
color: var(--youth-text-primary);
margin: 0;
padding: 0;
overflow: hidden;
overflow-x: hidden;}
/* 页面容器 - 固定812px高度 */
.app-container {
width: 375px;
height: 812px;
margin: 0 auto;
position: relative;
overflow: hidden;
background: var(--youth-bg-page);
}
/* 状态栏 */
.status-bar {
height: 44px;
display: flex;
align-items: flex-end;
justify-content: space-between;
padding: 0 24px 8px;
font-size: 15px;
font-weight: 600;
color: var(--youth-text-primary);
flex-shrink: 0;
z-index: 50;
position: relative;
padding-bottom: 6px;
}
.status-bar .right-icons {
display: flex;
align-items: center;
gap: 6px;
}
/* 顶部导航栏 - 毛玻璃 */
.top-nav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
background: var(--youth-bg-glass);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border-bottom: 1px solid var(--youth-glass-border);
position: relative;
z-index: 40;
}
.nav-btn {
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: var(--youth-gradient-matte-light);
box-shadow:
0 2px 6px rgba(0, 0, 0, 0.06),
inset 0 1px 2px rgba(255, 255, 255, 0.8);
transition: all 0.2s ease;
}
.nav-btn:active {
transform: scale(0.95);
}
.nav-center {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 50%;
margin-top: -18px;
}
.nav-avatar-wrap {
display: flex;
align-items: center;
gap: 6px;
cursor: pointer;
}
.nav-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: var(--youth-gradient-primary);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 13px;
font-weight: 600;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.3);
}
.nav-name {
font-size: 15px;
font-weight: 600;
color: var(--youth-text-primary);
}
.nav-status {
display: flex;
align-items: center;
gap: 4px;
font-size: 11px;
color: var(--youth-text-tertiary);
}
.status-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--youth-primary);
box-shadow: 0 0 4px rgba(38, 194, 187, 0.6);
}
.nav-right {
display: flex;
align-items: center;
gap: 8px;
}
.nav-btn-icon {
width: 18px;
height: 18px;
color: var(--youth-text-primary);
}
/* 聊天消息区 */
.chat-area {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 12px 12px 16px;
display: flex;
flex-direction: column;
gap: 12px;
height: calc(812px - 44px - 56px - 70px);
}
.chat-area::-webkit-scrollbar {
width: 0;
display: none;
}
/* 时间分隔 */
.time-divider {
align-self: center;
padding: 4px 12px;
background: var(--youth-gray-200);
border-radius: 12px;
font-size: 11px;
color: var(--youth-text-tertiary);
margin: 4px 0;
}
/* 消息气泡 - 对方(左) */
.msg-received {
display: flex;
align-items: flex-end;
gap: 8px;
max-width: 75%;
align-self: flex-start;
}
.msg-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: var(--youth-gradient-primary);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 12px;
font-weight: 600;
flex-shrink: 0;
box-shadow: 0 2px 6px rgba(38, 194, 187, 0.25);
}
.msg-avatar-self {
background: linear-gradient(135deg, #FFB96B 0%, #FF9F45 100%);
box-shadow: 0 2px 6px rgba(255, 159, 69, 0.3);
}
.msg-bubble-received {
background: var(--youth-bg-card);
border-radius: 16px;
border-bottom-left-radius: 4px;
padding: 10px 14px;
font-size: 14px;
line-height: 1.5;
color: var(--youth-text-primary);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
position: relative;
word-break: break-word;
}
/* 消息气泡 - 我方(右) */
.msg-sent {
display: flex;
align-items: flex-end;
gap: 8px;
max-width: 75%;
align-self: flex-end;
flex-direction: row-reverse;
}
.msg-bubble-sent {
background: var(--youth-gradient-primary);
border-radius: 16px;
border-bottom-right-radius: 4px;
padding: 10px 14px;
font-size: 14px;
line-height: 1.5;
color: white;
box-shadow: 0 2px 10px rgba(38, 194, 187, 0.3);
position: relative;
word-break: break-word;
}
/* 消息图片 */
.msg-image {
width: 120px;
height: 90px;
border-radius: 8px;
object-fit: cover;
margin-top: 6px;
display: block;
}
.msg-bubble-received .msg-image {
margin-top: 0;
margin-bottom: 6px;
}
/* 已读状态 */
.msg-read-status {
font-size: 10px;
color: var(--youth-text-tertiary);
text-align: right;
margin-top: 4px;
padding-right: 4px;
}
/* 正在输入 */
.typing-indicator {
display: flex;
align-items: center;
gap: 8px;
align-self: flex-start;
}
.typing-bubble {
background: var(--youth-bg-card);
border-radius: 16px;
border-bottom-left-radius: 4px;
padding: 12px 16px;
display: flex;
align-items: center;
gap: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.typing-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--youth-text-tertiary);
animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
0%, 60%, 100% {
transform: translateY(0);
opacity: 0.5;
}
30% {
transform: translateY(-6px);
opacity: 1;
}
}
/* 底部输入栏 - 毛玻璃 */
.input-bar {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
background: var(--youth-bg-glass);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border-top: 1px solid var(--youth-glass-border);
position: relative;
z-index: 30;
}
.input-btn {
width: 36px;
height: 44px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: var(--youth-gradient-matte-light);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
flex-shrink: 0;
transition: all 0.2s ease;
}
.input-btn:active {
transform: scale(0.95);
}
.input-btn-icon {
width: 18px;
height: 18px;
color: var(--youth-text-secondary);
}
.input-field-wrap {
flex: 1;
position: relative;
}
.input-field {
width: 100%;
height: 44px;
border: none;
outline: none;
border-radius: 8px;
padding: 0 14px;
font-size: 14px;
background: var(--youth-bg-input);
color: var(--youth-text-primary);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
transition: all 0.2s ease;
}
.input-field:focus {
box-shadow: inset 0 1px 3px rgba(38, 194, 187, 0.06), 0 0 0 3px rgba(38, 194, 187, 0.1);
}
.input-field::placeholder {
color: var(--youth-text-placeholder);
}
.send-btn {
width: 36px;
height: 44px;
border-radius: 50%;
background: var(--youth-gradient-primary);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 8px rgba(38, 194, 187, 0.35);
flex-shrink: 0;
transition: all 0.2s ease;
}
.send-btn:active {
transform: scale(0.95);
box-shadow: 0 1px 4px rgba(38, 194, 187, 0.3);
}
.send-btn.hidden {
display: none;
}
.send-btn-icon {
width: 16px;
height: 16px;
color: white;
}
/* 更多功能面板 */
.more-panel {
position: absolute;
bottom: -260px;
left: 0;
right: 0;
background: var(--youth-bg-glass-strong);
backdrop-filter: blur(40px) saturate(180%);
-webkit-backdrop-filter: blur(40px) saturate(180%);
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-top: 1px solid var(--youth-glass-border);
padding: 16px 12px 24px;
z-index: 35;
transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}
.more-panel.open {
bottom: 0;
}
.more-panel-handle {
width: 36px;
height: 4px;
background: var(--youth-gray-300);
border-radius: 2px;
margin: 0 auto 16px;
}
.more-panel-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px 12px;
}
.more-panel-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
cursor: pointer;
transition: transform 0.2s ease;
}
.more-panel-item:active {
transform: scale(0.95);
}
.more-panel-icon {
width: 52px;
height: 52px;
border-radius: 16px;
background: var(--youth-gradient-matte-light);
display: flex;
align-items: center;
justify-content: center;
box-shadow:
0 4px 12px rgba(0, 0, 0, 0.06),
inset 0 1px 2px rgba(255, 255, 255, 0.8),
inset 0 -1px 2px rgba(0, 0, 0, 0.04);
}
.more-panel-icon svg {
width: 24px;
height: 24px;
}
.more-panel-label {
font-size: 11px;
color: var(--youth-text-secondary);
}
/* 表情面板 */
.emoji-panel {
position: absolute;
bottom: -260px;
left: 0;
right: 0;
background: var(--youth-bg-glass-strong);
backdrop-filter: blur(40px) saturate(180%);
-webkit-backdrop-filter: blur(40px) saturate(180%);
border-top-left-radius: 20px;
border-top-right-radius: 20px;
border-top: 1px solid var(--youth-glass-border);
padding: 12px 12px 28px;
z-index: 35;
transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}
.emoji-panel.open {
bottom: 0;
}
.emoji-grid {
display: grid;
grid-template-columns: repeat(8, 1fr);
gap: 4px;
}
.emoji-item {
width: 100%;
aspect-ratio: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
cursor: pointer;
border-radius: 8px;
transition: background 0.15s ease, transform 0.1s ease;
}
.emoji-item:active {
background: rgba(38, 194, 187, 0.12);
transform: scale(0.92);
}
/* 主页面布局flex */
.page-layout {
display: flex;
flex-direction: column;
height: 100%;
}
/* SVG 图标统一尺寸 */
.icon-svg {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1em;
height: 1em;
vertical-align: middle;
line-height: 1;
}
.icon-svg svg {
width: 100%;
height: 100%;
stroke: currentColor;
}
/* 侧栏图标 */
.sidebar-icon .icon-svg { width: 22px; height: 22px; font-size: 22px; }
/* 社团logo图标 */
.club-logo .icon-svg { width: 28px; height: 28px; font-size: 28px; color: #fff; }
/* 头图大图标 */
.hero-icon .icon-svg { width: 56px; height: 56px; font-size: 56px; opacity: 0.3; }
/* meta 小图标 */
.club-meta .icon-svg { width: 12px; height: 12px; font-size: 12px; }
/* 分类选择网格图标 */
.cat-option .icon-svg { width: 26px; height: 26px; font-size: 26px; }
/* logo预览图标 */
.logo-preview .icon-svg { width: 40px; height: 40px; font-size: 40px; color: #fff; }
/* 提示图标 */
.notice-icon .icon-svg { width: 18px; height: 18px; font-size: 18px; }
</style>
</head>
<body>
<div class="app-container">
<div class="page-layout">
<!-- 状态栏 -->
<div class="status-bar">
<span>9:41</span>
<div class="right-icons">
<svg width="16" height="11" viewBox="0 0 16 11" fill="currentColor">
<path d="M1 7.5a1 1 0 0 1 1.414-.008l.094.094L4 9.086V6a1 1 0 0 1 .883-.993L5 5h2a1 1 0 0 1 .993.883L8 6v3.086l1.49-1.49a1 1 0 0 1 1.32-.083l.094.083a1 1 0 0 1 .083 1.32l-.083.094-3.182 3.182a1 1 0 0 1-1.414 0L1.008 8.914A1 1 0 0 1 1 7.5Z"></path>
<path d="M12 3a1 1 0 0 1 1.414-.008l.094.094L16 5.586a1 1 0 0 1-1.32 1.497l-.094-.083L14 5.414V11a1 1 0 0 1-1.993.117L12 11V3Z"></path>
</svg>
<svg width="15" height="11" viewBox="0 0 15 11" fill="currentColor">
<path d="M7.5 1.5c2.3 0 4.4.85 6 2.28a.5.5 0 0 1 .1.7l-.1.1-1.3 1.3a.5.5 0 0 1-.67.06l-.08-.06a5 5 0 0 0-7.9 0l-.08.06a.5.5 0 0 1-.67 0l-.1-.1L1.4 4.58a.5.5 0 0 1 0-.7C2.6 2.35 4.7 1.5 7.5 1.5Zm0 3.5c1 0 1.9.37 2.6 1a.5.5 0 0 1 .08.7l-.08.08-1.1 1.1a.5.5 0 0 1-.66.06l-.07-.06-.53-.53a.5.5 0 0 0-.64 0l-.53.53a.5.5 0 0 1-.66 0l-.07-.06-1.1-1.1a.5.5 0 0 1 0-.7C5.6 5.37 6.5 5 7.5 5Zm0 2.5c.5 0 .9.2 1.2.5l-.05.06-.7.7a.5.5 0 0 1-.7 0l-.7-.7.05-.06c.3-.3.7-.5 1.2-.5Z"></path>
</svg>
<svg width="26" height="12" viewBox="0 0 26 12" fill="currentColor">
<rect x="0.5" y="0.5" width="22" height="11" rx="2.5" stroke="currentColor" fill="none" opacity="0.4"></rect>
<rect x="2" y="2" width="18" height="8" rx="1.5"></rect>
<rect x="23.5" y="3.5" width="2" height="5" rx="1" fill="currentColor" opacity="0.4"></rect>
</svg>
</div>
</div>
<!-- 顶部导航栏 -->
<div class="top-nav">
<button class="nav-btn" data-dom-id="btn-back" onclick="goBack()">
<svg class="nav-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="15 18 9 12 15 6"></polyline>
</svg>
</button>
<div class="nav-center">
<div class="nav-avatar-wrap" onclick="goToProfile()">
<span class="nav-name">林小雨</span>
</div>
<div class="nav-status">
<span class="status-dot"></span>
<span>在线</span>
</div>
</div>
<div class="nav-right">
<button class="nav-btn" data-dom-id="btn-call" onclick="makeCall()">
<svg class="nav-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path>
</svg>
</button>
<button class="nav-btn" data-dom-id="btn-more-nav" onclick="goToChatSettings()">
<svg class="nav-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="1"></circle>
<circle cx="19" cy="12" r="1"></circle>
<circle cx="5" cy="12" r="1"></circle>
</svg>
</button>
</div>
</div>
<!-- 聊天消息区 -->
<div class="chat-area" id="chatArea">
<!-- 时间分隔 -->
<div class="time-divider">今天 10:20</div>
<!-- 对方消息1 -->
<div class="msg-received" data-dom-id="msg-received-1">
<div class="msg-avatar">林</div>
<div class="msg-bubble-received">
嗨~你也喜欢摄影吗?
</div>
</div>
<!-- 我方消息1 -->
<div class="msg-sent" data-dom-id="msg-sent-1">
<div class="msg-avatar msg-avatar-self">我</div>
<div class="msg-bubble-sent">
对呀!你也是清华的吗?
</div>
</div>
<!-- 对方消息2(含图) -->
<div class="msg-received" data-dom-id="msg-received-2">
<div class="msg-avatar">林</div>
<div class="msg-bubble-received" style="padding: 8px 8px 10px;">
<img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjkwIiB2aWV3Qm94PSIwIDAgMTIwIDkwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cmVjdCB3aWR0aD0iMTIwIiBoZWlnaHQ9IjkwIiBmaWxsPSIjMzRDNzU5Ii8+CjxjaXJjbGUgY3g9IjkwIiBjeT0iMjUiIHI9IjEwIiBmaWxsPSIjRkZEOTZDIi8+CjxwYXRoIGQ9Ik0wIDc1TDMwIDQ1TDUwIDYwTDgwIDMwTDEyMCA3NUgxMjBWOTBIMFY3NVoiIGZpbGw9IiMyNkMyQiIvPgo8cGF0aCBkPSJNMCA4NUwyMCA2NUw0MCA3NUw2MCA1NUw4MCA3MEwxMDAgNTBMMTIwIDg1VjkwSDBWODVaIiBmaWxsPSIjMUZBNzlFIi8+Cjwvc3ZnPgo=" alt="风景照片" class="msg-image">
<div style="padding: 0 6px;">这是上周在颐和园拍的<span class="icon-svg icon-camera"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"></path><circle cx="12" cy="13" r="3"></circle></svg></span></div>
</div>
</div>
<!-- 我方消息2 -->
<div class="msg-sent" data-dom-id="msg-sent-2">
<div class="msg-avatar msg-avatar-self">我</div>
<div class="msg-bubble-sent">
太好看了!周末有空一起去拍吗?
</div>
</div>
<!-- 对方消息3 -->
<div class="msg-received" data-dom-id="msg-received-3">
<div class="msg-avatar">林</div>
<div class="msg-bubble-received">
好呀!你周六下午有空吗?
</div>
</div>
<!-- 我方消息3(已读) -->
<div class="msg-sent" data-dom-id="msg-sent-3">
<div class="msg-avatar msg-avatar-self">我</div>
<div>
<div class="msg-bubble-sent">
有的!两点西门见?
</div>
<div class="msg-read-status">已读</div>
</div>
</div>
<!-- 正在输入 -->
<div class="typing-indicator" data-dom-id="msg-typing">
<div class="msg-avatar">林</div>
<div class="typing-bubble">
<span class="typing-dot"></span>
<span class="typing-dot"></span>
<span class="typing-dot"></span>
</div>
</div>
</div>
<!-- 底部输入栏 -->
<div class="input-bar">
<button class="input-btn" data-dom-id="btn-voice" onclick="toggleVoice()">
<svg class="input-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path>
<path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>
<line x1="12" y1="19" x2="12" y2="23"></line>
<line x1="8" y1="23" x2="16" y2="23"></line>
</svg>
</button>
<div class="input-field-wrap">
<input
type="text"
class="input-field"
data-dom-id="input-message"
placeholder="说点什么..."
id="messageInput"
oninput="handleInput()"
onfocus="handleInputFocus()"
onkeydown="handleKeyDown(event)"
>
</div>
<button class="input-btn" data-dom-id="btn-emoji" onclick="toggleEmojiPanel()">
<svg class="input-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<path d="M8 14s1.5 2 4 2 4-2 4-2"></path>
<line x1="9" y1="9" x2="9.01" y2="9"></line>
<line x1="15" y1="9" x2="15.01" y2="9"></line>
</svg>
</button>
<button class="input-btn" data-dom-id="btn-plus" onclick="toggleMorePanel()">
<svg class="input-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
<button class="send-btn hidden" data-dom-id="btn-send" onclick="sendMessage()">
<svg class="send-btn-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<line x1="22" y1="2" x2="11" y2="13"></line>
<polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
</svg>
</button>
</div>
<!-- 表情面板 -->
<div class="emoji-panel" id="emojiPanel">
<div class="more-panel-handle"></div>
<div class="emoji-grid" id="emojiGrid">
<span class="emoji-item" data-emoji="😊">😊</span>
<span class="emoji-item" data-emoji="😃">😃</span>
<span class="emoji-item" data-emoji="🥰">🥰</span>
<span class="emoji-item" data-emoji="😎">😎</span>
<span class="emoji-item" data-emoji="🤔">🤔</span>
<span class="emoji-item" data-emoji="😅">😅</span>
<span class="emoji-item" data-emoji="😭">😭</span>
<span class="emoji-item" data-emoji="👍">👍</span>
<span class="emoji-item" data-emoji="❤️">❤️</span>
<span class="emoji-item" data-emoji="🎉">🎉</span>
<span class="emoji-item" data-emoji="🔥">🔥</span>
<span class="emoji-item" data-emoji="✨">✨</span>
<span class="emoji-item" data-emoji="📷">📷</span>
<span class="emoji-item" data-emoji="🎨">🎨</span>
<span class="emoji-item" data-emoji="☕">☕</span>
<span class="emoji-item" data-emoji="🌸">🌸</span>
<span class="emoji-item" data-emoji="🍀">🍀</span>
<span class="emoji-item" data-emoji="🌙">🌙</span>
<span class="emoji-item" data-emoji="⭐">⭐</span>
<span class="emoji-item" data-emoji="💪">💪</span>
<span class="emoji-item" data-emoji="🙏">🙏</span>
<span class="emoji-item" data-emoji="👋">👋</span>
<span class="emoji-item" data-emoji="🎯">🎯</span>
<span class="emoji-item" data-emoji="🚀">🚀</span>
<span class="emoji-item" data-emoji="😘">😘</span>
<span class="emoji-item" data-emoji="🤣">🤣</span>
<span class="emoji-item" data-emoji="😴">😴</span>
<span class="emoji-item" data-emoji="🤗">🤗</span>
<span class="emoji-item" data-emoji="😏">😏</span>
<span class="emoji-item" data-emoji="🙈">🙈</span>
<span class="emoji-item" data-emoji="💔">💔</span>
<span class="emoji-item" data-emoji="🎂">🎂</span>
</div>
</div>
<!-- 更多功能面板 -->
<div class="more-panel" data-dom-id="more-panel" id="morePanel">
<div class="more-panel-handle"></div>
<div class="more-panel-grid">
<div class="more-panel-item" data-dom-id="btn-album" onclick="openAlbum()">
<div class="more-panel-icon" style="color: #FF9F45;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
<circle cx="8.5" cy="8.5" r="1.5"></circle>
<polyline points="21 15 16 10 5 21"></polyline>
</svg>
</div>
<span class="more-panel-label">相册</span>
</div>
<div class="more-panel-item" data-dom-id="btn-camera" onclick="openCamera()">
<div class="more-panel-icon" style="color: #7B61FF;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path>
<circle cx="12" cy="13" r="4"></circle>
</svg>
</div>
<span class="more-panel-label">相机</span>
</div>
<div class="more-panel-item" data-dom-id="btn-location" onclick="shareLocation()">
<div class="more-panel-icon" style="color: #34C759;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>
</div>
<span class="more-panel-label">位置</span>
</div>
<div class="more-panel-item" onclick="sendRedPacket()">
<div class="more-panel-icon" style="color: #FF3B30;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 12V8H6a2 2 0 0 1-2-2c0-1.1.9-2 2-2h12v4"></path>
<path d="M4 6v12c0 1.1.9 2 2 2h14v-4"></path>
<path d="M18 12a2 2 0 0 0 0 4h4v-4z"></path>
</svg>
</div>
<span class="more-panel-label">红包</span>
</div>
<div class="more-panel-item" onclick="sendFile()">
<div class="more-panel-icon" style="color: #26C2BB;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
<polyline points="13 2 13 9 20 9"></polyline>
</svg>
</div>
<span class="more-panel-label">文件</span>
</div>
<div class="more-panel-item" data-dom-id="btn-voice-call" onclick="startVoiceCall()">
<div class="more-panel-icon" style="color: #FF6B9D;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path>
</svg>
</div>
<span class="more-panel-label">语音通话</span>
</div>
</div>
</div>
</div>
</div>
<script>// 主题切换
// 更新图标
icon.innerHTML = `<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>`;
}
}
// 初始化主题
}
} catch (e) {}
})();
// 返回按钮
function goBack() {
window.location.href = 'message-list.html';
}
// 跳转聊天设置
function goToChatSettings() {
window.location.href = 'chat-settings.html';
}
// 跳转用户资料
function goToProfile() {
window.location.href = 'user-profile.html';
}
// 通话按钮
function makeCall() {
console.log('发起语音通话');
}
// 语音按钮切换
function toggleVoice() {
console.log('切换语音输入');
}
// 切换更多功能面板
function toggleMorePanel() {
const panel = document.getElementById('morePanel');
const emojiPanel = document.getElementById('emojiPanel');
if (panel.classList.contains('open')) {
panel.classList.remove('open');
} else {
emojiPanel.classList.remove('open');
panel.classList.add('open');
}
}
// 切换表情面板
function toggleEmojiPanel() {
const panel = document.getElementById('emojiPanel');
const morePanel = document.getElementById('morePanel');
if (panel.classList.contains('open')) {
panel.classList.remove('open');
} else {
morePanel.classList.remove('open');
panel.classList.add('open');
}
}
// 插入表情(事件委托)
document.getElementById('emojiGrid').addEventListener('click', function(e) {
const item = e.target.closest('.emoji-item');
if (item) {
const emoji = item.getAttribute('data-emoji');
if (emoji) {
insertEmoji(emoji);
}
}
});
function insertEmoji(emoji) {
const input = document.getElementById('messageInput');
input.value += emoji;
handleInput();
input.focus();
}
// 输入框处理
function handleInput() {
const input = document.getElementById('messageInput');
const sendBtn = document.querySelector('[data-dom-id="btn-send"]');
const plusBtn = document.querySelector('[data-dom-id="btn-plus"]');
if (input.value.trim().length > 0) {
sendBtn.classList.remove('hidden');
plusBtn.style.display = 'none';
} else {
sendBtn.classList.add('hidden');
plusBtn.style.display = 'flex';
}
}
// 输入框聚焦
function handleInputFocus() {
const morePanel = document.getElementById('morePanel');
const emojiPanel = document.getElementById('emojiPanel');
morePanel.classList.remove('open');
emojiPanel.classList.remove('open');
// 滚动到底部
setTimeout(() => {
const chatArea = document.getElementById('chatArea');
chatArea.scrollTop = chatArea.scrollHeight;
}, 100);
}
// 键盘事件
function handleKeyDown(event) {
if (event.key === 'Enter') {
sendMessage();
}
}
// 发送消息
function sendMessage() {
const input = document.getElementById('messageInput');
const text = input.value.trim();
if (!text) return;
const chatArea = document.getElementById('chatArea');
const typingEl = document.querySelector('[data-dom-id="msg-typing"]');
// 创建新消息
const msgDiv = document.createElement('div');
msgDiv.className = 'msg-sent';
msgDiv.innerHTML = `
<div class="msg-avatar msg-avatar-self">我</div>
<div>
<div class="msg-bubble-sent">
${escapeHtml(text)}
</div>
</div>
`;
// 插入到正在输入之前
chatArea.insertBefore(msgDiv, typingEl);
// 清空输入
input.value = '';
handleInput();
// 滚动到底部
chatArea.scrollTop = chatArea.scrollHeight;
// 模拟对方回复
setTimeout(() => {
const replies = [
'好的呀~',
'哈哈真的吗?',
'太棒了!',
'嗯嗯,我也是这么想的',
'好期待呀!<span class="icon-svg icon-sparkles"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/><path d="M5 3v4"/><path d="M19 17v4"/><path d="M3 5h4"/><path d="M17 19h4"/></svg></span>',
'没问题!'
];
const randomReply = replies[Math.floor(Math.random() * replies.length)];
const replyDiv = document.createElement('div');
replyDiv.className = 'msg-received';
replyDiv.innerHTML = `
<div class="msg-avatar">林</div>
<div class="msg-bubble-received">
${randomReply}
</div>
`;
chatArea.insertBefore(replyDiv, typingEl);
chatArea.scrollTop = chatArea.scrollHeight;
}, 1000);
}
// HTML转义
function escapeHtml(text) {
const div = document.createElement('div');
div.appendChild(document.createTextNode(text));
return div.innerHTML;
}
// 更多功能面板按钮
function openAlbum() {
console.log('打开相册');
}
function openCamera() {
console.log('打开相机');
}
function shareLocation() {
console.log('分享位置');
}
function sendRedPacket() {
console.log('发红包');
}
function sendFile() {
console.log('发送文件');
}
function startVoiceCall() {
console.log('开始语音通话');
}
// 点击聊天区域关闭面板
document.getElementById('chatArea').addEventListener('click', function() {
document.getElementById('morePanel').classList.remove('open');
document.getElementById('emojiPanel').classList.remove('open');
});
// 初始化滚动到底部
window.addEventListener('load', function() {
const chatArea = document.getElementById('chatArea');
chatArea.scrollTop = chatArea.scrollHeight;
});</script>
</body>
</html>