Files
yunke/yunkes/src/style.css
T
浅念 8fde1d8597 fix: render chat media by URL (images/video/voice) instead of unknown-type placeholder
MessageBubble.vue was keys off the (incomplete) type code, so many messages
with real OSS media URLs (https://wx.oss.yunkecn.com/.../*.webp|*.mp4) showed
as '[未知消息]'. Rendering is now URL-driven: pick the best http URL from
file_url > file_hd_url > file_th_url, then render by extension
(image/video/audio/file). Type code is only used as a last-resort label.

- MessageBubble.vue: URL-driven cascade (URL by ext → duration →
  transcription → text → structured-type placeholder → localized tag).
  Image/video/audio/file children @click.stop so the all-fields drawer
  still opens on bubble click but not on media interactions.
- format.ts: wechatTypeLabel(type_raw) maps known codes (3→图片, 34→语音,
  43→图片/表情, 49→文件/名片, 42→名片, 9→表情, 20→红包/转账).
- ChatTimeline.vue drawer type tag uses wechatTypeLabel for WeChat msgs.
- style.css: compact .yk-msg__audio player for voice-with-URL messages.

Verified against smoke.db: 25 type-3 images + 3 type-43 videos that
previously showed '[未知消息]' now render as images/video. Build clean.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 10:23:01 +08:00

270 lines
4.4 KiB
CSS

/* App-level layout + resets. Element Plus ships its own component styles. */
:root {
--yk-header-height: 56px;
--yk-aside-width: 260px;
--yk-bg: #f5f7fa;
--yk-border: #e4e7ed;
}
* {
box-sizing: border-box;
}
html,
body,
#app {
height: 100%;
margin: 0;
}
body {
font-family:
'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
'Microsoft YaHei', Arial, sans-serif;
font-size: 14px;
color: #303133;
background: var(--yk-bg);
-webkit-font-smoothing: antialiased;
}
a {
color: var(--el-color-primary, #409eff);
text-decoration: none;
}
/* Layout shell ----------------------------------------------------------- */
.yk-app {
height: 100%;
}
.yk-header {
display: flex;
align-items: center;
gap: 16px;
height: var(--yk-header-height);
padding: 0 20px;
background: #fff;
border-bottom: 1px solid var(--yk-border);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.yk-header__title {
font-size: 18px;
font-weight: 600;
margin: 0;
white-space: nowrap;
}
.yk-header__spacer {
flex: 1;
}
.yk-aside {
background: #fff;
border-right: 1px solid var(--yk-border);
overflow: auto;
}
.yk-aside__search {
padding: 10px 12px 6px;
}
.yk-aside__tree {
padding: 4px 6px 16px;
}
.yk-main {
padding: 16px;
background: var(--yk-bg);
overflow: auto;
}
/* Empty / loading placeholders */
.yk-empty {
padding: 40px 0;
color: #909399;
text-align: center;
}
/* Chat timeline ---------------------------------------------------------- */
.yk-chat {
display: flex;
flex-direction: column;
gap: 16px;
}
.yk-chat__header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.yk-chat__title {
font-size: 16px;
font-weight: 600;
margin: 0;
}
.yk-chat__sub {
color: #909399;
font-size: 13px;
}
.yk-chat__stream {
display: flex;
flex-direction: column;
gap: 4px;
background: #fff;
border: 1px solid var(--yk-border);
border-radius: 8px;
padding: 16px;
}
.yk-chat__load {
display: flex;
justify-content: center;
padding: 8px 0 12px;
}
.yk-chat__end {
text-align: center;
color: #c0c4cc;
font-size: 12px;
padding: 6px 0 2px;
}
/* Message bubble */
.yk-msg {
display: flex;
width: 100%;
padding: 6px 0;
}
.yk-msg--send {
flex-direction: row-reverse;
}
.yk-msg__row {
display: flex;
flex-direction: column;
max-width: 70%;
}
.yk-msg--send .yk-msg__row {
align-items: flex-end;
}
/* Clickable bubble row — opens the all-fields drawer. Subtle hover so users
* discover the interaction without changing the bubble's own look. */
.yk-msg__row--clickable {
cursor: pointer;
border-radius: 6px;
transition: background-color 0.15s ease;
}
.yk-msg__row--clickable:hover {
background-color: var(--el-fill-color-light, #f5f7fa);
}
.yk-msg__meta {
display: flex;
gap: 8px;
align-items: center;
font-size: 12px;
color: #909399;
padding: 0 4px 2px;
}
.yk-msg--send .yk-msg__meta {
flex-direction: row-reverse;
}
.yk-msg__bubble {
padding: 8px 12px;
border-radius: 10px;
background: #f4f4f5;
color: #303133;
line-height: 1.5;
word-break: break-word;
white-space: pre-wrap;
}
.yk-msg--send .yk-msg__bubble {
background: var(--el-color-primary-light-8, #d9ecff);
color: #1d2129;
}
.yk-msg__image {
max-width: 220px;
max-height: 220px;
border-radius: 8px;
display: block;
cursor: zoom-in;
}
.yk-msg__video {
max-width: 280px;
max-height: 280px;
border-radius: 8px;
display: block;
}
/* Inline audio player for voice messages with an http URL. Keeps the native
* control compact so it sits inside a chat row. */
.yk-msg__audio {
max-width: 240px;
height: 32px;
display: block;
}
.yk-msg__chip {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
border-radius: 16px;
background: #ecf5ff;
color: var(--el-color-primary, #409eff);
font-size: 13px;
cursor: default;
}
.yk-msg__chip--download {
cursor: pointer;
text-decoration: none;
}
.yk-msg__transcript {
margin-top: 4px;
font-size: 12px;
color: #909399;
font-style: italic;
padding: 0 4px;
}
/* Centered faint row for divider / system messages */
.yk-msg--center {
justify-content: center;
}
.yk-msg__divider {
font-size: 12px;
color: #909399;
background: transparent;
text-align: center;
padding: 2px 8px;
}
.yk-clickable-row {
cursor: pointer;
}
.yk-channel-tag {
margin-right: 4px;
}