From e8d862b6449a8be097bc5920ba7b1d105fa03581 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 9 Nov 2026 15:54:07 +0800 Subject: [PATCH] Update App.jsx via upload script - 2026-11-09 15:53:54 --- App.jsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/App.jsx b/App.jsx index d2ad2f2..48309f0 100644 --- a/App.jsx +++ b/App.jsx @@ -4914,7 +4914,7 @@ function MainApp({ username, onLogout }) { {aiImportPreciseInfo && (aiImportPreciseInfo.doc ? (
- ✓ 原版彩页已生成({aiImportPreciseInfo.doc.pages} 页),导入后在产品详情的"原版彩页"里查看、翻译和下载。 + ✓ 原版彩页已生成({aiImportPreciseInfo.doc.pages} 页),正在后台自动翻译成英语、俄语、西班牙语(每种约 1 分钟)。导入后在产品详情的"原版彩页"里切换语言查看、下载。
) : (
@@ -9225,10 +9225,20 @@ function PreciseDocPanel({ docId, productName }) { getPreciseDoc(docId).then(d => { if (alive) { setInfo(d); setLang(d.srcLang); } }).catch(e => alive && setErr(e.message)); return () => { alive = false; }; }, [docId]); + // 导入后正在后台自动翻译(英 / 俄 / 西):每 8 秒刷新一次,翻完一种就能看一种 + const pendingKey = info && info.pending ? info.pending.join(',') : ''; + useEffect(() => { + if (!pendingKey) return; + const t = setInterval(() => { + getPreciseDoc(docId).then(d => setInfo(d)).catch(() => {}); + }, 8000); + return () => clearInterval(t); + }, [docId, pendingKey]); if (err) return
原版彩页读取失败:{err}
; if (!info) return null; const isSrc = lang === info.srcLang; const done = isSrc || !!(info.langs && info.langs[lang] > 0); + const pending = (info.pending || []).includes(lang); const url = (extra = '') => `/api/precise/${encodeURIComponent(docId)}/html?lang=${lang}${extra}&v=${ver}`; async function doTranslate() { setBusy(true); @@ -9249,12 +9259,12 @@ function PreciseDocPanel({ docId, productName }) { {!isSrc && ( - )} @@ -9265,7 +9275,7 @@ function PreciseDocPanel({ docId, productName }) { {done ? (