|
@@ -560,20 +560,20 @@ async function drawPosterBottomContent(ctx, canvas, width, scale, yScale) {
|
|
|
}
|
|
}
|
|
|
//头像绘制
|
|
//头像绘制
|
|
|
async function drawMerchantLine(ctx, canvas, centerX, y, maxWidth, scale) {
|
|
async function drawMerchantLine(ctx, canvas, centerX, y, maxWidth, scale) {
|
|
|
-// const avatars = couponDetail.value.merchantInfoVOList
|
|
|
|
|
-// ?.filter(item => item?.logo)
|
|
|
|
|
-// ?.map(item => item.logo) || [];
|
|
|
|
|
- const avatars=['https://life.baoxianzhanggui.com/pro-img/securities/index/rank.png','https://life.baoxianzhanggui.com/pro-img/securities/index/rank.png','https://life.baoxianzhanggui.com/pro-img/securities/index/rank.png']
|
|
|
|
|
|
|
+ const avatars = couponDetail.value.merchantInfoVOList
|
|
|
|
|
+ ?.filter(item => item?.logo)
|
|
|
|
|
+ ?.map(item => item.logo) || [];
|
|
|
|
|
+ //const avatars=['https://life.baoxianzhanggui.com/pro-img/securities/index/rank.png','https://life.baoxianzhanggui.com/pro-img/securities/index/rank.png','https://life.baoxianzhanggui.com/pro-img/securities/index/rank.png']
|
|
|
const label = '适用商家:'
|
|
const label = '适用商家:'
|
|
|
const avatarSize = 36 * scale
|
|
const avatarSize = 36 * scale
|
|
|
const overlap = 12 * scale
|
|
const overlap = 12 * scale
|
|
|
const gap = 8 * scale
|
|
const gap = 8 * scale
|
|
|
|
|
|
|
|
- // ✅ 最多显示 3 个头像
|
|
|
|
|
|
|
+ // 最多显示 3 个头像
|
|
|
const MAX_AVATARS = 3
|
|
const MAX_AVATARS = 3
|
|
|
const displayAvatars = avatars.slice(0, MAX_AVATARS)
|
|
const displayAvatars = avatars.slice(0, MAX_AVATARS)
|
|
|
|
|
|
|
|
- // ✅ 检查是否有 GIF 格式图片
|
|
|
|
|
|
|
+ // 检查是否有 GIF 格式图片
|
|
|
const hasGifAvatar = displayAvatars.some(avatarUrl => /\.gif$/i.test(avatarUrl))
|
|
const hasGifAvatar = displayAvatars.some(avatarUrl => /\.gif$/i.test(avatarUrl))
|
|
|
if (hasGifAvatar) {
|
|
if (hasGifAvatar) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -583,10 +583,10 @@ async function drawMerchantLine(ctx, canvas, centerX, y, maxWidth, scale) {
|
|
|
console.warn('检测到GIF图片,小程序Canvas不支持GIF格式,跳过头像绘制')
|
|
console.warn('检测到GIF图片,小程序Canvas不支持GIF格式,跳过头像绘制')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // ✅ 如果有 GIF 图片,不绘制头像
|
|
|
|
|
|
|
+ // 如果有 GIF 图片,不绘制头像
|
|
|
const hasAvatars = displayAvatars.length > 0 && !hasGifAvatar
|
|
const hasAvatars = displayAvatars.length > 0 && !hasGifAvatar
|
|
|
|
|
|
|
|
- // ✅ 如果有超出,显示 "+N"
|
|
|
|
|
|
|
+ // 如果有超出,显示 "+N"
|
|
|
const countText = couponDetail.value.numberMerchants
|
|
const countText = couponDetail.value.numberMerchants
|
|
|
const extraText = countText > 99 ? `+${countText}` : ''
|
|
const extraText = countText > 99 ? `+${countText}` : ''
|
|
|
const displayCountText = extraText || countText
|
|
const displayCountText = extraText || countText
|