feat(AI一键出片): 用户输入的标题写入项目文件名——顶栏title+工程数据+项目列表卡片名三处同步
This commit is contained in:
1 parent
59e6af3877
commit
087e74a025
2 files changed
+46
-1
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user