feat: 新增客户端作品展示模块
This commit is contained in:
+32
-2
@@ -31,8 +31,8 @@ function writeStorage(key: string, buf: Buffer): string {
|
||||
return key;
|
||||
}
|
||||
|
||||
async function placeholder(text: string, bg: string): Promise<Buffer> {
|
||||
const svg = `<svg width="900" height="640" xmlns="http://www.w3.org/2000/svg">
|
||||
async function placeholder(text: string, bg: string, width = 900, height = 640): Promise<Buffer> {
|
||||
const svg = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="100%" height="100%" fill="${bg}"/>
|
||||
<text x="50%" y="50%" font-family="Microsoft YaHei, sans-serif" font-size="56" fill="#ffffff" text-anchor="middle" dominant-baseline="middle">${text}</text>
|
||||
</svg>`;
|
||||
@@ -146,6 +146,35 @@ async function ensureSampleData(): Promise<void> {
|
||||
for (const s of samples) {
|
||||
const imgKey = writeStorage(`seed/${shortId()}.jpg`, await placeholder(s.title, s.bg));
|
||||
const img2 = writeStorage(`seed/${shortId()}.jpg`, await placeholder('细节图', s.bg));
|
||||
const showcaseImages = [
|
||||
{
|
||||
key: writeStorage(
|
||||
`seed/${shortId()}.jpg`,
|
||||
await placeholder(`${s.title} · 整体展示`, s.bg, 1200, 800),
|
||||
),
|
||||
name: '整体展示',
|
||||
description: '从正面完整展示作品器型、比例与整体效果。',
|
||||
type: 'image',
|
||||
},
|
||||
{
|
||||
key: writeStorage(
|
||||
`seed/${shortId()}.jpg`,
|
||||
await placeholder(`${s.title} · 工艺细节`, s.bg, 800, 1200),
|
||||
),
|
||||
name: '工艺细节',
|
||||
description: '近距离呈现作品纹样、釉色与手工制作细节。',
|
||||
type: 'image',
|
||||
},
|
||||
{
|
||||
key: writeStorage(
|
||||
`seed/${shortId()}.jpg`,
|
||||
await placeholder(`${s.title} · 多角度展示`, s.bg, 900, 1500),
|
||||
),
|
||||
name: '多角度展示',
|
||||
description: '按原始比例展示作品局部与不同观察角度。',
|
||||
type: 'image',
|
||||
},
|
||||
];
|
||||
const createMedia = await nodeMedia(['设计稿', '选胚图'], s.bg);
|
||||
const produceMedia = await nodeMedia(['手塑', '拉胚', '上釉', '烧制'], s.bg);
|
||||
const storageMedia = await nodeMedia(['入库实况'], s.bg);
|
||||
@@ -165,6 +194,7 @@ async function ensureSampleData(): Promise<void> {
|
||||
{ key: imgKey, name: '主图' },
|
||||
{ key: img2, name: '细节' },
|
||||
],
|
||||
showcaseImages,
|
||||
traceNodes: {
|
||||
create: [
|
||||
{ nodeType: 'CREATE', title: '创作设计', location: '景德镇', description: '设计选胚,确定器型与纹样。', sortOrder: 0, mediaFiles: createMedia },
|
||||
|
||||
Reference in New Issue
Block a user