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';