diff --git a/App.jsx b/App.jsx
index b63cc1b..5ddaf05 100644
--- a/App.jsx
+++ b/App.jsx
@@ -6937,7 +6937,7 @@ function SiteAssetsEditor({ assets, setAssets, onNotify }) {
});
return (
-
在下面对应的位置上传图片,然后点右上角"更新到网站"。网站构建时会自动压缩图片;没上传的位置在网站上自动隐藏或显示图标,不会出现空白。建议照片宽度不小于 1200 像素。
+
在下面对应的位置上传图片,停止修改约 3 分钟后网站自动更新。网站构建时会自动压缩图片;没上传的位置在网站上自动隐藏或显示图标,不会出现空白。建议照片宽度不小于 1200 像素。
{SITE_SLOT_GROUPS.map(pg => {
const all = pg.groups.flatMap(g => g.slots);
const done = all.filter(sl => (assets[sl.id] || []).length).length;
@@ -7255,7 +7255,7 @@ function DetailTemplateManager({ templates, setTemplates, products, setProducts,
{setProducts &&
}
update(active.id, patch)} />
-
{usage(active.id) ? `${usage(active.id)} 个产品在用这个模板;修改后点"更新到网站"生效` : '还没有产品使用这个模板'}
+
{usage(active.id) ? `${usage(active.id)} 个产品在用这个模板;修改后约 3 分钟自动同步到网站` : '还没有产品使用这个模板'}
@@ -7286,23 +7286,15 @@ function DetailTemplateManager({ templates, setTemplates, products, setProducts,
// 模板管理(产品管理 → 模板管理):编辑模板 + 给模板勾选使用它的产品(一个系列一次选完,不用逐个产品去编辑)
function TemplateCenter({ templates, setTemplates, products, setProducts, onNotify, savedTick }) {
// 每个模板是否已经同步到网站:synced / changed / new;deleted = 后台删了、网站上还在
- const [sync, setSync] = useState({ status: {}, deleted: [], loaded: false });
- const loadSync = async () => {
- try {
- const r = await fetch('/api/site/templates-status');
- const d = await r.json();
- if (r.ok) setSync({ status: d.status || {}, deleted: d.deleted || [], loaded: true });
- } catch (e) {}
- };
- useEffect(() => { const t = setTimeout(loadSync, savedTick ? 600 : 0); return () => clearTimeout(t); }, [savedTick]);
+ const [sync] = useSiteSync(savedTick);
return (
-
每个模板可以包含三项内容,分开上传、互不重复:主图(同系列共用,接在产品自己的主图后面)、详情图片(工厂、认证、包装等,显示在详情图下方)、HTML(系列参数表)。选中一个模板后,在下面"使用这个模板的产品"里勾选型号;改完点右上角"更新到网站"。产品编辑页"网站发布"里也能单独添加或移除,两边是同一份数据。
+
每个模板可以包含三项内容,分开上传、互不重复:主图(同系列共用,接在产品自己的主图后面)、详情图片(工厂、认证、包装等,显示在详情图下方)、HTML(系列参数表)。选中一个模板后,在下面"使用这个模板的产品"里勾选型号。模板改完自动保存,停止修改约 3 分钟后自动同步到网站,不用手动更新。产品编辑页"网站发布"里也能单独添加或移除,两边是同一份数据。
@@ -7312,24 +7304,10 @@ function TemplateCenter({ templates, setTemplates, products, setProducts, onNoti
function TemplateProductMatcher({ tpl, products, setProducts, onNotify }) {
const [q, setQ] = useState('');
const [onlySel, setOnlySel] = useState(false);
- // 勾选型号后自动发布:产品打开"发布到网站",停手 15 秒后自动更新网站(多次勾选合并成一次)
+ // 勾选型号后自动发布:产品打开"发布到网站",服务器停手约 3 分钟后自动更新网站(多次勾选合并成一次)
const [deployMsg, setDeployMsg] = useState('');
- const deployTimer = useRef(null);
- useEffect(() => () => { if (deployTimer.current) clearTimeout(deployTimer.current); }, []);
- function scheduleDeploy() {
- if (deployTimer.current) clearTimeout(deployTimer.current);
- setDeployMsg('已自动发布,15 秒后自动更新网站…');
- deployTimer.current = setTimeout(async () => {
- deployTimer.current = null;
- setDeployMsg('正在提交网站更新…');
- try {
- const r = await fetch('/api/site/deploy', { method: 'POST' });
- const d = await r.json().catch(() => ({}));
- if (!r.ok) throw new Error(d.error || `HTTP ${r.status}`);
- setDeployMsg(d.note || '已通知网站更新,约1分钟后生效');
- } catch (e) { setDeployMsg(`自动更新失败:${e.message},请点右上角"更新到网站"`); }
- }, 15000);
- }
+ // 不再从页面触发网站更新:产品保存后服务器停手约 3 分钟自动更新网站
+ function scheduleDeploy() { setDeployMsg('已保存,约 3 分钟后自动更新网站'); }
const uses = (p) => Array.isArray(p.webDetailTemplateIds) && p.webDetailTemplateIds.includes(tpl.id);
const label = (p) => p.name || p.model || '未命名';
const setUse = (ids, on) => {
@@ -7995,7 +7973,7 @@ function PackSpecCenter({ specs, setSpecs, products, setProducts, onNotify }) {
-
一个箱规 = 每箱数量 + 每箱净重/毛重 + 外箱尺寸。选中一个箱规后,在下面勾选用这个箱规的型号(一个型号只能用一个箱规)。网站产品页会按客户填的数量自动生成箱单、算需要几个集装箱。改完箱规数值请点右上角"更新到网站"。
+
一个箱规 = 每箱数量 + 每箱净重/毛重 + 外箱尺寸。选中一个箱规后,在下面勾选用这个箱规的型号(一个型号只能用一个箱规)。网站产品页会按客户填的数量自动生成箱单、算需要几个集装箱。改完箱规数值,约 3 分钟后网站自动更新。
{specs.map(sp => (