Browse Source

Merge branch 'Xfy' of http://8.137.125.67:4000/SwtTt29/Mini-Program into Xfy

pull/9/head
徐飞洋 2 months ago
parent
commit
022e8eda3f
  1. 13
      pages/goods-detail/goods-detail.js

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

Loading…
Cancel
Save