feat: 添加上传按钮支持图片和文件上传

This commit is contained in:
2026-04-26 10:56:40 +08:00
parent 41f06148b4
commit 65360ad822
3 changed files with 439 additions and 5 deletions

View File

@@ -500,6 +500,41 @@ body {
.message-content h2 { font-size: 1.2em; }
.message-content h3 { font-size: 1.1em; }
/* 图片消息样式 */
.message-image {
margin-bottom: 8px;
}
.message-image img {
max-width: 100%;
max-height: 300px;
border-radius: 12px;
cursor: pointer;
transition: transform 0.2s;
}
.message-image img:hover {
transform: scale(1.02);
}
/* 图片预览遮罩 */
.image-preview-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.9);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.image-preview-overlay img {
max-width: 90%;
max-height: 90%;
border-radius: 8px;
}
.message-content ul, .message-content ol {
margin: 8px 0;
padding-left: 20px;
@@ -558,6 +593,85 @@ body {
bottom: 0;
}
/* 上传按钮 */
.attach-btn {
width: 44px;
height: 44px;
border-radius: 50%;
background: white;
border: 2px solid var(--border-color);
color: var(--text-light);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
flex-shrink: 0;
}
.attach-btn:hover {
border-color: var(--primary);
color: var(--primary);
background: rgba(102, 126, 234, 0.05);
}
.attach-btn:active {
transform: scale(0.95);
}
/* 上传选项面板 */
.attach-panel {
position: fixed;
bottom: 70px;
left: 16px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
padding: 16px;
display: none;
z-index: 200;
}
.attach-panel.show {
display: block;
animation: slideUp 0.2s ease;
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.attach-panel-content {
display: flex;
gap: 16px;
}
.attach-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
padding: 12px 16px;
background: rgba(102, 126, 234, 0.05);
border-radius: 12px;
cursor: pointer;
transition: all 0.2s;
}
.attach-item:hover {
background: rgba(102, 126, 234, 0.15);
}
.attach-icon {
font-size: 28px;
}
.attach-label {
font-size: 12px;
color: var(--text-color);
}
#userInput {
flex: 1;
padding: 12px 16px;