feat(poster): 整页无滚动条自适应+单区域滚动+文字可旋转+模板25→42(新增校园10款)

- 布局: pmRoot按最内层n-layout-scroll-container实测高度定根(fit联动measure, resize/focus/visibilitychange复测, 余量18px), 根overflow:hidden; 桌面三列各自overflow-y内部滚动, 窄屏堆叠后仅.pm-main单区域滚动; fit()改宽高双向取min, 画布完整落入舞台不出滚动条
- 旋转: 图层接口新增rot(文字/图片/形状), 预览CSS transform绕图层中心, 导出canvas rotAround同中心旋转(预览/导出同轴不跑位), 编辑面板加旋转滑杆(-180~180)+复位; 实测模板内置-4°与滑杆-90°/-25°矩阵值精确, PNG导出98KB正常
- 模板: 25→42, 新增'校园'分类10款(教师节/开学第一课/家长会/秋季运动会/毕业季/社团招新/优秀学生表彰/快乐六一/考试加油/读书月)+促销2/节日1/活动1/美食3
- 验证: 780x437/1100x800/1600x900三档实测page_scrollable=false, 滚动只发生在指定区域; 桌面三列对齐, 校园10模板缩略图渲染正常
This commit is contained in:
jinghui committed 2026-11-13 22:49:33 +08:00
1 parent 6463aa81d8
commit 931c0b5673
2 files changed
+219 -15

No files matched your search

+70 -15
View File
@@ -19,6 +19,8 @@ const bg = ref<PosterBg>({});
const selId = ref('');
const scale = ref(0.5);
const stageEl = ref<HTMLElement | null>(null);
const pmRoot = ref<HTMLElement | null>(null);
const pmH = ref(0); // 视口自适应高度:根不滚动,滚动只发生在内部区域
const fileEl = ref<HTMLInputElement | null>(null);
const pmError = ref('');
const models = ref<{ id: string; name?: string }[]>([]);
@@ -28,6 +30,7 @@ const bgPrompt = ref('');
const exporting = ref(false);
let uid = 0;
let ro: ResizeObserver | null = null;
let scRO: ResizeObserver | null = null;
const filtered = computed(() =>
cat.value === 'hot' ? POSTER_TEMPLATES : POSTER_TEMPLATES.filter((t) => t.category === cat.value));
@@ -97,6 +100,7 @@ function boxStyle(l: L) {
return {
left: l.x + 'px', top: l.y + 'px', width: l.w + 'px',
height: l.type === 'text' ? 'auto' : l.h + 'px',
transform: l.rot ? `rotate(${l.rot}deg)` : undefined,
};
}
function fontStyle(l: L) {
@@ -121,6 +125,7 @@ function shapeStyle(l: L) {
function miniBoxStyle(l: L) { return boxStyle(l); }
const tplLayers = (t: PosterTemplate): L[] => t.layers as any;
function onFill(e: Event) { const l = sel.value; if (l) l.fill = (e.target as HTMLInputElement).value; }
function onRot(e: Event) { const l = sel.value; if (l) l.rot = Number((e.target as HTMLInputElement).value); }
// ---------- 选中 / 拖动 ----------
function onDown(e: PointerEvent, l: L) {
@@ -224,9 +229,25 @@ async function genBg() {
}
// ---------- 缩放 ----------
// 宽高双向适配:画布始终完整落在舞台内,舞台自身不出滚动条
function fit() {
const w = stageEl.value?.clientWidth || 600;
scale.value = Math.min(Math.max(w / POSTER_W, 0.18), 0.85);
measure(); // 舞台尺寸一变就顺带复测根高度(仅值变化才写,稳定后自收敛)
const el = stageEl.value;
const w = Math.max((el?.clientWidth || 600) - 20, 120);
const h = Math.max((el?.clientHeight || 760) - 20, 160);
scale.value = Math.min(Math.max(Math.min(w / POSTER_W, h / POSTER_H), 0.1), 0.85);
}
// 测量所在滚动容器:根高度 = 容器可视高 - 上方占用,页面级永不出现滚动条
function measure() {
const el = pmRoot.value;
if (!el) return;
// 必须取最内层滚动容器:外层是套壳,高度口径不同,用外层算出来的值会错
const sc = el.closest('.n-layout-scroll-container') as HTMLElement | null;
if (!sc) return;
const above = el.getBoundingClientRect().top - sc.getBoundingClientRect().top + sc.scrollTop;
const h = Math.floor(sc.clientHeight - above - 18);
if (h >= 160 && h !== pmH.value) pmH.value = h;
}
// ---------- 导出 PNG ----------
@@ -264,9 +285,16 @@ function loadImg(src: string): Promise<HTMLImageElement | null> {
i.src = src;
});
}
// 绕 (cx, cy) 旋转画布坐标系:预览走 CSS transform、导出走 canvas,中心一致才不跑位
function rotAround(ctx: CanvasRenderingContext2D, cx: number, cy: number, deg: number) {
ctx.translate(cx, cy);
ctx.rotate((deg * Math.PI) / 180);
ctx.translate(-cx, -cy);
}
async function drawLayer(ctx: CanvasRenderingContext2D, l: L) {
if (l.type === 'shape') {
ctx.save();
if (l.rot) rotAround(ctx, l.x + l.w / 2, l.y + l.h / 2, l.rot);
ctx.globalAlpha = l.opacity ?? 1;
ctx.fillStyle = l.fill;
if (l.shape === 'ellipse') {
@@ -282,6 +310,7 @@ async function drawLayer(ctx: CanvasRenderingContext2D, l: L) {
}
if (l.type === 'image') {
ctx.save();
if (l.rot) rotAround(ctx, l.x + l.w / 2, l.y + l.h / 2, l.rot);
rrPath(ctx, l.x, l.y, l.w, l.h, l.radius ?? 0);
ctx.clip();
const img = l.src ? await loadImg(l.src) : null;
@@ -310,6 +339,8 @@ async function drawLayer(ctx: CanvasRenderingContext2D, l: L) {
const asc = (m as any).fontBoundingBoxAscent ?? l.size * 0.8;
const desc = (m as any).fontBoundingBoxDescent ?? l.size * 0.2;
const lines = linesOf(l);
ctx.save();
if (l.rot) rotAround(ctx, l.x + l.w / 2, l.y + (lines.length * lh) / 2, l.rot);
ctx.textAlign = l.align === 'center' ? 'center' : l.align === 'right' ? 'right' : 'left';
const tx = l.align === 'center' ? l.x + l.w / 2 : l.align === 'right' ? l.x + l.w : l.x;
for (let i = 0; i < lines.length; i++) {
@@ -321,7 +352,7 @@ async function drawLayer(ctx: CanvasRenderingContext2D, l: L) {
}
ctx.fillText(lines[i], tx, y);
}
ctx.shadowColor = 'transparent'; ctx.shadowBlur = 0; ctx.shadowOffsetY = 0;
ctx.restore();
}
async function exportPng() {
exporting.value = true; pmError.value = '';
@@ -346,10 +377,19 @@ async function exportPng() {
}
onMounted(async () => {
selectTemplate(POSTER_TEMPLATES[0]);
measure();
fit();
ro = new ResizeObserver(fit);
if (stageEl.value) ro.observe(stageEl.value);
selectTemplate(POSTER_TEMPLATES[0]);
const sc = pmRoot.value?.closest('.n-layout-scroll-container');
if (sc) { scRO = new ResizeObserver(measure); scRO.observe(sc); }
window.addEventListener('resize', measure);
window.addEventListener('focus', measure);
document.addEventListener('visibilitychange', measure);
// 头部字体/公告条加载完高度会微变,延迟复测两次
setTimeout(measure, 400);
setTimeout(measure, 1500);
try {
const res = await fetch('/relay/ai/image-models', { headers: licenseHeaders('poster-maker') });
const j = await res.json().catch(() => ({}) as any);
@@ -359,11 +399,18 @@ onMounted(async () => {
}
} catch { /* 模型列表拉取失败时用默认空值 */ }
});
onBeforeUnmount(() => { ro?.disconnect(); onUp(); });
onBeforeUnmount(() => {
ro?.disconnect();
scRO?.disconnect();
window.removeEventListener('resize', measure);
window.removeEventListener('focus', measure);
document.removeEventListener('visibilitychange', measure);
onUp();
});
</script>
<template>
<div class="pm-root">
<div ref="pmRoot" class="pm-root" :style="pmH ? { height: pmH + 'px' } : undefined">
<div class="pm-top">
<div class="pm-cats">
<button
@@ -490,6 +537,13 @@ onBeforeUnmount(() => { ro?.disconnect(); onUp(); });
<div v-if="sel" class="pm-sec">
<div class="pm-sec-title">编辑「{{ selName }}」</div>
<div class="pm-row">
<label>旋转</label>
<input :value="sel.rot ?? 0" type="range" min="-180" max="180" step="1" @input="onRot" />
<span>{{ sel.rot ?? 0 }}°</span>
<button class="pm-mini-btn" @click="sel.rot = 0">复位</button>
</div>
<template v-if="sel.type === 'text'">
<textarea v-model="sel.text" class="pm-input ta" rows="3" placeholder="文字内容,支持换行"></textarea>
<div class="pm-row">
@@ -561,8 +615,8 @@ onBeforeUnmount(() => { ro?.disconnect(); onUp(); });
</template>
<style scoped>
.pm-root { display: flex; flex-direction: column; gap: 10px; padding: 12px; box-sizing: border-box; min-height: 100%; }
.pm-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.pm-root { display: flex; flex-direction: column; gap: 10px; padding: 12px; box-sizing: border-box; height: 100%; overflow: hidden; }
.pm-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; flex-shrink: 0; }
.pm-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-cat { padding: 5px 12px; border-radius: 14px; border: 1px solid var(--n-border-color, #d9d9d9); background: transparent; color: inherit; cursor: pointer; font-size: 13px; }
.pm-cat.on { background: #3b82f6; border-color: #3b82f6; color: #fff; }
@@ -573,11 +627,11 @@ onBeforeUnmount(() => { ro?.disconnect(); onUp(); });
.pm-btn.primary:hover { background: #2563eb; color: #fff; }
.pm-btn.wide { width: 100%; margin-top: 6px; }
.pm-btn:disabled { opacity: .55; cursor: not-allowed; }
.pm-error { padding: 8px 12px; border-radius: 8px; background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; font-size: 13px; }
.pm-main { display: flex; gap: 12px; align-items: flex-start; flex: 1; min-height: 0; }
.pm-error { flex-shrink: 0; padding: 8px 12px; border-radius: 8px; background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; font-size: 13px; }
.pm-main { display: flex; gap: 12px; align-items: stretch; flex: 1; min-height: 0; }
/* 模板库 */
.pm-tpls { width: 292px; flex-shrink: 0; max-height: calc(100vh - 170px); overflow: auto; }
.pm-tpls { width: 292px; flex-shrink: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.pm-sec-title { font-size: 13px; font-weight: 700; opacity: .75; margin-bottom: 8px; }
.pm-tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pm-tpl-card { border: 2px solid transparent; border-radius: 10px; padding: 6px; cursor: pointer; background: rgba(127,127,127,.07); }
@@ -588,7 +642,7 @@ onBeforeUnmount(() => { ro?.disconnect(); onUp(); });
.pm-tpl-name { font-size: 12px; text-align: center; margin-top: 4px; }
/* 画布 */
.pm-stage { flex: 1; min-width: 0; display: flex; justify-content: center; overflow: auto; max-height: calc(100vh - 150px); padding-bottom: 8px; }
.pm-stage { flex: 1; min-width: 0; min-height: 0; display: flex; justify-content: center; overflow: auto; padding-bottom: 8px; }
.pm-frame { position: relative; flex-shrink: 0; box-shadow: 0 6px 24px rgba(0,0,0,.18); border-radius: 4px; overflow: hidden; }
.pm-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; }
.pm-layer { position: absolute; box-sizing: border-box; user-select: none; -webkit-user-select: none; touch-action: none; }
@@ -599,7 +653,7 @@ onBeforeUnmount(() => { ro?.disconnect(); onUp(); });
.pm-mini .pm-ph { font-size: 40px; }
/* 面板 */
.pm-panel { width: 316px; flex-shrink: 0; max-height: calc(100vh - 150px); overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.pm-panel { width: 316px; flex-shrink: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.pm-sec { padding: 10px 12px; border: 1px solid var(--n-border-color, #e5e5e5); border-radius: 10px; background: rgba(127,127,127,.04); }
.pm-bgs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.pm-bg-sw { height: 26px; border-radius: 6px; border: 1px solid rgba(127,127,127,.35); cursor: pointer; }
@@ -624,8 +678,9 @@ onBeforeUnmount(() => { ro?.disconnect(); onUp(); });
.pm-tip { font-size: 13px; opacity: .65; line-height: 1.7; padding: 8px 4px; }
.pm-hidden { display: none; }
@media (max-width: 1180px) {
.pm-main { flex-direction: column; }
.pm-tpls, .pm-panel { width: 100%; max-height: none; }
.pm-main { flex-direction: column; overflow-y: auto; }
.pm-tpls, .pm-panel { width: 100%; max-height: none; overflow: visible; }
.pm-stage { flex: none; height: 56vh; }
.pm-tpl-grid { grid-template-columns: repeat(4, 1fr); }
}
</style>
+149
View File
@@ -15,12 +15,14 @@ export interface PosterTextLayer {
lineHeight?: number; // 倍数,默认 1.25
italic?: boolean;
shadow?: PosterTextShadow;
rot?: number; // 旋转角度(度,绕图层中心,可为负)
}
export interface PosterImageLayer {
type: 'image';
x: number; y: number; w: number; h: number;
radius?: number;
rot?: number; // 旋转角度(度)
src?: string; // 当前图片(上传或 AI 生成后写入)
prompt?: string; // AI 生成默认提示词
}
@@ -32,6 +34,7 @@ export interface PosterShapeLayer {
fill: string;
radius?: number;
opacity?: number;
rot?: number; // 旋转角度(度)
}
export type PosterLayer = PosterTextLayer | PosterImageLayer | PosterShapeLayer;
@@ -62,6 +65,7 @@ export const POSTER_CATS = [
{ id: 'event', name: '活动' },
{ id: 'food', name: '美食' },
{ id: 'edu', name: '教育' },
{ id: 'school', name: '校园' },
{ id: 'sport', name: '健身' },
{ id: 'recruit', name: '招聘' },
{ id: 'birthday', name: '生日' },
@@ -293,6 +297,151 @@ export const POSTER_TEMPLATES: PosterTemplate[] = [
sh('rect', 340, 1345, 400, 76, 'rgba(255,255,255,0.92)', { radius: 38 }),
tx('了解更多', 340, 1363, 400, 36, '#004d40', { weight: 700 }),
]),
// ---------------- 校园(学校/老师/学生) ----------------
mk('jiaoshijie', '教师节快乐', 'school', grad(135, '#ff8f00', '#ffd54f'), [
sh('ellipse', 660, 70, 380, 380, 'rgba(255,255,255,0.16)'),
tx('教师节快乐', 50, 330, 980, 150, '#ffffff', { weight: 900, shadow: { color: 'rgba(180,80,0,0.4)', blur: 20, y: 6 } }),
tx('三尺讲台 · 一生耕耘', 50, 540, 980, 56, '#fff3e0', { weight: 700 }),
im(140, 670, 800, 470, '老师在黑板前讲课,明亮温暖教室,教师节主题摄影', { radius: 24 }),
sh('rect', 340, 1195, 400, 96, '#c62828', { radius: 48 }),
tx('感恩有您', 340, 1217, 400, 44, '#ffd54f'),
tx('9月10日 · 致敬每一位恩师', 50, 1345, 980, 40, '#fff8e1', { weight: 400 }),
]),
mk('kaixue1', '开学第一课', 'school', grad(120, '#1565c0', '#42a5f5'), [
tx('开学第一课', 50, 260, 980, 150, '#ffd60a', { weight: 900 }),
tx('新学期 · 新起点 · 新目标', 50, 470, 980, 54, '#ffffff', { weight: 700 }),
im(130, 620, 820, 480, '黑板与书本开学场景,粉笔字新学期,明亮教室', { radius: 24 }),
sh('rect', 300, 1180, 480, 100, '#ffd60a', { radius: 50 }),
tx('收心启航 立即返校', 300, 1206, 480, 44, '#1565c0'),
tx('XX学校 9月1日正式上课', 50, 1340, 980, 40, '#bbdefb', { weight: 400 }),
]),
mk('jiazhanghui', '家长会通知', 'school', solid('#1a237e'), [
sh('rect', 0, 0, 1080, 14, '#ffd60a'),
tx('家长会通知', 60, 130, 960, 130, '#ffffff', { align: 'left', weight: 900 }),
tx('时间:本周六 09:00\n地点:三年级(2)班教室\n主讲:班主任 王老师', 60, 350, 960, 46, '#c5cae9', { align: 'left', weight: 400, lineHeight: 1.7 }),
im(60, 660, 960, 430, '教室家长会现场,课桌整齐排列,明亮校园教室', { radius: 16 }),
sh('rect', 60, 1170, 480, 96, '#ffd60a', { radius: 48 }),
tx('敬请准时出席', 60, 1193, 480, 44, '#1a237e'),
tx('XX小学 三年级(2)班 家委会', 60, 1330, 960, 38, '#90a4ae', { align: 'left', weight: 400 }),
]),
mk('yundonghui', '秋季运动会', 'school', grad(135, '#d32f2f', '#ff7043'), [
sh('ellipse', -80, 180, 320, 320, 'rgba(255,255,255,0.12)'),
tx('秋季运动会', 50, 300, 980, 165, '#ffd54f', { weight: 900 }),
tx('激情飞扬 · 超越自我', 50, 520, 980, 56, '#ffffff', { weight: 700 }),
im(120, 660, 840, 470, '学校操场红色跑道与运动健儿,运动会场景', { radius: 24 }),
sh('rect', 340, 1200, 400, 96, '#ffffff', { radius: 48 }),
tx('报名参赛', 340, 1224, 400, 44, '#d32f2f'),
tx('10月16日 · 学校操场', 50, 1345, 980, 40, '#ffe0b2', { weight: 400 }),
]),
mk('biyeji', '毕业季', 'school', grad(160, '#0d47a1', '#26c6da'), [
tx('毕业快乐', 50, 250, 980, 175, '#ffffff', { weight: 900, shadow: { color: 'rgba(0,40,90,0.45)', blur: 22, y: 8 } }),
tx('愿你前程似锦 · 顶峰相见', 50, 470, 980, 54, '#b3e5fc', { weight: 700 }),
im(190, 620, 700, 640, '学士帽抛向蓝天,毕业季庆祝,青春校园', { radius: 32 }),
tx('2026届 · 青春不散场', 50, 1350, 980, 42, '#e1f5fe', { weight: 400 }),
]),
mk('shezhaoxin', '社团招新', 'school', grad(135, '#8e24aa', '#ff6d00'), [
tx('社团招新', 50, 270, 980, 170, '#ffffff', { weight: 900 }),
tx('百团大战 · 就等你来', 50, 490, 980, 58, '#ffe0b2', { weight: 700 }),
im(140, 640, 800, 470, '大学生社团活动,街舞音乐绘画丰富多彩,校园招新', { radius: 28 }),
sh('ellipse', 370, 1180, 340, 170, '#ffd60a'),
tx('加入我们', 370, 1228, 340, 48, '#6a1b9a', { weight: 900 }),
tx('本周五中午 · 食堂广场', 50, 1380, 980, 38, '#ffffff', { weight: 400 }),
]),
mk('biaozhang', '优秀学生表彰', 'school', solid('#fff8e1'), [
sh('rect', 36, 36, 1008, 1368, '#c62828'),
sh('rect', 60, 60, 960, 1320, '#fff8e1'),
tx('光荣榜', 50, 170, 980, 150, '#c62828', { weight: 900 }),
tx('优秀学生表彰', 50, 370, 980, 96, '#d32f2f', { weight: 900, rot: -4 }),
tx('张同学 · 李同学 · 王同学\n品学兼优 · 全面发展', 140, 570, 800, 52, '#5d4037', { weight: 700, lineHeight: 1.8 }),
im(240, 810, 600, 380, '金色奖杯与奖状证书特写,表彰大会氛围', { radius: 20 }),
tx('XX学校 教务处', 50, 1270, 980, 44, '#8d6e63', { weight: 400 }),
]),
mk('ertongjie', '快乐六一', 'school', grad(135, '#00bcd4', '#8bc34a'), [
tx('快乐六一', 50, 270, 980, 165, '#ffffff', { weight: 900, shadow: { color: 'rgba(0,90,110,0.35)', blur: 18, y: 6 } }),
tx('阳光自信 · 快乐成长', 50, 485, 980, 54, '#e0f7fa', { weight: 700 }),
im(160, 630, 760, 550, '小学校园儿童欢笑庆祝,彩色气球彩带,六一儿童节', { radius: 32 }),
sh('ellipse', 390, 1230, 300, 160, '#ff5722'),
tx('6·1', 390, 1272, 300, 62, '#ffffff', { weight: 900 }),
tx('XX小学 庆六一文艺汇演', 50, 1395, 980, 36, '#ffffff', { weight: 400 }),
]),
mk('kaoshi', '考试加油', 'school', solid('#b71c1c'), [
sh('ellipse', 340, 90, 400, 400, 'rgba(255,213,79,0.92)'),
tx('必胜', 340, 210, 400, 150, '#b71c1c', { weight: 900 }),
tx('考试加油', 50, 560, 980, 165, '#ffd54f', { weight: 900 }),
tx('以梦为马 · 不负韶华', 50, 780, 980, 54, '#ffffff', { weight: 700 }),
im(140, 900, 800, 350, '学生伏案复习试卷书本特写,台灯下奋斗场景', { radius: 20 }),
sh('rect', 300, 1300, 480, 96, '#ffd60a', { radius: 48 }),
tx('金榜题名', 300, 1324, 480, 44, '#b71c1c'),
]),
mk('dushuyue', '书香校园读书月', 'school', grad(160, '#4e342e', '#8d6e63'), [
tx('书香校园', 50, 260, 980, 160, '#ffe0b2', { weight: 900 }),
tx('读书月 · 阅读分享活动', 50, 470, 980, 52, '#ffffff', { weight: 700 }),
im(130, 620, 820, 480, '图书馆书架与学生阅读,温暖木质色调,书香氛围', { radius: 24 }),
sh('rect', 290, 1170, 500, 96, '#ffe0b2', { radius: 48 }),
tx('每天阅读30分钟', 290, 1194, 500, 44, '#4e342e'),
tx('主办:语文教研组 · 11月', 50, 1330, 980, 40, '#d7ccc8', { weight: 400 }),
]),
// ---------------- 更多促销/节日/活动/美食 ----------------
mk('miaosha', '限时秒杀', 'promo', solid('#111111'), [
tx('限时秒杀', 50, 260, 980, 170, '#ff1744', { weight: 900 }),
tx('前100名 · 1元抢', 50, 480, 980, 72, '#ffffff', { weight: 900 }),
im(80, 660, 580, 520, '爆款商品抢购堆头,红黑配色电商海报', { radius: 24 }),
sh('ellipse', 700, 660, 320, 320, 'rgba(255,23,68,0.88)'),
tx('1元', 700, 755, 320, 120, '#ffffff', { weight: 900, rot: -8 }),
tx('每晚8点准时开抢', 50, 1260, 980, 52, '#ff8a80', { weight: 700 }),
tx('活动截止:11月30日', 50, 1350, 980, 38, '#9e9e9e', { weight: 400 }),
]),
mk('shuang12', '双12年终盛典', 'promo', grad(135, '#4a148c', '#e91e63'), [
sh('ellipse', 620, 50, 440, 440, 'rgba(255,255,255,0.12)'),
tx('双12年终盛典', 40, 340, 1000, 130, '#ffffff', { weight: 900 }),
tx('年终好价 · 全场包邮', 50, 530, 980, 58, '#ffd60a', { weight: 900 }),
im(140, 670, 800, 470, '双12紫色电商促销礼盒堆头,霓虹光效', { radius: 28 }),
sh('rect', 340, 1210, 400, 96, '#ffd60a', { radius: 48 }),
tx('立即抢购', 340, 1234, 400, 44, '#4a148c'),
tx('12月12日 0点开抢', 50, 1350, 980, 40, '#f3e5f5', { weight: 400 }),
]),
mk('muri', '母亲节快乐', 'festival', grad(160, '#ec407a', '#f8bbd0'), [
tx('母亲节快乐', 50, 280, 980, 160, '#ffffff', { weight: 900, shadow: { color: 'rgba(150,20,60,0.35)', blur: 18, y: 6 } }),
tx('时光不老 · 母爱永恒', 50, 490, 980, 54, '#fce4ec', { weight: 700 }),
im(170, 640, 740, 540, '粉色康乃馨花束特写,母亲节温馨氛围', { radius: 32 }),
sh('ellipse', 380, 1225, 320, 150, '#ad1457'),
tx('感恩有你', 380, 1265, 320, 46, '#ffffff', { weight: 900 }),
tx('5月第二个星期日', 50, 1395, 980, 36, '#ffffff', { weight: 400 }),
]),
mk('zhounian', '门店周年庆', 'event', grad(135, '#bf360c', '#ff6d00'), [
tx('三周年庆', 50, 290, 980, 175, '#ffd54f', { weight: 900 }),
tx('感恩回馈 · 全场5折', 50, 520, 980, 60, '#ffffff', { weight: 900 }),
im(130, 670, 820, 460, '店铺周年庆气球拱门与礼盒,喜庆橙红色', { radius: 24 }),
sh('rect', 300, 1195, 480, 100, '#ffffff', { radius: 50 }),
tx('进店即送礼品', 300, 1222, 480, 44, '#bf360c'),
tx('活动3天 · 11月20-22日', 50, 1345, 980, 40, '#ffe0b2', { weight: 400 }),
]),
mk('waimai', '外卖满减', 'food', solid('#ff6f00'), [
tx('外卖满减', 50, 250, 980, 165, '#ffffff', { weight: 900 }),
tx('满25减12 · 满40减20', 50, 465, 980, 62, '#ffe0b2', { weight: 900 }),
im(140, 630, 800, 470, '外卖餐盒美食打包俯拍,橙色暖调餐饮摄影', { radius: 28 }),
sh('ellipse', 700, 1140, 300, 160, '#b71c1c'),
tx('立减', 700, 1184, 300, 50, '#ffd54f', { weight: 900 }),
tx('扫码下单 · 30分钟送达', 50, 1350, 980, 44, '#ffffff', { weight: 700 }),
]),
mk('kafei', '咖啡新品', 'food', solid('#3e2723'), [
tx('新品拿铁', 50, 250, 980, 160, '#ffab40', { weight: 900 }),
tx('第二杯半价', 50, 450, 980, 66, '#ffffff', { weight: 900 }),
im(150, 610, 780, 560, '咖啡拉花拿铁特写,木质桌面暖光,咖啡馆氛围', { radius: 32 }),
tx('每日现磨 · 门店限量', 50, 1250, 980, 48, '#ffe0b2', { weight: 700 }),
tx('活动时间:11:00 - 18:00', 50, 1350, 980, 38, '#bcaaa4', { weight: 400 }),
]),
mk('meishijie', '美食嘉年华', 'food', grad(135, '#e65100', '#ffb300'), [
sh('ellipse', -70, 240, 300, 300, 'rgba(255,255,255,0.14)'),
tx('美食嘉年华', 50, 300, 980, 155, '#ffffff', { weight: 900 }),
tx('全场5折 · 吃货狂欢', 50, 510, 980, 58, '#fff3e0', { weight: 900 }),
im(130, 660, 820, 470, '各类美食拼盘俯拍,烤串甜品饮品,热闹美食节', { radius: 24 }),
sh('rect', 340, 1200, 400, 96, '#b71c1c', { radius: 48 }),
tx('5折开吃', 340, 1224, 400, 44, '#ffd54f'),
tx('本周六日 · 中心广场', 50, 1345, 980, 40, '#ffffff', { weight: 400 }),
]),
];
// 背景快捷预设(画布"背景"区一键切换)