style(fe): 身份卡正反两张等高(都用 cardH=630),正面中间内容垂直居中
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -97,10 +97,9 @@ Page({
|
|||||||
const tags = (c.personality || '').split(',').filter(Boolean);
|
const tags = (c.personality || '').split(',').filter(Boolean);
|
||||||
|
|
||||||
// ══════════ 正面卡(暖黄)══════════
|
// ══════════ 正面卡(暖黄)══════════
|
||||||
// 高度按内容算,避免留一大块空白
|
// 正反两张卡等高(都用 cardH),中间内容垂直居中,避免正面留空
|
||||||
let fH = 372;
|
const cardH = 630;
|
||||||
if (tags.length) fH += 90;
|
const fH = cardH;
|
||||||
if (c.intro) fH += 90;
|
|
||||||
const fY = pad;
|
const fY = pad;
|
||||||
const gf = ctx.createLinearGradient(fx, fY, fx, fY + fH);
|
const gf = ctx.createLinearGradient(fx, fY, fx, fY + fH);
|
||||||
gf.addColorStop(0, '#FFF7E0');
|
gf.addColorStop(0, '#FFF7E0');
|
||||||
@@ -165,8 +164,10 @@ Page({
|
|||||||
kvF('毛色', c.color, avY + 168);
|
kvF('毛色', c.color, avY + 168);
|
||||||
kvF('年龄', c.age, avY + 206);
|
kvF('年龄', c.age, avY + 206);
|
||||||
|
|
||||||
// 性格标签(没有就不画,避免留空行)
|
// 性格标签(没有就不画,避免留空行);性格+介绍整体在 info 和底栏之间垂直居中
|
||||||
let ty = fY + 298;
|
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) {
|
if (tags.length) {
|
||||||
ctx.textAlign = 'left';
|
ctx.textAlign = 'left';
|
||||||
ctx.fillStyle = '#8A5A18';
|
ctx.fillStyle = '#8A5A18';
|
||||||
@@ -214,7 +215,7 @@ Page({
|
|||||||
this.drawStamp(ctx, fx + cardW2 - 78, fY + 82);
|
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);
|
const gbc = ctx.createLinearGradient(fx, bY, fx, bY + bH);
|
||||||
gbc.addColorStop(0, '#E6E7FB');
|
gbc.addColorStop(0, '#E6E7FB');
|
||||||
gbc.addColorStop(1, '#F2F0FA');
|
gbc.addColorStop(1, '#F2F0FA');
|
||||||
|
|||||||
Reference in New Issue
Block a user