From cbf553686c072e452c12a23b898ab058bd40bd78 Mon Sep 17 00:00:00 2001 From: Trae AI Date: Tue, 6 Jan 2026 14:04:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=80=BB=E8=BE=91=EF=BC=8C=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BD=BF=E7=94=A8=E7=AC=AC=E4=B8=80=E5=BC=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods-detail/goods-detail.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pages/goods-detail/goods-detail.js b/pages/goods-detail/goods-detail.js index ba8897a..8026abc 100644 --- a/pages/goods-detail/goods-detail.js +++ b/pages/goods-detail/goods-detail.js @@ -86,8 +86,17 @@ function getShareImageUrl(goodsDetail) { const imageUrls = goodsDetail.imageUrls || []; if (imageUrls.length > 0) { - // 返回第一张图片作为分享图片 - return imageUrls[0]; + // 过滤出图片类型 + const imageOnly = imageUrls.filter(url => !isVideoUrl(url)); + + if (imageOnly.length > 0) { + // 情况1: 有图片 → 使用第一张图片 + return imageOnly[0]; + } + + // 情况2: 全是视频 → 使用第一帧(暂无封面字段,返回默认图片) + // 注: 当前数据结构无poster字段,如需视频封面需后端添加 + return '/images/你有好蛋.png'; } return '/images/你有好蛋.png'; -- 2.30.2