feat: 视频缩略图生成、最近文件面板与前端视图重构

- 新增 VideoThumbnailService,基于 ffmpeg 截取视频缩略图,ffprobe 提取时长
  - 新增 ManagedThumbnailMap 模型及多数据库迁移,存储缩略图元数据
  - 新增 /api/thumbnails/{id} 缩略图流端点
  - 新增最近添加/最近播放 API 与前端面板,支持列表/网格双视图切换
  - FileRecordDto 扩展 thumbnailUrl、videoDuration、lastPlayedAt 字段
  - 前端新增文件库 Tab 导航、卡片网格视图、视频海报与时长信息栏
  - 添加文件库目录不再同步全量扫描,改为后台异步自动扫描
This commit is contained in:
2026-05-22 17:01:49 +08:00
parent 6acc92ca27
commit 2c20f9bb54
47 changed files with 5975 additions and 64 deletions
+251 -26
View File
@@ -498,19 +498,6 @@ a {
font-weight: 800;
}
.player-panel video {
width: 100%;
max-height: 54vh;
margin-top: 12px;
border-radius: 10px;
background: #111827;
}
.player-panel audio {
width: 100%;
margin-top: 18px;
}
.open-media-link {
display: block;
width: 100%;
@@ -524,19 +511,6 @@ a {
font-weight: 800;
}
.player-panel pre {
overflow: auto;
max-height: 54vh;
margin: 12px 0 0;
border: 1px solid var(--line);
border-radius: 10px;
padding: 12px;
background: #f8fafc;
color: #111827;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.mobile-list {
display: grid;
gap: 9px;
@@ -724,6 +698,257 @@ a {
background: var(--panel);
}
/* Root tabs */
.root-tabs {
display: flex;
gap: 4px;
margin-bottom: 14px;
border: 1px solid var(--line);
border-radius: 12px;
padding: 4px;
background: var(--panel);
}
.root-tabs button {
flex: 1;
min-height: 36px;
border: none;
border-radius: 10px;
font-weight: 700;
font-size: 14px;
color: var(--muted);
background: transparent;
}
.root-tabs button.active {
color: #fff;
background: var(--accent);
}
/* View toggle */
.view-toggle-bar {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.view-toggle {
display: flex;
gap: 0;
border: 1px solid var(--line);
border-radius: 8px;
overflow: hidden;
}
.view-toggle button {
min-height: 30px;
border: none;
border-radius: 0;
padding: 4px 14px;
font-size: 13px;
font-weight: 700;
color: var(--muted);
background: transparent;
}
.view-toggle button.active {
color: #fff;
background: var(--accent);
}
.view-toggle button + button {
border-left: 1px solid var(--line);
}
/* Section header with view toggle inline */
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.section-header h3 {
margin: 0;
font-size: 15px;
font-weight: 800;
color: var(--muted);
}
/* File grid / card view */
.file-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
gap: 10px;
border: 1px solid var(--line);
border-radius: 14px;
padding: 10px;
background: var(--panel);
}
.file-card {
display: grid;
grid-template-rows: auto 1fr;
width: 100%;
min-height: 0;
border: 1px solid var(--line);
border-radius: 12px;
padding: 0;
overflow: hidden;
text-align: left;
background: #fff;
}
.file-card.active {
border-color: var(--accent);
box-shadow: 0 0 0 2px var(--accent);
}
.file-card:hover:not(:disabled) {
border-color: var(--accent);
}
.card-thumb {
display: block;
width: 100%;
aspect-ratio: 16 / 10;
object-fit: contain;
background: #111827;
}
.card-thumb-placeholder {
display: flex;
align-items: center;
justify-content: center;
aspect-ratio: 16 / 10;
border-radius: 999px;
margin: 12px auto 0;
width: 44px;
height: 44px;
color: #fff;
background: var(--accent-strong);
font-size: 12px;
font-weight: 800;
text-transform: uppercase;
}
.card-body {
display: grid;
align-content: start;
gap: 3px;
padding: 10px 10px 12px;
min-width: 0;
}
.card-body strong {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 14px;
font-weight: 700;
line-height: 1.3;
}
.card-body small {
color: var(--muted);
font-size: 12px;
}
/* File thumbnail in list view */
.file-thumb {
flex: 0 0 72px;
width: 72px;
height: 48px;
border-radius: 6px;
object-fit: contain;
background: #111827;
}
.file-list .mobile-file {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 10px;
width: 100%;
min-height: 60px;
padding: 8px 10px;
text-align: left;
}
.file-list .mobile-file > span:last-child {
display: grid;
min-width: 0;
}
/* Video info bar */
.video-info-bar {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 10px;
padding: 8px 0;
font-size: 13px;
color: var(--muted);
}
.video-info-bar span {
border-radius: 999px;
padding: 3px 9px;
background: #f2f4f7;
font-weight: 600;
}
/* Player media wrapper */
.player-media-wrapper {
margin-top: 12px;
}
.player-media-wrapper video {
width: 100%;
max-height: 54vh;
border-radius: 10px;
background: #111827;
}
.player-media-wrapper audio {
width: 100%;
margin-top: 6px;
}
.player-media-wrapper pre {
overflow: auto;
max-height: 54vh;
border: 1px solid var(--line);
border-radius: 10px;
padding: 12px;
background: #f8fafc;
color: #111827;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.unsupported-player {
text-align: center;
}
.unsupported-thumb {
display: block;
width: 100%;
max-width: 360px;
margin: 0 auto 12px;
border-radius: 10px;
aspect-ratio: 16 / 9;
object-fit: contain;
background: #111827;
}
/* Recent files section */
.recent-files {
margin-top: 4px;
}
@media (max-width: 1100px) {
.admin-layout,
.admin-browser {