feat: initial commit for newborn tracker with family & role management, full responsive ui, offline assets

This commit is contained in:
gs committed 2026-09-24 08:19:15 +08:00
commit 01f9f2c514
72 files changed
+11186

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
const fs = require('fs');
const path = require('path');
const postersDir = path.join(__dirname, '../public/images/posters');
if (!fs.existsSync(postersDir)) {
fs.mkdirSync(postersDir, { recursive: true });
}
const posters = [
{
id: 'poster-bottle.svg',
title: '45° 防胀气瓶喂指南',
subtitle: '节律喂养 · 杜绝呛奶吞气',
icon: '🍼',
bg1: '#FEF3C7',
bg2: '#F59E0B',
accent: '#B45309'
},
{
id: 'poster-breastfeed.svg',
title: '新生儿深吸含乳技巧',
subtitle: '深层含乳 · 预防乳头皲裂',
icon: '🤱',
bg1: '#FFE4E6',
bg2: '#F43F5E',
accent: '#BE123C'
},
{
id: 'poster-burping.svg',
title: '空心掌拍嗝防胀气实操',
subtitle: '端坐与过肩拍嗝 · 排净胃气',
icon: '💨',
bg1: '#EDE9FE',
bg2: '#8B5CF6',
accent: '#6D28D9'
},
{
id: 'poster-diaper.svg',
title: '防红屁屁换尿布全流程',
subtitle: '温水清洗 · 隔离护臀膏涂法',
icon: '💧',
bg1: '#E0F2FE',
bg2: '#0EA5E9',
accent: '#0369A1'
},
{
id: 'poster-sleep.svg',
title: '安全襁褓裹法与入睡安抚',
subtitle: '防惊跳反射 · 建立自主入睡',
icon: '😴',
bg1: '#F1F5F9',
bg2: '#64748B',
accent: '#334155'
},
{
id: 'poster-bath.svg',
title: '新生儿安全盆浴与脐带护理',
subtitle: '快速盆浴 · 75% 酒精消毒',
icon: '🛁',
bg1: '#CCFBF1',
bg2: '#14B8A6',
accent: '#0F766E'
}
];
posters.forEach(p => {
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 360" width="100%" height="100%">
<defs>
<linearGradient id="grad-${p.id}" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="${p.bg1}" />
<stop offset="100%" stop-color="${p.bg2}" stop-opacity="0.85" />
</linearGradient>
<filter id="shadow" x="-10%" y="-10%" width="120%" height="120%">
<feDropShadow dx="0" dy="8" stdDeviation="12" flood-opacity="0.15" />
</filter>
</defs>
<!-- Background -->
<rect width="600" height="360" rx="24" fill="url(#grad-${p.id})" />
<!-- Background subtle circles -->
<circle cx="520" cy="60" r="100" fill="white" opacity="0.15" />
<circle cx="80" cy="300" r="80" fill="white" opacity="0.1" />
<!-- Center Card -->
<g transform="translate(60, 50)" filter="url(#shadow)">
<rect width="480" height="260" rx="20" fill="white" fill-opacity="0.92" backdrop-filter="blur(10px)" />
<!-- Icon circle -->
<circle cx="240" cy="80" r="44" fill="${p.bg1}" />
<text x="240" y="94" font-size="44" text-anchor="middle" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif">${p.icon}</text>
<!-- Title -->
<text x="240" y="165" font-size="22" font-weight="900" fill="#1E293B" text-anchor="middle" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif">${p.title}</text>
<!-- Subtitle -->
<text x="240" y="198" font-size="14" font-weight="600" fill="${p.accent}" text-anchor="middle" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif">${p.subtitle}</text>
<!-- Video play indicator pill -->
<g transform="translate(195, 218)">
<rect width="90" height="24" rx="12" fill="${p.accent}" />
<polygon points="234,225 244,230 234,235" fill="white" />
<text x="250" y="234" font-size="10" font-weight="700" fill="white" font-family="-apple-system, BlinkMacSystemFont, sans-serif">教学视频</text>
</g>
</g>
</svg>`;
fs.writeFileSync(path.join(postersDir, p.id), svg, 'utf8');
console.log(`Generated local poster: ${p.id}`);
});
console.log('All 6 local SVG posters created successfully!');