(function () { const D = window.PL.data; const R = window.PL.render; const UI = window.PL.ui; const h = UI.h; const A = UI.antd; const sampleMap = { standup: 'citrus', flatbottom: 'glow', coffee: 'morning', kraft: 'sunday', mailer: 'noir', garment: 'bloom' }; const productTints = ['#e9e1d0', '#e5f0c4', '#f3ded4', '#e6d2b6', '#d9d5cc', '#dce9ee']; function designFor(templateId, product) { const size = D.sizeOf(product, product.sizes[Math.floor((product.sizes.length - 1) / 2)].id); return { size: size, design: R.designFromTemplate(templateId, size.w, size.h, 'front') }; } function mountBag(el, productId, templateId) { if (!el) return; const product = D.productById(productId); const d = designFor(templateId, product); el.innerHTML = R.bagSVG(product, 'front', d.design, { size: d.size, card: true }); } mountBag(document.getElementById('heroBag1'), 'coffee', 'morning'); mountBag(document.getElementById('heroBag2'), 'standup', 'citrus'); mountBag(document.getElementById('heroBag3'), 'kraft', 'sunday'); mountBag(document.getElementById('miniBag1'), 'coffee', 'morning'); mountBag(document.getElementById('miniBag2'), 'standup', 'citrus'); const arrowIcon = h('span', { dangerouslySetInnerHTML: { __html: '' } }); function productCards() { return D.products.map(function (item, i) { const size = D.sizeOf(item, item.sizes[Math.floor((item.sizes.length - 1) / 2)].id); const template = D.templateById(sampleMap[item.id]) || D.templates[0]; const design = R.designFromTemplate(template.id, size.w, size.h, 'front'); const svg = R.bagSVG(item, 'front', design, { size: size, card: true }); const price = D.price({ productId: item.id, sizeId: size.id, material: 'matte', finish: 'none', qty: 100 }); return h(A.Card, { key: item.id, hoverable: true, bordered: false, className: 'product-card', onClick: function () { location.href = 'studio.html?product=' + item.id; } }, h('div', { className: 'product-card-top' }, h(A.Tag, { className: i === 0 ? 'tag-accent' : '' }, item.badge), h(A.Button, { type: 'text', shape: 'circle', icon: arrowIcon, className: 'card-arrow', onClick: function (e) { e.stopPropagation(); location.href = 'studio.html?product=' + item.id; } }) ), h('div', { className: 'product-visual', style: { '--card-tint': productTints[i] }, dangerouslySetInnerHTML: { __html: svg } }), h('div', { className: 'product-info' }, h('h3', null, item.name, h('span', null, item.en)), h('p', null, item.desc), h('div', { className: 'product-meta' }, h('span', null, h('b', null, '¥' + price.unit.toFixed(2)), h('span', null, ' / 个起')), h('span', null, size.w + '×' + size.h + ' mm · ' + size.label) ) ) ); }); } function templateCards() { return D.templates.slice(0, 8).map(function (t) { return h(A.Card, { key: t.id, hoverable: true, bordered: false, className: 'template-card', bodyStyle: { padding: 0 }, onClick: function () { location.href = 'studio.html?template=' + t.id; } }, h('div', { className: 'template-visual', style: { background: t.tint }, dangerouslySetInnerHTML: { __html: R.templatePreview(t) } }), h('div', { className: 'template-meta' }, h('b', null, t.name), h(A.Tag, { bordered: false, className: 'template-tag' }, t.category) ) ); }); } function studioSteps() { return h(A.Steps, { direction: 'vertical', size: 'small', current: -1, items: [ { title: '选袋型', description: '尺寸与材质实时报价' }, { title: '做设计', description: '模板 / 上传 / 文字 / 图形' }, { title: '看效果', description: '3D 预览,一键下载' } ] }); } function craftStats() { const stats = [ { value: 300, title: 'DPI 印刷精度' }, { value: '±0.5', title: 'MM 刀版误差' }, { value: 12, title: '种表面工艺' } ]; return h('div', { className: 'craft-stat-row' }, stats.map(function (s, i) { return h('div', { key: i, className: 'craft-stat' }, h(A.Statistic, { value: s.value, title: s.title })); })); } function craftCards() { const items = [ { title: '精准刀版线', desc: '每种袋型都有独立刀版,安全区、出血位与折线自动生成,设计不会印偏。', icon: '' }, { title: '3D 实时样机', desc: '设计完成即可查看立体效果,模拟袋身弧度与光泽,所见即所得。', icon: '' }, { title: '48 小时打样', desc: '数码打样快速确认颜色与材质,100 个即可开机,小批量不再将就。', icon: '' }, { title: '环保材料', desc: '可降解膜、再生牛皮纸与大豆油墨。包装好看,也可以对地球友好。', icon: '' } ]; return items.map(function (item, i) { return h(A.Card, { key: i, bordered: false, className: 'craft-item' }, h('div', { className: 'craft-icon', dangerouslySetInnerHTML: { __html: item.icon } }), h('h3', null, item.title), h('p', null, item.desc) ); }); } function processSteps() { return h(A.Steps, { direction: 'horizontal', current: -1, items: [ { title: '选择袋型', description: '按产品与容量选袋型、尺寸与材质,价格实时计算。' }, { title: '在线设计', description: '套用模板或从空白开始,上传 Logo,拖拽排版。' }, { title: '确认效果', description: '3D 预览、下载效果图,检查每一个细节。' }, { title: '下单印刷', description: '100 个起订,48 小时打样,生产进度全程可查。' } ] }); } function newsletter() { const input = h(A.Input, { placeholder: '你的邮箱', variant: 'borderless' }); const button = h(A.Button, { shape: 'circle', type: 'primary', icon: h('span', { dangerouslySetInnerHTML: { __html: '' } }), onClick: function () { const value = input.input ? input.input.value : ''; if (!value || value.indexOf('@') < 0) { UI.message.warning('请输入有效的邮箱地址'); return; } if (input.input) input.input.value = ''; UI.message.success('订阅成功,下一封灵感见'); } }); return h('div', { className: 'field' }, input, button); } function demoBox() { const W = 240; const H = 300; const DEPTH = 160; const p = D.productById('standup'); const size = D.sizeOf(p, 'm'); const design = R.designFromTemplate('citrus', size.w, size.h, 'front'); const art = R.designSVG(design, size.w, size.h); const faces = [ { id: 'front', w: W, h: H, t: 'translateZ(' + (DEPTH / 2) + 'px)', bg: 'background:#e7f385', art: art }, { id: 'right', w: DEPTH, h: H, t: 'rotateY(90deg) translateZ(' + (W / 2) + 'px)', bg: 'background:#efe7d6' }, { id: 'left', w: DEPTH, h: H, t: 'rotateY(-90deg) translateZ(' + (W / 2) + 'px)', bg: 'background:#e3d9c4' }, { id: 'top', w: W, h: DEPTH, t: 'rotateX(90deg) translateZ(' + (H / 2) + 'px)', bg: 'background:#f3ecdd' }, { id: 'bottom', w: W, h: DEPTH, t: 'rotateX(-90deg) translateZ(' + (H / 2) + 'px)', bg: 'background:#e8dfcd' } ]; return '