Update App.jsx via upload script - 2026-10-23 15:35:40
This commit is contained in:
parent
f56c9ada3b
commit
e5b4a3cf5a
23
App.jsx
23
App.jsx
|
|
@ -5732,7 +5732,7 @@ const WEB_MAX_IMAGES = 6;
|
||||||
const WEB_MAX_DETAIL_IMAGES = 20;
|
const WEB_MAX_DETAIL_IMAGES = 20;
|
||||||
|
|
||||||
// 网站图片列表(主图、详情图共用):多选上传、拖动排序、删除
|
// 网站图片列表(主图、详情图共用):多选上传、拖动排序、删除
|
||||||
function WebImageList({ draft, set, onNotify, field, max, label, cover, tall }) {
|
function WebImageList({ draft, set, onNotify, field, max, label, cover, tall, accept = 'image/*' }) {
|
||||||
const images = Array.isArray(draft[field]) ? draft[field] : [];
|
const images = Array.isArray(draft[field]) ? draft[field] : [];
|
||||||
const [uploading, setUploading] = useState(false);
|
const [uploading, setUploading] = useState(false);
|
||||||
const [dragIdx, setDragIdx] = useState(null);
|
const [dragIdx, setDragIdx] = useState(null);
|
||||||
|
|
@ -5786,7 +5786,9 @@ function WebImageList({ draft, set, onNotify, field, max, label, cover, tall })
|
||||||
onDrop={() => handleDrop(idx)}
|
onDrop={() => handleDrop(idx)}
|
||||||
onDragEnd={() => setDragIdx(null)}
|
onDragEnd={() => setDragIdx(null)}
|
||||||
>
|
>
|
||||||
<img src={`/uploads/${draft.id}/${f}`} alt="" />
|
{/\.(mp4|webm)$/i.test(f)
|
||||||
|
? <video src={`/uploads/${draft.id}/${f}`} muted loop autoPlay playsInline style={{ width: '100%', height: '100%', objectFit: 'cover' }} />
|
||||||
|
: <img src={`/uploads/${draft.id}/${f}`} alt="" />}
|
||||||
{cover && idx === 0 && <span className="cover-tag">封面</span>}
|
{cover && idx === 0 && <span className="cover-tag">封面</span>}
|
||||||
{!cover && <span className="cover-tag">{idx + 1}</span>}
|
{!cover && <span className="cover-tag">{idx + 1}</span>}
|
||||||
<button type="button" title="移除" onClick={() => handleRemove(idx)}><X size={12} /></button>
|
<button type="button" title="移除" onClick={() => handleRemove(idx)}><X size={12} /></button>
|
||||||
|
|
@ -5794,9 +5796,9 @@ function WebImageList({ draft, set, onNotify, field, max, label, cover, tall })
|
||||||
))}
|
))}
|
||||||
{images.length < max && (
|
{images.length < max && (
|
||||||
<label className={`web-thumb-add${tall ? ' tall' : ''}`} style={{ cursor: uploading ? 'default' : 'pointer' }}>
|
<label className={`web-thumb-add${tall ? ' tall' : ''}`} style={{ cursor: uploading ? 'default' : 'pointer' }}>
|
||||||
<input type="file" accept="image/*" multiple style={{ display: 'none' }} disabled={uploading}
|
<input type="file" accept={accept} multiple style={{ display: 'none' }} disabled={uploading}
|
||||||
onChange={e => { handlePick(e.target.files); e.target.value = ''; }} />
|
onChange={e => { handlePick(e.target.files); e.target.value = ''; }} />
|
||||||
<ImageIcon size={18} />{uploading ? '上传中…' : '添加图片'}
|
<ImageIcon size={18} />{uploading ? '上传中…' : accept.includes('video') ? '添加图片/视频' : '添加图片'}
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -5816,6 +5818,17 @@ const newTemplateId = () => 'tpl_' + Date.now().toString(36) + Math.random().toS
|
||||||
// 图片位的 id 必须和网站代码 src/lib/about-i18n.mjs 里用到的一致;以后网站新增图片位,在这里加一行。
|
// 图片位的 id 必须和网站代码 src/lib/about-i18n.mjs 里用到的一致;以后网站新增图片位,在这里加一行。
|
||||||
const SITE_ASSET_DIR = 'site_assets';
|
const SITE_ASSET_DIR = 'site_assets';
|
||||||
const SITE_SLOT_GROUPS = [
|
const SITE_SLOT_GROUPS = [
|
||||||
|
{ page: '首页动画(如果这个时候停电)', url: '/en/', groups: [
|
||||||
|
{ title: '六个场景依次全屏 3 秒再缩小到两侧,然后停电变黑、UPS 出现、画面恢复。可以传写实照片,也可以传 MP4 短视频(静音循环,建议 5–10 秒、10MB 以内);没上传的场景显示占位插画', slots: [
|
||||||
|
{ id: 'hp_hospital', name: '① 医院手术室', hint: '无影灯下医生做手术 · 左上', size: '1920×1080 横图或视频', video: true },
|
||||||
|
{ id: 'hp_school', name: '② 晚上 11 点教室', hint: '高中生在明亮的教室里学习 · 左中', size: '1920×1080 横图或视频', video: true },
|
||||||
|
{ id: 'hp_fab', name: '③ 芯片工厂车间', hint: '无尘车间生产线 · 左下', size: '1920×1080 横图或视频', video: true },
|
||||||
|
{ id: 'hp_airport', name: '④ 机场航站楼', hint: '夜晚航站楼、值机柜台、航班屏 · 右上', size: '1920×1080 横图或视频', video: true },
|
||||||
|
{ id: 'hp_esports', name: '⑤ 电竞比赛(PUBG)', hint: '比赛现场、大屏、选手 · 右中', size: '1920×1080 横图或视频', video: true },
|
||||||
|
{ id: 'hp_family', name: '⑥ 家庭客厅看电视', hint: '晚上一家人在客厅看电视 · 右下', size: '1920×1080 横图或视频', video: true },
|
||||||
|
{ id: 'hp_ups', name: 'UPS 产品图', hint: '最后出现在中间,建议白底或透明底 PNG', size: '竖图,透明背景最好' },
|
||||||
|
] },
|
||||||
|
] },
|
||||||
{ page: 'About Us 页面', url: '/en/about/', groups: [
|
{ page: 'About Us 页面', url: '/en/about/', groups: [
|
||||||
{ title: '首屏', slots: [{ id: 'hero', name: '工厂外景', hint: '首屏右侧大图', size: '1600×1300 横图' }] },
|
{ title: '首屏', slots: [{ id: 'hero', name: '工厂外景', hint: '首屏右侧大图', size: '1600×1300 横图' }] },
|
||||||
{ title: '公司介绍(图集:可传多张并写标题,第一张是网站上显示的首图,访客点开可以翻看全部)', slots: [
|
{ title: '公司介绍(图集:可传多张并写标题,第一张是网站上显示的首图,访客点开可以翻看全部)', slots: [
|
||||||
|
|
@ -5906,7 +5919,7 @@ function SiteAssetsEditor({ assets, setAssets, onNotify }) {
|
||||||
<WebImageList
|
<WebImageList
|
||||||
draft={{ id: SITE_ASSET_DIR, images: list }}
|
draft={{ id: SITE_ASSET_DIR, images: list }}
|
||||||
set={(patch) => setSlot(sl.id, patch.images || [])}
|
set={(patch) => setSlot(sl.id, patch.images || [])}
|
||||||
onNotify={onNotify} field="images" max={1} label="" />
|
onNotify={onNotify} field="images" max={1} label="" accept={sl.video ? 'image/*,video/mp4,video/webm' : 'image/*'} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue