From c07ed0353938eaf3dace8882d06ff9d8d414f5f0 Mon Sep 17 00:00:00 2001 From: Blizzard Date: Fri, 31 Jul 2026 18:37:17 +0800 Subject: [PATCH] =?UTF-8?q?style(fe):=20=E8=BA=AB=E4=BB=BD=E5=8D=A1?= =?UTF-8?q?=E6=AD=A3=E5=8F=8D=E4=B8=A4=E5=BC=A0=E7=AD=89=E9=AB=98=EF=BC=88?= =?UTF-8?q?=E9=83=BD=E7=94=A8=20cardH=3D630=EF=BC=89=EF=BC=8C=E6=AD=A3?= =?UTF-8?q?=E9=9D=A2=E4=B8=AD=E9=97=B4=E5=86=85=E5=AE=B9=E5=9E=82=E7=9B=B4?= =?UTF-8?q?=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5 --- pets-fe/pages/idcard/idcard.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pets-fe/pages/idcard/idcard.js b/pets-fe/pages/idcard/idcard.js index 6549d67..b9f1a77 100644 --- a/pets-fe/pages/idcard/idcard.js +++ b/pets-fe/pages/idcard/idcard.js @@ -97,10 +97,9 @@ Page({ const tags = (c.personality || '').split(',').filter(Boolean); // ══════════ 正面卡(暖黄)══════════ - // 高度按内容算,避免留一大块空白 - let fH = 372; - if (tags.length) fH += 90; - if (c.intro) fH += 90; + // 正反两张卡等高(都用 cardH),中间内容垂直居中,避免正面留空 + const cardH = 630; + const fH = cardH; const fY = pad; const gf = ctx.createLinearGradient(fx, fY, fx, fY + fH); gf.addColorStop(0, '#FFF7E0'); @@ -165,8 +164,10 @@ Page({ kvF('毛色', c.color, avY + 168); kvF('年龄', c.age, avY + 206); - // 性格标签(没有就不画,避免留空行) - let ty = fY + 298; + // 性格标签(没有就不画,避免留空行);性格+介绍整体在 info 和底栏之间垂直居中 + const midTop = fY + 300, midBot = fY + fH - 92; + const blockH = (tags.length ? 90 : 0) + (c.intro ? 70 : 0); + let ty = midTop + Math.max(0, Math.floor((midBot - midTop - blockH) / 2)); if (tags.length) { ctx.textAlign = 'left'; ctx.fillStyle = '#8A5A18'; @@ -214,7 +215,7 @@ Page({ this.drawStamp(ctx, fx + cardW2 - 78, fY + 82); // ══════════ 照护卡(淡紫,仿证件版式)══════════ - const bY = fY + fH + 40, bH = 630; + const bY = fY + fH + 40, bH = cardH; const gbc = ctx.createLinearGradient(fx, bY, fx, bY + bH); gbc.addColorStop(0, '#E6E7FB'); gbc.addColorStop(1, '#F2F0FA');