查看消息内容

This commit is contained in:
xuncha
2026-03-02 21:36:44 +08:00
parent a965890916
commit eace3e9467
2 changed files with 214 additions and 0 deletions

View File

@@ -4132,4 +4132,135 @@
.session-name {
font-weight: 500;
}
}
// 消息信息弹窗
.message-info-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 2000;
padding: 20px;
}
.message-info-modal {
width: 520px;
max-width: 90vw;
max-height: 80vh;
background: var(--card-bg);
border-radius: 12px;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
overflow: hidden;
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid var(--border-color);
h3 {
font-size: 16px;
font-weight: 600;
color: var(--text-primary);
}
.close-btn {
width: 28px;
height: 28px;
border: none;
background: transparent;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-tertiary);
transition: all 0.2s;
&:hover {
background: var(--bg-hover);
color: var(--text-primary);
}
}
}
.modal-body {
flex: 1;
overflow-y: auto;
padding: 16px 20px;
}
.info-section {
margin-bottom: 16px;
h4 {
font-size: 13px;
font-weight: 600;
color: var(--text-secondary);
margin: 0 0 8px 0;
}
}
.info-grid {
display: flex;
flex-direction: column;
gap: 6px;
}
.info-item {
display: flex;
align-items: baseline;
gap: 8px;
font-size: 13px;
.label {
color: var(--text-tertiary);
min-width: 80px;
flex-shrink: 0;
}
.value {
color: var(--text-primary);
word-break: break-all;
&.code {
font-family: monospace;
font-size: 12px;
background: var(--bg-tertiary);
padding: 2px 6px;
border-radius: 4px;
}
}
}
.raw-content-container {
background: var(--bg-tertiary);
border-radius: 8px;
padding: 12px;
max-height: 200px;
overflow: auto;
pre {
margin: 0;
font-size: 12px;
font-family: monospace;
color: var(--text-primary);
white-space: pre-wrap;
word-break: break-all;
}
}
.select-text {
user-select: text;
}
}

View File

@@ -324,6 +324,7 @@ function ChatPage(_props: ChatPageProps) {
// 消息右键菜单
const [contextMenu, setContextMenu] = useState<{ x: number, y: number, message: Message } | null>(null)
const [showMessageInfo, setShowMessageInfo] = useState<Message | null>(null)
const [editingMessage, setEditingMessage] = useState<{ message: Message, content: string } | null>(null)
// 多选模式
@@ -2735,11 +2736,93 @@ function ChatPage(_props: ChatPageProps) {
<Trash2 size={16} />
<span></span>
</div>
<div className="menu-item" onClick={() => { setShowMessageInfo(contextMenu.message); setContextMenu(null) }}>
<Info size={16} />
<span></span>
</div>
</div>
</>,
document.body
)}
{/* 消息信息弹窗 */}
{showMessageInfo && createPortal(
<div className="message-info-overlay" onClick={() => setShowMessageInfo(null)}>
<div className="message-info-modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<Info size={18} />
<h3 style={{ margin: 0 }}></h3>
</div>
<button className="close-btn" onClick={() => setShowMessageInfo(null)}>
<X size={18} />
</button>
</div>
<div className="modal-body">
<div className="info-section">
<h4></h4>
<div className="info-grid">
<div className="info-item"><span className="label">Local ID</span><span className="value select-text">{showMessageInfo.localId}</span></div>
<div className="info-item"><span className="label">Server ID</span><span className="value select-text">{showMessageInfo.serverId}</span></div>
<div className="info-item"><span className="label">Local Type</span><span className="value select-text">{showMessageInfo.localType}</span></div>
<div className="info-item"><span className="label"></span><span className="value select-text">{showMessageInfo.senderUsername || '-'}</span></div>
<div className="info-item"><span className="label"></span><span className="value select-text">{new Date(showMessageInfo.createTime * 1000).toLocaleString()} ({showMessageInfo.createTime})</span></div>
<div className="info-item"><span className="label"></span><span className="value select-text">{showMessageInfo.isSend === 1 ? '发送' : '接收'}</span></div>
</div>
</div>
{showMessageInfo.imageMd5 && (
<div className="info-section">
<h4></h4>
<div className="info-grid">
<div className="info-item"><span className="label">Image MD5</span><span className="value select-text code">{showMessageInfo.imageMd5}</span></div>
{showMessageInfo.imageDatName && <div className="info-item"><span className="label">DAT </span><span className="value select-text code">{showMessageInfo.imageDatName}</span></div>}
</div>
</div>
)}
{showMessageInfo.videoMd5 && (
<div className="info-section">
<h4></h4>
<div className="info-grid">
<div className="info-item"><span className="label">Video MD5</span><span className="value select-text code">{showMessageInfo.videoMd5}</span></div>
</div>
</div>
)}
{showMessageInfo.voiceDurationSeconds != null && (
<div className="info-section">
<h4></h4>
<div className="info-grid">
<div className="info-item"><span className="label"></span><span className="value select-text">{showMessageInfo.voiceDurationSeconds}</span></div>
</div>
</div>
)}
{(showMessageInfo.emojiMd5 || showMessageInfo.emojiCdnUrl) && (
<div className="info-section">
<h4></h4>
<div className="info-grid">
{showMessageInfo.emojiMd5 && <div className="info-item"><span className="label">MD5</span><span className="value select-text code">{showMessageInfo.emojiMd5}</span></div>}
{showMessageInfo.emojiCdnUrl && <div className="info-item"><span className="label">CDN URL</span><span className="value select-text code break-all">{showMessageInfo.emojiCdnUrl}</span></div>}
</div>
</div>
)}
{(showMessageInfo.rawContent || showMessageInfo.content) && (
<div className="info-section">
<h4></h4>
<div className="raw-content-container">
<pre className="select-text">{showMessageInfo.rawContent || showMessageInfo.content}</pre>
</div>
</div>
)}
</div>
</div>
</div>,
document.body
)}
{/* 修改消息弹窗 */}
{editingMessage && createPortal(
<div className="modal-overlay">