feat(gallery): 图库缩略图优先用落地本地副本;摘掉「生成中」样式

This commit is contained in:
qiqi committed 2026-12-02 13:44:21 +08:00
1 parent ff6e8ec883
commit 5df4f626ee
5 files changed
+18 -19

No files matched your search

+2 -13
View File
@@ -889,15 +889,6 @@
}
// 生成中(2026-12-02,用户裁定「方案 1」):某一轮还在跑时,旧图压暗 + 角标「生成中」,
// 但不改 data.result —— 失败时旧图原样保留,不会出现「图没了」。
// 生成中(2026-12-02,第三版):不再按具体 id 对 key —— 出图时宿主总会写一个 "…::out" 的忙标记,
// 这里只问「当前有没有任何 out 运行在跑」,避免 out/gen 节点 id 取错(前两版就是这么不亮的)。
const outBusyAny = !!(busy && Object.keys(busy).some((k) => k.slice(-5) === '::out' && busy[k]))
const outProgAny = !!(progress && Object.keys(progress).some((k) => {
if (k.slice(-5) !== '::out') return false
const pg = progress[k]
return !!(pg && (Number(pg.total) || 0) > (Number(pg.done) || 0))
}))
const genBusy = outBusyAny || outProgAny
const ingSt = (global.IWBImageIngestView && global.IWBImageIngestView.get(r.url)) || null
const imgEl = el('img', { key: 'out-img-' + cur + '-' + String(r.url || '').slice(-48), className: 'iwb-out-cell-img', decoding: 'async', fetchPriority: 'low', referrerPolicy: 'no-referrer', src: (ingSt && ingSt.localUrl) || wPreviewUrlOf((typeof wImgSrcForNode === 'function' ? wImgSrcForNode : wDisplayThumbOf)(thumbOf(r), Math.max(120, Math.min(360, (node && node.w ? node.w - 40 : 240))))), draggable: true, style: { aspectRatio: (r.width && r.height) ? String(r.width) + ' / ' + String(r.height) : undefined }, title: r.idb && r.data ? '单击选中 · 双击查看原图 · 拖到画布作参考图' : '单击选中 · 双击放大(可左右切换)· 拖到画布作参考图', onError: (e) => { if (e.currentTarget && e.currentTarget.src !== r.url) e.currentTarget.src = r.url }, onPointerDown: (e) => { e.stopPropagation(); props.onSelect && props.onSelect(node.id) }, onDragStart: (e) => { try { const u = r.url || ''; e.dataTransfer.setData('application/x-iwb-output-ref', u); e.dataTransfer.setData('text/plain', u); e.dataTransfer.effectAllowed = 'copy' } catch (err) { /* 浏览器拒写自定义 MIME 时仍保留 text/plain */ } }, onDoubleClick: (e) => { e.stopPropagation(); openPreviewAt(cur) } })
// 下载浮层:与图库共用同一组 hover token;组件缺失时退回旧的双小按钮(单文件/旧加载顺序)
@@ -905,12 +896,10 @@
const actions = DlOv ? null : el('div', { className: 'iwb-out-cell-actions' },
el('button', { className: 'iwb-btn iwb-btn-sm', title: '下载', onClick: doDownload, onPointerDown: stop }, I('download')),
)
const ingBadge = genBusy
? el('span', { className: 'iwb-out-cell-flag iwb-out-cell-flag-busy', key: 'ing-flag' }, '生成中')
: ingSt && (ingSt.status === 'queued' || ingSt.status === 'downloading')
const ingBadge = ingSt && (ingSt.status === 'queued' || ingSt.status === 'downloading')
? el('span', { className: 'iwb-out-cell-flag', key: 'ing-flag' }, ingSt.status === 'queued' ? '排队中' : '下载中')
: (ingSt && ingSt.status === 'failed' ? el('span', { className: 'iwb-out-cell-flag iwb-out-cell-flag-err', key: 'ing-flag' }, '未落地') : null)
return el('div', { key: String(r.url || '') + '|' + ri, className: 'iwb-out-cell' + (genBusy ? ' iwb-out-cell-busy' : '') },
return el('div', { key: String(r.url || '') + '|' + ri, className: 'iwb-out-cell' },
ingBadge,
DlOv ? el(DlOv, { key: 'ov', onDownload: doDownload, icon: I('download'), label: '下载' }, imgEl) : imgEl,
el('div', { className: 'iwb-out-cell-meta' }, (r.width || '?') + '×' + (r.height || '?')),