diff --git a/scripts/e2e_quickvideo_cover.py b/scripts/e2e_quickvideo_cover.py index d4bdbf9..49e315e 100644 --- a/scripts/e2e_quickvideo_cover.py +++ b/scripts/e2e_quickvideo_cover.py @@ -248,6 +248,7 @@ def main(): } catch (e) { resUrl = 'ERR:' + e; } } return { + title: d.title, first: f, coverResourceUrl: resUrl.slice(0, 40), imgCount: imgs.length, @@ -307,7 +308,7 @@ def main(): const d = (window.__editor && window.__editor.movie && window.__editor.movie.data) || {}; const els = (d.elements || []).slice().sort((a,b) => (a.startTime||0) - (b.startTime||0)); const f = els[0] || {}; - return { firstName: f.name, firstT: f.startTime, firstD: f.duration, + return { title: d.title, firstName: f.name, firstT: f.startTime, firstD: f.duration, els: els.length, caps: (d.captions||[]).length }; }""") log("刷新后: " + json.dumps(after, ensure_ascii=False)) @@ -316,6 +317,26 @@ def main(): and after.get("firstT") is not None and abs(float(after.get("firstT"))) < 0.01 ) + # 断言:用户输入的标题 → 项目文件名(顶栏 title + 刷新后持久化) + res_title = res.get("title") + log("构建后 title: %s" % res_title) + checks["title_applied_after_build"] = res_title == "封面功能端到端验证" + checks["title_persist_after_reload"] = after.get("title") == "封面功能端到端验证" + # 项目列表卡片名(meta.name) + meta_name = page.evaluate("""async () => { + try { + const rq = indexedDB.open('H5VideoLocalDB'); + const db = await new Promise((res, rej) => { rq.onsuccess = () => res(rq.result); rq.onerror = () => rej(rq.error); }); + const id = window.__editor && window.__editor.appid; + const tx = db.transaction('projects', 'readonly'); + const g = tx.objectStore('projects').get(id); + const rec = await new Promise((res, rej) => { g.onsuccess = () => res(g.result); g.onerror = () => rej(g.error); }); + return (rec && rec.name) || ''; + } catch (e) { return 'ERR:' + e; } + }""") + log("项目卡片名: %s" % meta_name) + checks["project_card_name"] = meta_name == "封面功能端到端验证" + ok = all(checks.values()) print(json.dumps({"ok": ok, "checks": checks, "errors": errors[-5:]}, ensure_ascii=False)) browser.close() diff --git a/src/pages/editor/components/sources/ai/QuickVideo.tsx b/src/pages/editor/components/sources/ai/QuickVideo.tsx index ac86fc5..c998655 100644 --- a/src/pages/editor/components/sources/ai/QuickVideo.tsx +++ b/src/pages/editor/components/sources/ai/QuickVideo.tsx @@ -772,6 +772,30 @@ export default function QuickVideo({ if (captions.length) editor.setContorlAndSelectedElemenent?.([]); const transCount = fxTrans === 'none' ? 0 : Math.max(0, segs.length - 1); + + // 项目文件名 = 用户输入的标题:顶栏标题、工程数据、项目列表卡片名三处同步 + const projTitle = title.trim(); + if (projTitle) { + editor.data.title = projTitle; + // movie.data 若是独立引用,一并改掉(保存走 sortZIndexNewData) + const md: any = (editor as any).movie?.data; + if (md && md !== editor.data) md.title = projTitle; + try { + if (typeof (editor as any).saveApp === 'function') { + await (editor as any).saveApp(); + } + } catch (e) { + console.warn('[qv] 保存标题失败', e); + } + try { + // 本地模式:项目卡片名存的是 meta.name(saveProject 不会用 title 覆盖),需单独同步 + const { updateLocalProjectMeta } = await import('@services/localStorageService'); + await updateLocalProjectMeta(editor.appid, { name: projTitle }).catch(() => {}); + } catch (e) { + console.warn('[qv] 同步项目名失败', e); + } + } + Toast.success( (cover ? '封面 + ' : '') + `已生成 ${segs.length} 段:图片${fxMotion === 'none' ? '' : '(带动效)'}、配音、字幕已就位` +