From 45d3a3de4d2351ce65c65f632234af824ff419e1 Mon Sep 17 00:00:00 2001 From: yuming Date: Fri, 3 Jul 2026 23:34:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E7=9C=8B=E6=9D=BF?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=B0=81=E9=9D=A2=E6=8E=A5=E5=8F=A3=20+=20Co?= =?UTF-8?q?okie=20=E7=BC=96=E8=BE=91=E5=BC=B9=E7=AA=97=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Controllers/VideoController.cs:补回 upstream merge 时丢失的 GetVideoCover 接口(/api/video/cover/{id}),修复数据看板作者视频列表封面加载失败 - app/src/App.vue:.full-modal 改成 flex + height:100vh 全屏抽屉式布局,footer 常驻底部,body flex:1 承担滚动,解决大视口下 modal 底部大片空白 - app/src/pages/cok/CookieTable.vue:删除 .modal-scroll-body 的双层滚动 hack(max-height + overflow:scroll),让 .ant-modal-body 独家承担滚动,修复小屏下 Cookie 编辑弹窗内容滑不动 Co-Authored-By: Claude Opus 4.7 (1M context) --- Controllers/VideoController.cs | 69 +++++++++++++++++++++++++++++++ app/src/App.vue | 22 ++++++++-- app/src/pages/cok/CookieTable.vue | 18 -------- 3 files changed, 87 insertions(+), 22 deletions(-) diff --git a/Controllers/VideoController.cs b/Controllers/VideoController.cs index 2e20d5f..72c5593 100644 --- a/Controllers/VideoController.cs +++ b/Controllers/VideoController.cs @@ -223,6 +223,75 @@ namespace dy.net.Controllers return new EmptyResult(); } + /// + /// 获取视频封面图片 + /// + /// 视频ID + [Authorize] + [HttpGet("cover/{id}")] + public async Task GetVideoCover([FromRoute] string id) + { + try + { + var video = await douyinVideoService.GetById(id); + if (video == null) + { + return GetDefaultCoverImage(); + } + + // 优先使用本地保存的封面 + if (!string.IsNullOrWhiteSpace(video.VideoCoverSavePath) && System.IO.File.Exists(video.VideoCoverSavePath)) + { + var contentType = GetImageContentType(video.VideoCoverSavePath); + var fileStream = System.IO.File.OpenRead(video.VideoCoverSavePath); + return File(fileStream, contentType); + } + + // 本地封面缺失时回落到默认占位图 + return GetDefaultCoverImage(); + } + catch (Exception ex) + { + Serilog.Log.Error(ex, $"获取视频封面失败: {id}"); + return GetDefaultCoverImage(); + } + } + + /// + /// 默认封面占位图(SVG) + /// + private IActionResult GetDefaultCoverImage() + { + var svgContent = @" + + 暂无封面 +"; + var svgBytes = System.Text.Encoding.UTF8.GetBytes(svgContent); + return File(svgBytes, "image/svg+xml"); + } + + /// + /// 根据文件扩展名获取图片 Content-Type + /// + private string GetImageContentType(string fileName) + { + if (string.IsNullOrWhiteSpace(fileName)) + { + return "image/jpeg"; + } + var extension = Path.GetExtension(fileName).ToLowerInvariant(); + return extension switch + { + ".jpg" or ".jpeg" => "image/jpeg", + ".png" => "image/png", + ".gif" => "image/gif", + ".webp" => "image/webp", + ".svg" => "image/svg+xml", + ".bmp" => "image/bmp", + _ => "image/jpeg" + }; + } + /// /// 播放视频 /// diff --git a/app/src/App.vue b/app/src/App.vue index 200fbf1..7b80e14 100644 --- a/app/src/App.vue +++ b/app/src/App.vue @@ -179,15 +179,29 @@ body { } } -// 抖音授权 Cookie 编辑用 full-modal(顶部对齐的宽 modal) +// 抖音授权 Cookie 编辑用 full-modal(全屏抽屉式,高度 100vh、footer 常驻底部) .full-modal .ant-modal { top: 0 !important; padding-bottom: 0 !important; - margin-bottom: 0; + margin: 0 !important; + max-width: 100%; + height: 100vh; +} +.full-modal .ant-modal-content { + height: 100vh; + display: flex; + flex-direction: column; + border-radius: 0; +} +.full-modal .ant-modal-header, +.full-modal .ant-modal-footer { + flex-shrink: 0; } -// full-modal 没有 top 留白,body max-height 减去的常量更小 .full-modal .ant-modal-body { - max-height: calc(100vh - 110px) !important; + flex: 1 1 auto; + min-height: 0; + max-height: none !important; + overflow-y: auto !important; } // 登录页整个界面本身就是一个 Modal(LoginModal.vue),必须恢复 antd 默认布局,不能被上面的全局规则改 diff --git a/app/src/pages/cok/CookieTable.vue b/app/src/pages/cok/CookieTable.vue index 3d588a7..02ac121 100644 --- a/app/src/pages/cok/CookieTable.vue +++ b/app/src/pages/cok/CookieTable.vue @@ -707,26 +707,8 @@ const switchdownCollect = (e: any) => {