yonge 1 ay önce
ebeveyn
işleme
e880df6cfa

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
dist/assets/index-BILT_alS.js


+ 1 - 1
dist/assets/index-I-gnTBCC.js → dist/assets/index-BmlA92AM.js

@@ -1 +1 @@
-import{u as c,ag as l}from"./index-b1OlXtrI.js";import{w as p,bA as d,a5 as g,cD as m,R as t,ae as r,af as u,al as f,ag as w,bH as k}from"./index-DHK5xtNf.js";import"./shapes-D6c_7wx8.js";const S=()=>{function o(a){if(window.parent===window)return;const{api:e,playState:n}=a.data||{};e==="headerTogge"?window.parent.postMessage({api:"headerTogge",playState:n},"*"):e==="changeTogge"?window.parent.postMessage({api:"changeTogge"},"*"):["clickTempo","clickViewFigner"].includes(e)&&window.parent.postMessage({api:e},"*")}p(()=>{window.addEventListener("message",o)}),d(()=>{window.removeEventListener("message",o)})},_=g({__name:"mobileScreen",setup(o){S();const a=m(),e=t(!0),n=t(!1),i=c();return a.setScreenMode("mobileScreen"),i.initPPTData().then(()=>{e.value=!1}),(v,s)=>(r(),u("div",{class:"mobileScreen",onClick:s[0]||(s[0]=b=>n.value=!1)},[e.value?w("",!0):(r(),f(l,{key:0}))]))}}),P=k(_,[["__scopeId","data-v-90b2692a"]]);export{P as default};
+import{u as c,ag as l}from"./index-D33vDR_G.js";import{w as p,bA as d,a5 as g,cD as m,R as t,ae as r,af as u,al as f,ag as w,bH as k}from"./index-BILT_alS.js";import"./shapes-CTjcKenp.js";const S=()=>{function o(a){if(window.parent===window)return;const{api:e,playState:n}=a.data||{};e==="headerTogge"?window.parent.postMessage({api:"headerTogge",playState:n},"*"):e==="changeTogge"?window.parent.postMessage({api:"changeTogge"},"*"):["clickTempo","clickViewFigner"].includes(e)&&window.parent.postMessage({api:e},"*")}p(()=>{window.addEventListener("message",o)}),d(()=>{window.removeEventListener("message",o)})},_=g({__name:"mobileScreen",setup(o){S();const a=m(),e=t(!0),n=t(!1),i=c();return a.setScreenMode("mobileScreen"),i.initPPTData().then(()=>{e.value=!1}),(v,s)=>(r(),u("div",{class:"mobileScreen",onClick:s[0]||(s[0]=b=>n.value=!1)},[e.value?w("",!0):(r(),f(l,{key:0}))]))}}),P=k(_,[["__scopeId","data-v-90b2692a"]]);export{P as default};

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
dist/assets/index-BpQDkNj9.css


+ 1 - 1
dist/assets/index-DXbQRJRw.js → dist/assets/index-D-YbKUWQ.js

@@ -1 +1 @@
-import{_ as t}from"./404-R0y5dkvZ.js";import{E as c}from"./index-B-p4r2zd.js";import{a5 as n,ae as i,af as r,ak as o,aq as _,am as d,P as l,aS as p,bP as m,bQ as f,bH as u}from"./index-DHK5xtNf.js";const s=a=>(m("data-v-340bbdaa"),a=a(),f(),a),h={class:"login"},b={class:"error"},g=s(()=>o("img",{src:t,class:"img",alt:""},null,-1)),k=s(()=>o("div",{class:"tit"},"登录已过期或服务器错误!",-1)),v=n({__name:"login",setup(a){function e(){window.close()}return(x,B)=>(i(),r("div",h,[o("div",b,[g,k,_(l(c),{class:"backBtn",type:"primary",plain:"",onClick:e},{default:d(()=>[p("关闭页面")]),_:1})])]))}}),C=u(v,[["__scopeId","data-v-340bbdaa"]]);export{C as default};
+import{_ as t}from"./404-R0y5dkvZ.js";import{E as c}from"./index-DZjvOHny.js";import{a5 as n,ae as i,af as r,ak as o,aq as _,am as d,P as l,aS as p,bP as m,bQ as f,bH as u}from"./index-BILT_alS.js";const s=a=>(m("data-v-340bbdaa"),a=a(),f(),a),h={class:"login"},b={class:"error"},g=s(()=>o("img",{src:t,class:"img",alt:""},null,-1)),k=s(()=>o("div",{class:"tit"},"登录已过期或服务器错误!",-1)),v=n({__name:"login",setup(a){function e(){window.close()}return(x,B)=>(i(),r("div",h,[o("div",b,[g,k,_(l(c),{class:"backBtn",type:"primary",plain:"",onClick:e},{default:d(()=>[p("关闭页面")]),_:1})])]))}}),C=u(v,[["__scopeId","data-v-340bbdaa"]]);export{C as default};

+ 1 - 1
dist/assets/index-b1OlXtrI.js → dist/assets/index-D33vDR_G.js

@@ -1,4 +1,4 @@
-import{cH as pw,cI as gw,aG as mw,cJ as yw,cK as Sw,cL as bw,cM as xw,ah as Wt,cN as Cw,cO as ww,cP as Tw,cQ as Iw,aM as _w,aF as Aw,cR as Ew,aB as d1,bg as Pw,cS as Mw,cT as Rw,cU as Dw,cV as Lw,cW as kw,cX as Ow,cY as Bw,aE as Nw,cZ as Fw,s as Te,bl as $w,al as je,ag as Fe,af as he,ak as Z,c_ as zw,c$ as Uw,d0 as Hw,d1 as Vw,bk as Gw,cy as cl,aS as wv,aq as Ye,d2 as Ww,d3 as jw,a5 as ze,d4 as Kw,d5 as Xw,d6 as Yw,d7 as Zw,d8 as Qw,d9 as Jw,da as qw,db as eT,dc as tT,dd as rT,de as nT,v as iT,df as aT,dg as oT,dh as sT,aW as lT,di as uT,dj as cT,dk as fT,dl as dT,dm as hT,ay as ur,dn as vT,dp as pT,dq as gT,dr as mT,A as yT,ds as ST,dt as bT,bq as xT,du as CT,dv as wT,dw as TT,ap as IT,ac as Tv,ai as ct,dx as _T,au as xe,dy as AT,X as h1,y as ET,dz as PT,aP as MT,dA as RT,w as Er,dB as DT,dC as LT,H as kT,dD as OT,bA as hn,aD as BT,ae as ne,bQ as ea,$ as Tc,dE as NT,bP as ta,dF as FT,aC as $T,aO as zT,R as fe,dG as UT,br as ih,b3 as _r,aj as Hs,b1 as lt,b2 as Ua,an as Iv,dH as HT,dI as VT,dJ as GT,dK as WT,dL as jT,dM as KT,dN as XT,Q as YT,dO as ZT,dP as QT,dQ as JT,at as Mt,dR as qT,aR as eI,aY as tI,ad as fl,aZ as rI,dS as nI,dT as iI,dU as aI,P as le,a6 as oI,dV as sI,dW as lI,dX as uI,dY as cI,a7 as fI,dZ as dI,bN as hI,d_ as vI,d$ as pI,bM as gI,b4 as v1,aA as _v,e0 as mI,e1 as yI,E as Jt,x as SI,e2 as bI,e3 as xI,e4 as CI,am as _n,e5 as wI,az as sr,aU as Vs,e6 as TI,as as pr,e7 as II,e8 as Av,cG as yr,by as ah,bK as oh,bI as _I,bH as Ve,bu as sh,bv as Ev,bx as jt,bB as Ic,bR as di,e9 as Tu,bE as hi,ea as AI,bJ as ra,bC as EI,bw as Lt,eb as PI,ec as ui,bO as MI,ed as RI,ee as DI,ef as LI,eg as kI,eh as Jp,ei as OI,bF as qp,cD as _c,cC as BI,ej as Vu,ek as _l}from"./index-DHK5xtNf.js";/**
+import{cH as pw,cI as gw,aG as mw,cJ as yw,cK as Sw,cL as bw,cM as xw,ah as Wt,cN as Cw,cO as ww,cP as Tw,cQ as Iw,aM as _w,aF as Aw,cR as Ew,aB as d1,bg as Pw,cS as Mw,cT as Rw,cU as Dw,cV as Lw,cW as kw,cX as Ow,cY as Bw,aE as Nw,cZ as Fw,s as Te,bl as $w,al as je,ag as Fe,af as he,ak as Z,c_ as zw,c$ as Uw,d0 as Hw,d1 as Vw,bk as Gw,cy as cl,aS as wv,aq as Ye,d2 as Ww,d3 as jw,a5 as ze,d4 as Kw,d5 as Xw,d6 as Yw,d7 as Zw,d8 as Qw,d9 as Jw,da as qw,db as eT,dc as tT,dd as rT,de as nT,v as iT,df as aT,dg as oT,dh as sT,aW as lT,di as uT,dj as cT,dk as fT,dl as dT,dm as hT,ay as ur,dn as vT,dp as pT,dq as gT,dr as mT,A as yT,ds as ST,dt as bT,bq as xT,du as CT,dv as wT,dw as TT,ap as IT,ac as Tv,ai as ct,dx as _T,au as xe,dy as AT,X as h1,y as ET,dz as PT,aP as MT,dA as RT,w as Er,dB as DT,dC as LT,H as kT,dD as OT,bA as hn,aD as BT,ae as ne,bQ as ea,$ as Tc,dE as NT,bP as ta,dF as FT,aC as $T,aO as zT,R as fe,dG as UT,br as ih,b3 as _r,aj as Hs,b1 as lt,b2 as Ua,an as Iv,dH as HT,dI as VT,dJ as GT,dK as WT,dL as jT,dM as KT,dN as XT,Q as YT,dO as ZT,dP as QT,dQ as JT,at as Mt,dR as qT,aR as eI,aY as tI,ad as fl,aZ as rI,dS as nI,dT as iI,dU as aI,P as le,a6 as oI,dV as sI,dW as lI,dX as uI,dY as cI,a7 as fI,dZ as dI,bN as hI,d_ as vI,d$ as pI,bM as gI,b4 as v1,aA as _v,e0 as mI,e1 as yI,E as Jt,x as SI,e2 as bI,e3 as xI,e4 as CI,am as _n,e5 as wI,az as sr,aU as Vs,e6 as TI,as as pr,e7 as II,e8 as Av,cG as yr,by as ah,bI as oh,bJ as _I,bH as Ve,bu as sh,bv as Ev,bx as jt,bB as Ic,bR as di,e9 as Tu,bE as hi,ea as AI,bK as ra,bC as EI,bw as Lt,eb as PI,ec as ui,bO as MI,ed as RI,ee as DI,ef as LI,eg as kI,eh as Jp,ei as OI,bF as qp,cD as _c,cC as BI,ej as Vu,ek as _l}from"./index-BILT_alS.js";/**
 * vue v3.4.34
 * vue v3.4.34
 * (c) 2018-present Yuxi (Evan) You and Vue contributors
 * (c) 2018-present Yuxi (Evan) You and Vue contributors
 * @license MIT
 * @license MIT

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
dist/assets/index-D4efxOZ0.js


+ 1 - 1
dist/assets/index-BvyVkBqV.js → dist/assets/index-D7bfZ_4T.js

@@ -1 +1 @@
-import{u as s,ag as r}from"./index-b1OlXtrI.js";import{a5 as c,cD as n,R as p,ae as t,af as _,al as u,ag as i,bH as l}from"./index-DHK5xtNf.js";const m={class:"pptScreen"},d=c({__name:"pptScreen",setup(f){const a=n(),e=p(!0),o=s();return a.setScreenMode("pptScreen"),o.initPPTData().then(()=>{e.value=!1}),(S,k)=>(t(),_("div",m,[e.value?i("",!0):(t(),u(r,{key:0}))]))}}),g=l(d,[["__scopeId","data-v-678905e9"]]);export{g as default};
+import{u as s,ag as r}from"./index-D33vDR_G.js";import{a5 as c,cD as n,R as p,ae as t,af as _,al as u,ag as i,bH as l}from"./index-BILT_alS.js";const m={class:"pptScreen"},d=c({__name:"pptScreen",setup(f){const a=n(),e=p(!0),o=s();return a.setScreenMode("pptScreen"),o.initPPTData().then(()=>{e.value=!1}),(S,k)=>(t(),_("div",m,[e.value?i("",!0):(t(),u(r,{key:0}))]))}}),g=l(d,[["__scopeId","data-v-678905e9"]]);export{g as default};

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
dist/assets/index-DT_zvQx-.js


Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
dist/assets/index-DZjvOHny.js


+ 1 - 1
dist/assets/index-hxHGd8Cl.js → dist/assets/index-DlWsc8OZ.js

@@ -1 +1 @@
-import{_ as a}from"./404-R0y5dkvZ.js";import{a5 as o,eo as t,ae as r,af as c,bP as _,bQ as d,ak as s,bH as p}from"./index-DHK5xtNf.js";const i=e=>(_("data-v-dda25179"),e=e(),d(),e),n={class:"errorPage"},m=i(()=>s("div",{class:"error"},[s("img",{src:a,class:"img",alt:""}),s("div",{class:"tit"},"页面找不到了~")],-1)),l=[m],f=o({__name:"errorPage",setup(e){return t(),(u,h)=>(r(),c("div",n,l))}}),I=p(f,[["__scopeId","data-v-dda25179"]]);export{I as default};
+import{_ as a}from"./404-R0y5dkvZ.js";import{a5 as o,eo as t,ae as r,af as c,bP as _,bQ as d,ak as s,bH as p}from"./index-BILT_alS.js";const i=e=>(_("data-v-dda25179"),e=e(),d(),e),n={class:"errorPage"},m=i(()=>s("div",{class:"error"},[s("img",{src:a,class:"img",alt:""}),s("div",{class:"tit"},"页面找不到了~")],-1)),l=[m],f=o({__name:"errorPage",setup(e){return t(),(u,h)=>(r(),c("div",n,l))}}),I=p(f,[["__scopeId","data-v-dda25179"]]);export{I as default};

+ 1 - 1
dist/assets/shapes-D6c_7wx8.js → dist/assets/shapes-CTjcKenp.js

@@ -1,4 +1,4 @@
-import{cG as k,bB as $1}from"./index-DHK5xtNf.js";import{ah as Z,ai as H1,aj as U,ak as n0,al as c0,am as i0,an as j1,ao as K1,ap as Y1,aq as R}from"./index-b1OlXtrI.js";var z1={exports:{}};/*!
+import{cG as k,bB as $1}from"./index-BILT_alS.js";import{ah as Z,ai as H1,aj as U,ak as n0,al as c0,am as i0,an as j1,ao as K1,ap as Y1,aq as R}from"./index-D33vDR_G.js";var z1={exports:{}};/*!
  * clipboard.js v2.0.11
  * clipboard.js v2.0.11
  * https://clipboardjs.com/
  * https://clipboardjs.com/
  *
  *

+ 1 - 1
dist/index.html

@@ -10,7 +10,7 @@
     <meta name="description" content="ppt编辑器" />
     <meta name="description" content="ppt编辑器" />
     <meta name="keywords" content="ppt,powerpoint,office powerpoint,在线ppt,幻灯片,演示文稿,ppt在线制作,Vue3,TypeScript" />
     <meta name="keywords" content="ppt,powerpoint,office powerpoint,在线ppt,幻灯片,演示文稿,ppt在线制作,Vue3,TypeScript" />
     <title>PPT</title>
     <title>PPT</title>
-    <script type="module" crossorigin src="./assets/index-DHK5xtNf.js"></script>
+    <script type="module" crossorigin src="./assets/index-BILT_alS.js"></script>
     <link rel="stylesheet" crossorigin href="./assets/index-AavUEaYy.css">
     <link rel="stylesheet" crossorigin href="./assets/index-AavUEaYy.css">
   </head>
   </head>
   <body>
   <body>

+ 17 - 2
scripts/aiPptDialogTest.html

@@ -3,18 +3,20 @@
 <script type="module">
 <script type="module">
 import { createApp, h, ref, nextTick } from "vue"
 import { createApp, h, ref, nextTick } from "vue"
 import { createRouter, createMemoryHistory } from "vue-router"
 import { createRouter, createMemoryHistory } from "vue-router"
-import { store, useSlidesStore } from "/src/store/index.ts"
+import { store, useSlidesStore, useScreenStore } from "/src/store/index.ts"
 import "/src/router/index.ts"
 import "/src/router/index.ts"
 import { httpAxios } from "/src/api/ApiInstance.ts"
 import { httpAxios } from "/src/api/ApiInstance.ts"
 import { setToken } from "/src/libs/auth.ts"
 import { setToken } from "/src/libs/auth.ts"
 import AiDialog from "/src/views/Editor/EditorHeader/AiCoursewareDialog.vue"
 import AiDialog from "/src/views/Editor/EditorHeader/AiCoursewareDialog.vue"
 import Editor from "/src/views/Editor/index.vue"
 import Editor from "/src/views/Editor/index.vue"
+import Screen from "/src/views/Screen/index.vue"
 import usePptWork from "/src/store/pptWork.ts"
 import usePptWork from "/src/store/pptWork.ts"
 import { useSnapshotStore } from "/src/store/index.ts"
 import { useSnapshotStore } from "/src/store/index.ts"
 import { inspectAiPptResources } from "/src/utils/aiPptResources.ts"
 import { inspectAiPptResources } from "/src/utils/aiPptResources.ts"
 import { draftKey, loadAiDraft, saveAiDraft } from "/src/utils/aiCoursewareDraft.ts"
 import { draftKey, loadAiDraft, saveAiDraft } from "/src/utils/aiCoursewareDraft.ts"
 import useAiCoursewarePageRepair from "/src/hooks/useAiCoursewarePageRepair.ts"
 import useAiCoursewarePageRepair from "/src/hooks/useAiCoursewarePageRepair.ts"
 import { aiCoursewareToSlides } from "/src/utils/aiCoursewareToSlides.ts"
 import { aiCoursewareToSlides } from "/src/utils/aiCoursewareToSlides.ts"
+import { liveRegressionFixture } from './fixtures/aiPptLiveRegression.mjs'
 import "/src/assets/styles/global.scss"
 import "/src/assets/styles/global.scss"
 import "/src/assets/styles/elementTheme.scss"
 import "/src/assets/styles/elementTheme.scss"
 import "/src/assets/styles/prosemirror.scss"
 import "/src/assets/styles/prosemirror.scss"
@@ -74,6 +76,10 @@ httpAxios.axioseRquest = async config => {
       data.reviewMessage="声音强弱的练习与评价尚未完整关联"
       data.reviewMessage="声音强弱的练习与评价尚未完整关联"
     }
     }
     if (scenario === 'whole-repair-draft') data.reviewMessage = '第2页:学生画面缺少具体范例;整课一致性复核暂未完成'
     if (scenario === 'whole-repair-draft') data.reviewMessage = '第2页:学生画面缺少具体范例;整课一致性复核暂未完成'
+    if (scenario === 'layout-overflow' && !repaired) {
+      data.outline.pages[1].visualPlan = { layout: 'text_focus', composition: 'steps', visualMode: 'text_only', textPresentation: 'steps' }
+      data.outline.pages[1].studentContent = { headline: '内容过密回归', points: Array.from({ length: 14 }, (_, i) => `第${i + 1}条:` + '保持完整的教材内容,不能用截字方式通过检查。'.repeat(5)) }
+    }
     if (scenario === 'page-repair') {
     if (scenario === 'page-repair') {
       const page = data.outline.pages[submitted.value.regeneratePageNo - 1]
       const page = data.outline.pages[submitted.value.regeneratePageNo - 1]
       page.studentContent = { points: ['重新生成后的课堂任务', '观察图片,说说声音的变化'] }
       page.studentContent = { points: ['重新生成后的课堂任务', '观察图片,说说声音的变化'] }
@@ -102,6 +108,15 @@ const app=createApp({setup(){
   const slidesStore=useSlidesStore()
   const slidesStore=useSlidesStore()
   const pptWork=usePptWork()
   const pptWork=usePptWork()
   const repair = useAiCoursewarePageRepair()
   const repair = useAiCoursewarePageRepair()
+  if (scenario === 'editor-live' || scenario === 'screen-live') {
+    const result = aiCoursewareToSlides(liveRegressionFixture(), { templateId: 'blank' })
+    slidesStore.setViewportSize(1920)
+    slidesStore.setViewportRatio(.5625)
+    slidesStore.setTheme({ ...slidesStore.theme, ...result.theme })
+    slidesStore.setSlides(result.slides)
+    slidesStore.updateSlideIndex(6)
+  }
+  if (scenario === 'screen-live') return () => h('div', { style: 'height:100vh;width:100vw' }, [h(Screen)])
   if (scenario.startsWith('whole-repair')) {
   if (scenario.startsWith('whole-repair')) {
     const fixture = structuredClone(outline)
     const fixture = structuredClone(outline)
     fixture.templateId = 'blank'
     fixture.templateId = 'blank'
@@ -150,7 +165,7 @@ const app=createApp({setup(){
     savedCalls.value ? h("p",{id:"saved-text"},`保存内容:${savedText.value}`):null,
     savedCalls.value ? h("p",{id:"saved-text"},`保存内容:${savedText.value}`):null,
     h("p",{id:"test-status"},`大纲请求:${outlineCalls.value};生成请求次数:${generated.value};完善请求:${repairs.value};保存请求:${savedCalls.value};历史失败任务查询:${historicalPolls.value};已应用页数:${slidesStore.slides.length};资源检查:${resourceCheck.value}`),
     h("p",{id:"test-status"},`大纲请求:${outlineCalls.value};生成请求次数:${generated.value};完善请求:${repairs.value};保存请求:${savedCalls.value};历史失败任务查询:${historicalPolls.value};已应用页数:${slidesStore.slides.length};资源检查:${resourceCheck.value}`),
     submitted.value ? h("p",{id:"submitted-plan"},`模式:${submitted.value.outlineMode};提交的摘要:${submitted.value.outline.pages.map(p=>p.teachingBrief).join("、")};旧正文数量:${submitted.value.outline.pages.filter(p=>p.studentContent?.points?.length || p.bullets?.length).length};页数:${submitted.value.outline.pages.length}`):null,
     submitted.value ? h("p",{id:"submitted-plan"},`模式:${submitted.value.outlineMode};提交的摘要:${submitted.value.outline.pages.map(p=>p.teachingBrief).join("、")};旧正文数量:${submitted.value.outline.pages.filter(p=>p.studentContent?.points?.length || p.bullets?.length).length};页数:${submitted.value.outline.pages.length}`):null,
-    scenario.startsWith("editor") ? h("div",{style:"height:calc(100vh - 65px)"},[h(Editor)]) : h("button",{onClick:()=>{visible.value=true}},"打开AI课件"),
+    scenario.startsWith("editor") ? h("div",{style:"height:calc(100vh - 65px)"},[h(useScreenStore().screening ? Screen : Editor)]) : h("button",{onClick:()=>{visible.value=true}},"打开AI课件"),
     scenario.startsWith("editor") ? null : h(AiDialog,{visible:visible.value,"onUpdate:visible":value=>{visible.value=value}}),
     scenario.startsWith("editor") ? null : h(AiDialog,{visible:visible.value,"onUpdate:visible":value=>{visible.value=value}}),
     h("button",{onClick:()=>useSnapshotStore().unDo()},"测试撤销")
     h("button",{onClick:()=>useSnapshotStore().unDo()},"测试撤销")
   ])
   ])

+ 24 - 0
scripts/aiPptSelfTest.mjs

@@ -8,6 +8,7 @@ import { modelDesignFixture } from "./fixtures/aiPptModelDesign.mjs"
 import { inquiryFixture } from './fixtures/aiPptInquiry.mjs'
 import { inquiryFixture } from './fixtures/aiPptInquiry.mjs'
 import { lessonRepairFixture } from './fixtures/aiPptLessonRepair.mjs'
 import { lessonRepairFixture } from './fixtures/aiPptLessonRepair.mjs'
 import { contentGateFixture } from './fixtures/aiPptContentGate.mjs'
 import { contentGateFixture } from './fixtures/aiPptContentGate.mjs'
+import { liveRegressionFixture } from './fixtures/aiPptLiveRegression.mjs'
 
 
 const vite = await createServer({ server: { middlewareMode: true }, appType: "custom", logLevel: "error" })
 const vite = await createServer({ server: { middlewareMode: true }, appType: "custom", logLevel: "error" })
 
 
@@ -16,8 +17,31 @@ try {
   const { inspectAiPptQuality } = await vite.ssrLoadModule("/src/utils/aiPptQuality.ts")
   const { inspectAiPptQuality } = await vite.ssrLoadModule("/src/utils/aiPptQuality.ts")
   const gateFixture = contentGateFixture(), gateSlides = aiCoursewareToSlides(gateFixture).slides
   const gateFixture = contentGateFixture(), gateSlides = aiCoursewareToSlides(gateFixture).slides
   const layoutCodes = ['out_of_bounds', 'text_overlap', 'text_overflow', 'rendered_text_geometry', 'missing_content', 'small_font']
   const layoutCodes = ['out_of_bounds', 'text_overlap', 'text_overflow', 'rendered_text_geometry', 'missing_content', 'small_font']
+  const live = liveRegressionFixture(), liveSlides = aiCoursewareToSlides(live).slides
+  assert.deepEqual(inspectAiPptQuality(live, liveSlides).errors.filter(issue => layoutCodes.includes(issue.code)), [], '真实长文本不得重叠或丢失')
+  assert(liveSlides[9].remark.includes(live.pages[9].studentContent.example), '教师示范完整保留在备注')
+  const liveText = slide => slide.elements.filter(e => e.type === 'text').map(e => e.content.replace(/<[^>]*>/g, '')).join('\n')
+  assert(liveText(liveSlides[6]).includes(live.pages[6].studentContent.example), '真实长对话范例逐字保留')
+  assert(!liveText(liveSlides[7]).includes('老虎吼(强)'), '听辨画面不能提前显示声源答案')
+  assert(liveSlides[7].remark.includes('老虎吼(强)'), '移出的声源标注保留到教师备注')
+  assert(liveSlides.every(slide => slide.elements.every(e => e.type === 'line' || e.width > 0 && e.height > 0)), '不得生成负高度或零尺寸')
+  const liveImage = liveSlides[0].elements.find(e => e.type === 'image')
+  assert(liveImage.width * liveImage.height / (1920 * 1080) >= .3, '封面主体保留足够观察面积')
+  assert(Math.abs(liveImage.width / liveImage.height - 1.38) < .001, '教材图保持完整比例')
   assert.deepEqual(inspectAiPptQuality(gateFixture, gateSlides).errors.filter(issue => layoutCodes.includes(issue.code)), [], '线上结构回归应完整可读')
   assert.deepEqual(inspectAiPptQuality(gateFixture, gateSlides).errors.filter(issue => layoutCodes.includes(issue.code)), [], '线上结构回归应完整可读')
   const dots = slide => slide.elements.filter(element => element.type === 'shape' && element.path === 'M100,0 A100,100 0 1,1 99.99,0 Z')
   const dots = slide => slide.elements.filter(element => element.type === 'shape' && element.path === 'M100,0 A100,100 0 1,1 99.99,0 Z')
+  assert.equal(dots(liveSlides[10]).length, 2, '混合概念图只为强弱绘制圆形,长短画条形')
+  const bars = liveSlides[10].elements.filter(e => e.type === 'shape' && !dots(liveSlides[10]).includes(e))
+  assert.equal(bars.length, 2)
+  assert(bars[0].width > bars[1].width, '长条必须比短条长')
+  const { assessmentAnnotationTexts } = await vite.ssrLoadModule('/src/utils/aiPptContent.ts')
+  const labelChoice = structuredClone(live.pages[7])
+  labelChoice.interaction.question = '哪组强弱标注正确?'
+  assert.deepEqual(assessmentAnnotationTexts(labelChoice), [], '辨析标注的选择题不得误删候选项')
+  const { blockingAiPptLayoutIssues } = await vite.ssrLoadModule('/src/utils/aiPptQuality.ts')
+  const damaged = structuredClone(liveSlides)
+  damaged[6].elements.filter(e => e.type === 'text').slice(-2).forEach(e => { e.top = 450 })
+  assert(blockingAiPptLayoutIssues(inspectAiPptQuality(live, damaged)).some(issue => issue.pageNo === 7), '重叠页必须阻止写入编辑器')
   assert.equal(dots(gateSlides[2]).length, 4, '一拍一声:四拍四个发声点')
   assert.equal(dots(gateSlides[2]).length, 4, '一拍一声:四拍四个发声点')
   assert.equal(dots(gateSlides[3]).length, 8, '一拍两声:四拍八个发声点')
   assert.equal(dots(gateSlides[3]).length, 8, '一拍两声:四拍八个发声点')
   const cells = slide => slide.elements.filter(element => element.type === 'shape' && element.width > 200 && element.height > 80 && element.height < 200)
   const cells = slide => slide.elements.filter(element => element.type === 'shape' && element.width > 200 && element.height > 80 && element.height < 200)

+ 2 - 1
scripts/aiPptVisualTest.html

@@ -17,6 +17,7 @@
       import { createApp, h, ref, nextTick, watch } from "vue"
       import { createApp, h, ref, nextTick, watch } from "vue"
       import { lessonRepairFixture } from './fixtures/aiPptLessonRepair.mjs'
       import { lessonRepairFixture } from './fixtures/aiPptLessonRepair.mjs'
       import { contentGateFixture } from './fixtures/aiPptContentGate.mjs'
       import { contentGateFixture } from './fixtures/aiPptContentGate.mjs'
+      import { liveRegressionFixture } from './fixtures/aiPptLiveRegression.mjs'
       import { createPinia, setActivePinia } from "pinia"
       import { createPinia, setActivePinia } from "pinia"
       import ThumbnailSlide from "/src/views/components/ThumbnailSlide/index.vue"
       import ThumbnailSlide from "/src/views/components/ThumbnailSlide/index.vue"
       import { aiCoursewareToSlides } from "/src/utils/aiCoursewareToSlides.ts"
       import { aiCoursewareToSlides } from "/src/utils/aiCoursewareToSlides.ts"
@@ -48,7 +49,7 @@
       }
       }
       const scenario = new URLSearchParams(location.search).get("scenario")
       const scenario = new URLSearchParams(location.search).get("scenario")
       const fixtureImage = '/ai-courseware-templates/extracted/bird-garden/background-01.jpg'
       const fixtureImage = '/ai-courseware-templates/extracted/bird-garden/background-01.jpg'
-      const fixture = scenario === 'content-gate' ? contentGateFixture() : scenario === 'repair' ? lessonRepairFixture(fixtureImage) : scenario === 'inquiry' ? inquiryFixture() : scenario === 'hero-images' ? heroImageRegressionFixture(fixtureImage) : scenario === 'density' ? densityRegressionFixture(fixtureImage) : scenario === 'semantic' ? semanticDesignFixture(fixtureImage) : scenario === 'model-design' ? modelDesignFixture(fixtureImage)
+      const fixture = scenario === 'live' ? liveRegressionFixture() : scenario === 'content-gate' ? contentGateFixture() : scenario === 'repair' ? lessonRepairFixture(fixtureImage) : scenario === 'inquiry' ? inquiryFixture() : scenario === 'hero-images' ? heroImageRegressionFixture(fixtureImage) : scenario === 'density' ? densityRegressionFixture(fixtureImage) : scenario === 'semantic' ? semanticDesignFixture(fixtureImage) : scenario === 'model-design' ? modelDesignFixture(fixtureImage)
         : scenario === 'classroom' ? classroomFixture(fixtureImage) : outline
         : scenario === 'classroom' ? classroomFixture(fixtureImage) : outline
       const result = aiCoursewareToSlides(fixture, { templateId: id })
       const result = aiCoursewareToSlides(fixture, { templateId: id })
       const group = ref(0)
       const group = ref(0)

+ 2 - 1
src/hooks/useAiCoursewarePageRepair.ts

@@ -9,7 +9,7 @@ import { assertAiPptClientCurrent } from "@/utils/aiPptClientVersion"
 import { aiCoursewareToSlides } from "@/utils/aiCoursewareToSlides"
 import { aiCoursewareToSlides } from "@/utils/aiCoursewareToSlides"
 import { getAiPptImageAspectRatios } from "@/utils/aiPptTemplateEngine"
 import { getAiPptImageAspectRatios } from "@/utils/aiPptTemplateEngine"
 import { DEFAULT_AI_COURSEWARE_TEMPLATE_ID } from "@/config/aiCoursewareTemplates"
 import { DEFAULT_AI_COURSEWARE_TEMPLATE_ID } from "@/config/aiCoursewareTemplates"
-import { inspectAiPptQuality, type AiPptQualityIssue } from "@/utils/aiPptQuality"
+import { inspectAiPptQuality, blockingAiPptLayoutIssues, type AiPptQualityIssue } from "@/utils/aiPptQuality"
 import { inspectAiPptResources } from "@/utils/aiPptResources"
 import { inspectAiPptResources } from "@/utils/aiPptResources"
 import { teachingReviewIssues } from '@/utils/aiPptFeedback'
 import { teachingReviewIssues } from '@/utils/aiPptFeedback'
 
 
@@ -93,6 +93,7 @@ export default function useAiCoursewarePageRepair() {
       const converted = aiCoursewareToSlides(nextOutline, { templateId, enableAnimations: prefs.enableAnimations })
       const converted = aiCoursewareToSlides(nextOutline, { templateId, enableAnimations: prefs.enableAnimations })
       const target = converted.slides[pageNo - 1]
       const target = converted.slides[pageNo - 1]
       const report = inspectAiPptQuality(nextOutline, converted.slides, { ...prefs, minPages: nextOutline.pages.length, maxPages: nextOutline.pages.length })
       const report = inspectAiPptQuality(nextOutline, converted.slides, { ...prefs, minPages: nextOutline.pages.length, maxPages: nextOutline.pages.length })
+      if (blockingAiPptLayoutIssues(report).some(issue => whole || issue.pageNo === pageNo)) throw new Error('生成页的文字仍然过密,已保留当前课件,请再次精简后生成。')
       const resourceIssues = await inspectAiPptResources(whole ? nextOutline : { ...nextOutline, pages: [nextOutline.pages[pageNo - 1]] }, whole ? converted.slides : [target])
       const resourceIssues = await inspectAiPptResources(whole ? nextOutline : { ...nextOutline, pages: [nextOutline.pages[pageNo - 1]] }, whole ? converted.slides : [target])
       if (!active()) return
       if (!active()) return
       const unchanged = () => whole ? JSON.stringify(slides.slides) === before : JSON.stringify(slides.slides.find(slide => slide.id === slideId)) === before
       const unchanged = () => whole ? JSON.stringify(slides.slides) === before : JSON.stringify(slides.slides.find(slide => slide.id === slideId)) === before

+ 14 - 4
src/utils/aiPptContent.ts

@@ -12,13 +12,22 @@ export const needsAudio = (page: AiCoursewarePage) => /listen|phrase_sing|expres
   (page.resourceBindings || []).some(item => item.required && item.resourceType === "SONG")
   (page.resourceBindings || []).some(item => item.required && item.resourceType === "SONG")
 
 
 // 只识别明确的教案表述,保留“观察图片”“跟老师唱”等有效学生指令。
 // 只识别明确的教案表述,保留“观察图片”“跟老师唱”等有效学生指令。
-export const isTeacherFacingText = (text?: string) => /(?:教师|老师)(?:讲述|提问|引导|指导|组织|巡视|示范)|(?:引导|指导|组织)学生|(?:激发|产生|建立)(?:学生)?(?:兴趣|期待|好奇)|(?:展示|评价|检查)(?:学生)?掌握情况|学习表现[::]|复述课后任务要求|回顾并口头总结本课所学/.test(text || "")
+export const isTeacherFacingText = (text?: string) => /(?:教师|老师)(?:讲述|提问|引导|指导|组织|巡视|示范)|^(?:例子[::])?(?:教师|老师)(?:指向|指挥|依次|先播放|先敲|举起)|(?:引导|指导|组织)学生|(?:激发|产生|建立)(?:学生)?(?:兴趣|期待|好奇)|(?:展示|评价|检查)(?:学生)?掌握情况|学习表现[::]|复述课后任务要求|回顾并口头总结本课所学/.test(text || "")
 
 
 export function teacherFacingTexts(page: AiCoursewarePage): string[] {
 export function teacherFacingTexts(page: AiCoursewarePage): string[] {
   return [page.studentContent?.headline, page.studentContent?.example, page.classroomAction?.studentTask, page.subtitle,
   return [page.studentContent?.headline, page.studentContent?.example, page.classroomAction?.studentTask, page.subtitle,
     ...(page.studentContent?.points || []), ...(page.studentContent?.steps || []),
     ...(page.studentContent?.points || []), ...(page.studentContent?.steps || []),
     ...(page.studentContent?.comparisonGroups || []).flatMap(group => [group.label, ...(group.points || [])]), ...(page.bullets || [])]
     ...(page.studentContent?.comparisonGroups || []).flatMap(group => [group.label, ...(group.points || [])]), ...(page.bullets || [])]
-    .filter((text): text is string => Boolean(text) && isTeacherFacingText(text))
+    .filter((text): text is string => Boolean(text) && isTeacherFacingText(text)).concat(assessmentAnnotationTexts(page))
+}
+
+/** 听辨题把声源的强弱/长短标在答案旁会泄题;辨析标注本身的选择题除外。 */
+export function assessmentAnnotationTexts(page: AiCoursewarePage): string[] {
+  if (page.type !== 'practice_check') return []
+  const question = page.interaction?.question || page.studentContent?.headline || ''
+  if (!/(?:哪个|哪次|哪一|谁|强弱|长短|高低)/.test(question) || /(?:哪组|哪项|标注|标记|对应关系|匹配|正误)/.test(question)) return []
+  return [...(page.studentContent?.points || []), ...(page.interaction?.options || [])]
+    .filter(text => /(?:声|吼|鸣|次|遍|段)[((](?:强|弱|长|短|高|低)(?:[、,,](?:强|弱|长|短|高|低))*[))]/.test(text))
 }
 }
 
 
 export function studentTexts(page: AiCoursewarePage): string[] {
 export function studentTexts(page: AiCoursewarePage): string[] {
@@ -28,7 +37,7 @@ export function studentTexts(page: AiCoursewarePage): string[] {
     ...(page.studentContent?.steps || []),
     ...(page.studentContent?.steps || []),
     ...(page.studentContent?.comparisonGroups || []).flatMap(group => [group.label, ...(group.points || [])]),
     ...(page.studentContent?.comparisonGroups || []).flatMap(group => [group.label, ...(group.points || [])]),
     page.interaction?.question, ...(page.interaction?.options || [])]
     page.interaction?.question, ...(page.interaction?.options || [])]
-    .map(text => String(text || "").trim()).filter(text => Boolean(text) && !isTeacherFacingText(text))
+    .map(text => String(text || "").trim()).filter(text => Boolean(text) && !isTeacherFacingText(text) && !assessmentAnnotationTexts(page).includes(text))
 }
 }
 
 
 const textKey = (text: string) => text.replace(/[\s,。!?、;:,.!?;:]+/g, '')
 const textKey = (text: string) => text.replace(/[\s,。!?、;:,.!?;:]+/g, '')
@@ -64,7 +73,8 @@ export function modelPageContent(page: AiCoursewarePage) {
     groups = []
     groups = []
   }
   }
   const grouped = groups.flatMap(group => [group.label, ...group.points]).map(textKey)
   const grouped = groups.flatMap(group => [group.label, ...group.points]).map(textKey)
-  const points = distinct([...body.filter(text => !grouped.includes(textKey(text)) && !steps.some(step => textKey(step) === textKey(text))), ...(page.interaction?.options || [])])
+  const answers = assessmentAnnotationTexts(page)
+  const points = distinct([...body.filter(text => !grouped.includes(textKey(text)) && !steps.some(step => textKey(step) === textKey(text))), ...(page.interaction?.options || [])]).filter(text => !answers.includes(text))
   const secondary = distinct([task])
   const secondary = distinct([task])
     .filter(text => textKey(text) !== textKey(heading)).join(' · ')
     .filter(text => textKey(text) !== textKey(heading)).join(' · ')
   return { heading, task: secondary, points: groups.length ? distinct([...points, ...steps]) : points, steps, groups }
   return { heading, task: secondary, points: groups.length ? distinct([...points, ...steps]) : points, steps, groups }

+ 15 - 10
src/utils/aiPptPageDesign.ts

@@ -50,6 +50,7 @@ export function compilePageDesign(page: AiCoursewarePage, index: number, master:
   if (hasVisual) {
   if (hasVisual) {
     if (preferSide || ['image_left', 'image_right', 'concept_grid', 'focus_question'].includes(composition)) {
     if (preferSide || ['image_left', 'image_right', 'concept_grid', 'focus_question'].includes(composition)) {
       let imageWidth = (1440 - 36) * share
       let imageWidth = (1440 - 36) * share
+      if ([...content.points, ...content.steps].some(text => text.length > 50)) imageWidth = Math.min(imageWidth, (1440 - 36) * .35)
       // 文字较多时逐步让出横向空间,不把正文压成狭长小字。
       // 文字较多时逐步让出横向空间,不把正文压成狭长小字。
       while (imageWidth > (1440 - 36) * .35 && bodyHeight(1440 - imageWidth - 36) > height) imageWidth = Math.max((1440 - 36) * .35, imageWidth - 70)
       while (imageWidth > (1440 - 36) * .35 && bodyHeight(1440 - imageWidth - 36) > height) imageWidth = Math.max((1440 - 36) * .35, imageWidth - 70)
       const bodyWidth = 1440 - imageWidth - 36
       const bodyWidth = 1440 - imageWidth - 36
@@ -95,21 +96,25 @@ export function compilePageDesign(page: AiCoursewarePage, index: number, master:
       else if (item.id === 'body') { item.top = content.task ? 625 : 550; item.height = 180 }
       else if (item.id === 'body') { item.top = content.task ? 625 : 550; item.height = 180 }
     }
     }
   }
   }
-  if (cover && hasVisual && !showMedia && !content.task && page.title.length <= 20 && content.heading.length <= 30
-    && content.points.length <= 2 && ['image_left', 'image_right'].includes(composition)) {
+  if (cover && hasVisual && !showMedia && page.title.length <= 20 && content.heading.length <= 30
+    && !content.steps.length && !content.groups.length && content.points.length <= 2 && ['image_left', 'image_right', 'full_scene', 'image_top'].includes(composition)) {
     // 封面采用真正的海报式图文分区,让课题与主角都成为视觉焦点。
     // 封面采用真正的海报式图文分区,让课题与主角都成为视觉焦点。
-    const textLeft = composition === 'image_right' ? 80 : 900
+    const textLeft = composition === 'image_right' ? 80 : 980
     const image = slots.find(item => item.id === 'image')
     const image = slots.find(item => item.id === 'image')
-    if (image) Object.assign(image, { left: composition === 'image_right' ? 780 : 80, top: 90, width: 740, height: 720 })
-    let cursor = 170
+    const poster = slots.map(item => ({ ...item }))
+    let cursor = 120
     for (const id of ['title', 'meta', 'headline', 'instruction', 'body']) {
     for (const id of ['title', 'meta', 'headline', 'instruction', 'body']) {
-      const item = slots.find(entry => entry.id === id)
+      const item = poster.find(entry => entry.id === id)
       if (!item) continue
       if (!item) continue
       const value = id === 'title' ? page.title : id === 'headline' ? content.heading : id === 'instruction' ? content.task : ''
       const value = id === 'title' ? page.title : id === 'headline' ? content.heading : id === 'instruction' ? content.task : ''
-      const font = id === 'title' ? 68 : id === 'headline' ? 36 : 28
-      const height = id === 'body' ? Math.max(80, 820 - cursor) : id === 'meta' ? 100 : Math.max(60, measureAiPptText(value, 620, font, 1.25, id === 'title'))
-      Object.assign(item, { left: textLeft, top: cursor, width: 620, height, preferredFontSize: font, textFlow: undefined })
-      cursor += height + 26
+      const font = id === 'title' ? 58 : id === 'meta' ? 28 : 34
+      const height = id === 'body' ? aiPptBlockHeight(content.points, 540, 'plain', font) : id === 'meta' ? 132 : Math.max(60, measureAiPptText(value, 540, font, 1.2, id === 'title' || id === 'headline'))
+      Object.assign(item, { left: textLeft, top: cursor, width: 540, height, preferredFontSize: font, textFlow: undefined })
+      cursor += height + 24
+    }
+    if (cursor <= 854) {
+      poster.forEach(item => Object.assign(slots.find(entry => entry.id === item.id)!, item))
+      if (image) Object.assign(image, { left: composition === 'image_right' ? 660 : 80, top: 90, width: 860, height: 720 })
     }
     }
   }
   }
   const sparseText = plan.visualMode === 'text_only' && presentation === 'plain' && !page.diagram
   const sparseText = plan.visualMode === 'text_only' && presentation === 'plain' && !page.diagram

+ 6 - 0
src/utils/aiPptQuality.ts

@@ -10,6 +10,10 @@ import { imagePreparationMessage } from '@/utils/aiPptFeedback'
 
 
 type BoundedPPTElement = Exclude<PPTElement, { type: "line" }>
 type BoundedPPTElement = Exclude<PPTElement, { type: "line" }>
 
 
+export function blockingAiPptLayoutIssues(report: AiPptQualityReport) {
+  return report.errors.filter(issue => ['out_of_bounds', 'text_overlap', 'text_overflow', 'rendered_text_geometry'].includes(issue.code))
+}
+
 export type AiPptQualitySeverity = "error" | "warning"
 export type AiPptQualitySeverity = "error" | "warning"
 
 
 export interface AiPptQualityIssue {
 export interface AiPptQualityIssue {
@@ -200,6 +204,8 @@ function inspectSlides(slides: Slide[], issues: AiPptQualityIssue[], preferences
         element.left < 0 ||
         element.left < 0 ||
         element.top < 0 ||
         element.top < 0 ||
         element.left + element.width > SLIDE_WIDTH + 1 ||
         element.left + element.width > SLIDE_WIDTH + 1 ||
+        !Number.isFinite(element.left + element.top + element.width) ||
+        (element.type !== 'line' && (!Number.isFinite(element.height) || element.width <= 0 || element.height <= 0)) ||
         (element.type !== "line" && element.top + element.height > SLIDE_HEIGHT + 1)
         (element.type !== "line" && element.top + element.height > SLIDE_HEIGHT + 1)
       ) {
       ) {
         push(issues, "out_of_bounds", "error", pageNo, "存在超出画布的元素")
         push(issues, "out_of_bounds", "error", pageNo, "存在超出画布的元素")

+ 61 - 11
src/utils/aiPptTemplateEngine.ts

@@ -173,6 +173,7 @@ export function getAiPptImageAspectRatios(templateId: AiCoursewareTemplateId): R
   ratios.model_design_v3 = 1 // 完整示范、判断标准及结构化教学图示。
   ratios.model_design_v3 = 1 // 完整示范、判断标准及结构化教学图示。
   ratios.model_design_v4 = 1 // 整课一致性复核与内容驱动的图片尺寸。
   ratios.model_design_v4 = 1 // 整课一致性复核与内容驱动的图片尺寸。
   ratios.model_design_v5 = 1 // 按拍分组、学生范例和内容复核完成状态。
   ratios.model_design_v5 = 1 // 按拍分组、学生范例和内容复核完成状态。
+  ratios.model_design_v6 = 1 // 学生文字预算、去重及混合声音属性检查。
   return ratios
   return ratios
 }
 }
 
 
@@ -188,13 +189,19 @@ function fillDesignedPage(master: TemplateMaster, layout: TemplateMasterPage, pa
   const composition = page.visualPlan!.composition
   const composition = page.visualPlan!.composition
   const presentation = page.visualPlan!.textPresentation || 'plain'
   const presentation = page.visualPlan!.textPresentation || 'plain'
   const paintText = (slot: TemplateSlot | undefined, values: string[], format = presentation) => {
   const paintText = (slot: TemplateSlot | undefined, values: string[], format = presentation) => {
+    if (!slot || !values.length) return
     if (slot?.textFlow === 'columns' && values.length) {
     if (slot?.textFlow === 'columns' && values.length) {
       const width = (slot.width - 28 * (values.length - 1)) / values.length
       const width = (slot.width - 28 * (values.length - 1)) / values.length
       for (let index = 0; index < values.length; index++) addSlotText(elements, { ...slot, left: slot.left + index * (width + 28), width,
       for (let index = 0; index < values.length; index++) addSlotText(elements, { ...slot, left: slot.left + index * (width + 28), width,
         preferredFontSize: 38 }, values[index], master.textColor)
         preferredFontSize: 38 }, values[index], master.textColor)
       return
       return
     }
     }
-    if (slot) slot = compactTextSlot(slot, values, format)
+    // 卡片放不下时改成按文字高度排布的列表,不再把最小字号塞进过小的卡片。
+    if (aiPptBlockHeight(values, slot.width, format) > slot.height || format === 'plain') {
+      addMeasuredFlow(elements, slot, values, master.textColor, format === 'steps')
+      return
+    }
+    slot = compactTextSlot(slot, values, format)
     if (format === 'steps') addStepGrid(elements, slot, values, master, palette)
     if (format === 'steps') addStepGrid(elements, slot, values, master, palette)
     else if (format === 'grid') addCardGrid(elements, slot, values, master, palette)
     else if (format === 'grid') addCardGrid(elements, slot, values, master, palette)
     else if (format === 'cards' && values.length === 4 && slot && slot.width >= 1000) addCardGrid(elements, slot, values, master, palette, 2)
     else if (format === 'cards' && values.length === 4 && slot && slot.width >= 1000) addCardGrid(elements, slot, values, master, palette, 2)
@@ -205,9 +212,29 @@ function fillDesignedPage(master: TemplateMaster, layout: TemplateMasterPage, pa
   const paintBody = (slot: TemplateSlot) => {
   const paintBody = (slot: TemplateSlot) => {
     if (!content.steps.length || !points.length) { paintText(slot, [...content.steps, ...points]); return }
     if (!content.steps.length || !points.length) { paintText(slot, [...content.steps, ...points]); return }
     const pointsHeight = aiPptBlockHeight(points, slot.width, 'plain')
     const pointsHeight = aiPptBlockHeight(points, slot.width, 'plain')
-    const stepsHeight = Math.min(aiPptBlockHeight(content.steps, slot.width, presentation), slot.height - pointsHeight - 24)
-    paintText({ ...slot, height: stepsHeight }, content.steps)
-    paintText({ ...slot, top: slot.top + stepsHeight + 24, height: slot.height - stepsHeight - 24 }, points, 'plain')
+    const stepsHeight = aiPptBlockHeight(content.steps, slot.width, presentation)
+    if (stepsHeight + pointsHeight + 24 <= slot.height) {
+      paintText({ ...slot, height: stepsHeight }, content.steps)
+      paintText({ ...slot, top: slot.top + stepsHeight + 24, height: pointsHeight }, points, 'plain')
+      return
+    }
+    // 长步骤与分工并列,完整范例占底部一行;同一次测量同时决定坐标和字号。
+    const examples = points.filter(text => text.startsWith('例子:'))
+    const details = points.filter(text => !text.startsWith('例子:'))
+    const leftWidth = (slot.width - 40) * .55, rightWidth = slot.width - leftWidth - 40
+    if (details.length && leftWidth >= 400 && rightWidth >= 360) {
+      for (const font of [38, 36, 34, 32, 30, 28]) {
+        const exampleHeight = flowHeight(examples, slot.width, font)
+        const available = slot.height - exampleHeight - (examples.length ? 24 : 0)
+        if (Math.max(flowHeight(content.steps, leftWidth, font, true), flowHeight(details, rightWidth, font)) > available) continue
+        addMeasuredFlow(elements, { ...slot, width: leftWidth, height: available }, content.steps, master.textColor, true, font)
+        addMeasuredFlow(elements, { ...slot, left: slot.left + leftWidth + 40, width: rightWidth, height: available }, details, master.textColor, false, font)
+        if (examples.length) addMeasuredFlow(elements, { ...slot, top: slot.top + available + 24, height: exampleHeight }, examples, master.textColor, false, font)
+        return
+      }
+    }
+    // 最后使用全宽短行;绝不截字。容量仍不足时,最终几何检查拒绝写入编辑器。
+    addMeasuredFlow(elements, slot, [...content.steps.map((text, i) => `${i + 1}. ${text}`), ...points], master.textColor)
   }
   }
   const focusBody = slotOf(layout, 'body')
   const focusBody = slotOf(layout, 'body')
   if (composition === 'focus_question' && page.interaction?.options?.length && !hasImage(page)
   if (composition === 'focus_question' && page.interaction?.options?.length && !hasImage(page)
@@ -269,6 +296,23 @@ function fillDesignedPage(master: TemplateMaster, layout: TemplateMasterPage, pa
   return elements
   return elements
 }
 }
 
 
+function flowHeight(values: string[], width: number, font: number, numbered = false) {
+  return values.reduce((sum, text, i) => sum + measureAiPptText(numbered ? `${i + 1}. ${text}` : text, width, font), 0)
+    + Math.max(0, values.length - 1) * 16
+}
+
+function addMeasuredFlow(elements: PPTElement[], slot: TemplateSlot, values: string[], color: string, numbered = false, preferred = 38) {
+  const font = Array.from({ length: Math.max(1, Math.floor((preferred - 28) / 2) + 1) }, (_, i) => preferred - i * 2)
+    .find(size => flowHeight(values, slot.width, size, numbered) <= slot.height) || 28
+  let top = slot.top
+  values.forEach((value, i) => {
+    const text = numbered ? `${i + 1}. ${value}` : value
+    const height = measureAiPptText(text, slot.width, font)
+    elements.push(textElement({ left: slot.left, top, width: slot.width, height, content: text, fontSize: font, minimumFontSize: font, color }))
+    top += height + 16
+  })
+}
+
 export function validTeachingDiagram(diagram: NonNullable<AiCoursewarePage['diagram']>) {
 export function validTeachingDiagram(diagram: NonNullable<AiCoursewarePage['diagram']>) {
   return ['beats', 'rhythm', 'duration', 'pitch', 'sequence'].includes(diagram.kind) && Array.isArray(diagram.items) && diagram.items.length >= 2 && diagram.items.length <= 6
   return ['beats', 'rhythm', 'duration', 'pitch', 'sequence'].includes(diagram.kind) && Array.isArray(diagram.items) && diagram.items.length >= 2 && diagram.items.length <= 6
     && diagram.items.every(item => item?.label?.trim() && item.label.length <= 12)
     && diagram.items.every(item => item?.label?.trim() && item.label.length <= 12)
@@ -285,13 +329,18 @@ function addTeachingDiagram(elements: PPTElement[], slot: TemplateSlot, diagram:
   const min = Math.min(...diagram.items.map(item => item.value || 1))
   const min = Math.min(...diagram.items.map(item => item.value || 1))
   const column = (slot.width - gap * (count - 1)) / count
   const column = (slot.width - gap * (count - 1)) / count
   const shapeHeight = Math.min(150, area.height - 80)
   const shapeHeight = Math.min(150, area.height - 80)
+  const labels = diagram.items.map(item => item.label)
+  // 兼容已生成的混合概念图:强弱用大小,长短用长度;不同属性不能共用圆面积或数值比例。
+  const mixedSoundConcepts = labels.every(label => ['强', '弱', '长', '短'].includes(label))
+    && labels.some(label => ['强', '弱'].includes(label)) && labels.some(label => ['长', '短'].includes(label))
   let left = slot.left
   let left = slot.left
   diagram.items.forEach((item, index) => {
   diagram.items.forEach((item, index) => {
-    const width = diagram.kind === 'duration' ? (slot.width - gap * (count - 1)) * item.value! / total : column
-    const size = diagram.kind === 'beats' ? Math.min(width - 24, shapeHeight) * Math.sqrt(item.value! / max) : shapeHeight
+    const kind = mixedSoundConcepts ? ['强', '弱'].includes(item.label) ? 'beats' : 'duration' : diagram.kind
+    const width = !mixedSoundConcepts && kind === 'duration' ? (slot.width - gap * (count - 1)) * item.value! / total : column
+    const size = kind === 'beats' ? Math.min(width - 24, shapeHeight) * (mixedSoundConcepts ? item.label === '强' ? 1 : .5 : Math.sqrt(item.value! / max)) : shapeHeight
     const top = area.top + Math.max(0, (area.height - shapeHeight - 68) / 2)
     const top = area.top + Math.max(0, (area.height - shapeHeight - 68) / 2)
     const color = index % 2 ? palette.secondary : palette.primary
     const color = index % 2 ? palette.secondary : palette.primary
-    if (diagram.kind === 'rhythm') {
+    if (kind === 'rhythm') {
       // 每个等宽格是一拍;圆点数只表示该拍内的发声次数,不用大小或颜色暗示强弱。
       // 每个等宽格是一拍;圆点数只表示该拍内的发声次数,不用大小或颜色暗示强弱。
       const sounds = item.value!, dotSize = Math.min(54, (width - 32) / (sounds * 1.5), shapeHeight - 18)
       const sounds = item.value!, dotSize = Math.min(54, (width - 32) / (sounds * 1.5), shapeHeight - 18)
       elements.push(shapeElement({ left, top, width, height: shapeHeight, fill: palette.soft, radius: 10 }))
       elements.push(shapeElement({ left, top, width, height: shapeHeight, fill: palette.soft, radius: 10 }))
@@ -301,18 +350,19 @@ function addTeachingDiagram(elements: PPTElement[], slot: TemplateSlot, diagram:
         circle.path = 'M100,0 A100,100 0 1,1 99.99,0 Z'
         circle.path = 'M100,0 A100,100 0 1,1 99.99,0 Z'
         elements.push(circle)
         elements.push(circle)
       }
       }
-    } else if (diagram.kind === 'pitch') {
+    } else if (kind === 'pitch') {
       const y = area.top + 28 + (max - item.value!) / Math.max(1, max - min) * Math.max(0, area.height - 146)
       const y = area.top + 28 + (max - item.value!) / Math.max(1, max - min) * Math.max(0, area.height - 146)
       elements.push(shapeElement({ left, top: y, width, height: 10, fill: color }))
       elements.push(shapeElement({ left, top: y, width, height: 10, fill: color }))
       addSlotText(elements, { ...slot, left, top: y + 16, width, height: 64, preferredFontSize: 40 }, item.label, master.textColor, true, 'center')
       addSlotText(elements, { ...slot, left, top: y + 16, width, height: 64, preferredFontSize: 40 }, item.label, master.textColor, true, 'center')
       left += width + gap
       left += width + gap
       return
       return
-    } else if (diagram.kind === 'beats') {
+    } else if (kind === 'beats') {
       const circle = shapeElement({ left: left + (width - size) / 2, top: top + (shapeHeight - size) / 2, width: size, height: size, fill: color })
       const circle = shapeElement({ left: left + (width - size) / 2, top: top + (shapeHeight - size) / 2, width: size, height: size, fill: color })
       circle.path = 'M100,0 A100,100 0 1,1 99.99,0 Z'
       circle.path = 'M100,0 A100,100 0 1,1 99.99,0 Z'
       elements.push(circle)
       elements.push(circle)
-    } else if (diagram.kind === 'duration') {
-      elements.push(shapeElement({ left, top: top + shapeHeight * .25, width, height: shapeHeight * .5, fill: color, radius: 8 }))
+    } else if (kind === 'duration') {
+      const barWidth = mixedSoundConcepts ? width * (item.label === '长' ? .95 : .4) : width
+      elements.push(shapeElement({ left: left + (width - barWidth) / 2, top: top + shapeHeight * .25, width: barWidth, height: shapeHeight * .5, fill: color, radius: 8 }))
     } else {
     } else {
       elements.push(lineElement(left, top + shapeHeight / 2, left + width, top + shapeHeight / 2, palette.secondary, 4))
       elements.push(lineElement(left, top + shapeHeight / 2, left + width, top + shapeHeight / 2, palette.secondary, 4))
       addSlotText(elements, { ...slot, left, top, width, height: 65, preferredFontSize: 44 }, String(index + 1).padStart(2, '0'), palette.primary, true)
       addSlotText(elements, { ...slot, left, top, width, height: 65, preferredFontSize: 44 }, String(index + 1).padStart(2, '0'), palette.primary, true)

+ 1 - 0
src/utils/aiPptTextMetrics.ts

@@ -48,6 +48,7 @@ export function aiPptBlockHeight(values: string[], width: number, presentation:
   const columns = pairedCards ? 2 : grid ? Math.max(1, Math.min(presentation === 'steps' ? 4 : 3, values.length, Math.floor(width / 300))) : 1
   const columns = pairedCards ? 2 : grid ? Math.max(1, Math.min(presentation === 'steps' ? 4 : 3, values.length, Math.floor(width / 300))) : 1
   const cellWidth = (width - 22 * (columns - 1)) / columns
   const cellWidth = (width - 22 * (columns - 1)) / columns
   const textWidth = cellWidth - (grid ? 68 : presentation === 'cards' ? 58 : 0)
   const textWidth = cellWidth - (grid ? 68 : presentation === 'cards' ? 58 : 0)
+  if (!grid && presentation !== 'cards') return values.reduce((sum, value) => sum + Math.max(80, measureAiPptText(value, textWidth, font) + 12), 0) + (values.length - 1) * 16
   const textHeight = Math.max(...values.map(value => measureAiPptText(value, textWidth, presentation === 'steps' ? 40 : font, AI_PPT_SCALE, grid)))
   const textHeight = Math.max(...values.map(value => measureAiPptText(value, textWidth, presentation === 'steps' ? 40 : font, AI_PPT_SCALE, grid)))
   const rowHeight = grid ? Math.max(pairedCards ? 130 : 190, textHeight + (presentation === 'steps' ? 112 : 68)) : Math.max(80, textHeight + 12)
   const rowHeight = grid ? Math.max(pairedCards ? 130 : 190, textHeight + (presentation === 'steps' ? 112 : 68)) : Math.max(80, textHeight + 12)
   const rows = Math.ceil(values.length / columns)
   const rows = Math.ceil(values.length / columns)

+ 46 - 2
src/views/Editor/EditorHeader/AiCoursewareDialog.vue

@@ -193,7 +193,7 @@
         </div>
         </div>
         <div v-else-if="generationError">
         <div v-else-if="generationError">
           <Button v-if="!task" @click="step = 2">返回修改大纲</Button
           <Button v-if="!task" @click="step = 2">返回修改大纲</Button
-          ><Button type="primary" :disabled="transferring" @click="retry">{{ task ? "继续查看课件" : "重试生成" }}</Button>
+          ><Button type="primary" :disabled="transferring" @click="retry">{{ layoutRepairSource ? "精简并重新排版" : task ? "继续查看课件" : "重试生成" }}</Button>
         </div>
         </div>
       </footer>
       </footer>
     </div>
     </div>
@@ -201,6 +201,7 @@
 </template>
 </template>
 
 
 <script setup lang="ts">
 <script setup lang="ts">
+import { blockingAiPptLayoutIssues } from '@/utils/aiPptQuality'
 import { computed, nextTick, onBeforeUnmount, reactive, ref, watch } from "vue"
 import { computed, nextTick, onBeforeUnmount, reactive, ref, watch } from "vue"
 import { ElMessage, ElMessageBox } from "element-plus"
 import { ElMessage, ElMessageBox } from "element-plus"
 import Draggable from "vuedraggable"
 import Draggable from "vuedraggable"
@@ -278,6 +279,7 @@ const outlineLoading = ref(false),
   validationErrors = ref<string[]>([])
   validationErrors = ref<string[]>([])
 const task = ref<AiCoursewareTaskInfo>(),
 const task = ref<AiCoursewareTaskInfo>(),
   confirmed = ref<AiCoursewareOutline>()
   confirmed = ref<AiCoursewareOutline>()
+const layoutRepairSource = ref<AiCoursewareOutline>()
 let pollTimer: ReturnType<typeof setTimeout> | undefined,
 let pollTimer: ReturnType<typeof setTimeout> | undefined,
   version = 0,
   version = 0,
   replacementSnapshot = "",
   replacementSnapshot = "",
@@ -324,6 +326,7 @@ watch(
     outlineLoading.value = false
     outlineLoading.value = false
     task.value = undefined
     task.value = undefined
     confirmed.value = undefined
     confirmed.value = undefined
+    layoutRepairSource.value = undefined
     outline.value = undefined
     outline.value = undefined
     pages.value = []
     pages.value = []
     extraPrompt.value = ""
     extraPrompt.value = ""
@@ -491,6 +494,7 @@ async function confirmAndGenerate() {
 }
 }
 async function startGeneration() {
 async function startGeneration() {
   if (!confirmed.value || !pptWork.id || transferring.value || task.value) return
   if (!confirmed.value || !pptWork.id || transferring.value || task.value) return
+  layoutRepairSource.value = undefined
   const requestVersion = ++version
   const requestVersion = ++version
   step.value = 3
   step.value = 3
   generationError.value = ""
   generationError.value = ""
@@ -524,10 +528,40 @@ async function startGeneration() {
   if (props.visible && task.value) await pollTask()
   if (props.visible && task.value) await pollTask()
 }
 }
 async function retry() {
 async function retry() {
+  if (layoutRepairSource.value) { await repairBlockedLayout(); return }
   generationError.value = ""
   generationError.value = ""
   if (task.value) await pollTask()
   if (task.value) await pollTask()
   else await startGeneration()
   else await startGeneration()
 }
 }
+async function repairBlockedLayout() {
+  if (transferring.value || !layoutRepairSource.value) return
+  const requestVersion = ++version
+  stopPolling()
+  transferring.value = true
+  const reason = generationError.value
+  generationError.value = ''
+  try {
+    await assertAiPptClientCurrent()
+    if (requestVersion !== version) return
+    const plan = clone(layoutRepairSource.value)
+    const response = await httpAjax(aiCoursewareGenerateApi, {
+      id: pptWork.id, fromType: source(), outline: plan, templateId: templateId.value, repairOnly: true,
+      imageAspectRatios: getAiPptImageAspectRatios(templateId.value),
+      preferences: { ...clone(preferences), minPages: plan.pages.length, maxPages: plan.pages.length },
+      visualPrompt: `保持页数与教学目标,精简重复的学生文字,教师操作放备注,不截断歌词或完整范例。解决排版问题:${reason}`
+    })
+    if (requestVersion !== version) return
+    if (response.code !== 200 || !response.data?.taskId) throw new Error(response.message || '未能开始重新排版')
+    task.value = response.data
+    layoutRepairSource.value = undefined
+    remember()
+  } catch (error) {
+    if (requestVersion === version) generationError.value = error instanceof Error ? error.message : '重新排版失败,请重试'
+  } finally {
+    if (requestVersion === version) transferring.value = false
+  }
+  if (requestVersion === version && !generationError.value && props.visible) await pollTask()
+}
 async function pollTask() {
 async function pollTask() {
   stopPolling()
   stopPolling()
   const taskId = task.value?.taskId,
   const taskId = task.value?.taskId,
@@ -569,12 +603,22 @@ async function enterEditor(result: AiCoursewareGenerateResult, active: () => boo
   if (!result?.outline?.pages?.length) throw new Error("尚未获得课件内容,请继续查看")
   if (!result?.outline?.pages?.length) throw new Error("尚未获得课件内容,请继续查看")
   await assertAiPptClientCurrent()
   await assertAiPptClientCurrent()
   if (!active()) return
   if (!active()) return
-  const converted = aiCoursewareToSlides(result.outline, { templateId: templateId.value, enableAnimations: preferences.enableAnimations })
+  layoutRepairSource.value = clone(result.outline)
+  let converted: ReturnType<typeof aiCoursewareToSlides>
+  try {
+    converted = aiCoursewareToSlides(result.outline, { templateId: templateId.value, enableAnimations: preferences.enableAnimations })
+  } catch (error) {
+    if (error instanceof Error && /投屏安全区|保留区/.test(error.message)) throw new Error('生成内容超出页面容量,已保留当前课件。请精简并重新排版。')
+    throw error
+  }
   const report = inspectAiPptQuality(result.outline, converted.slides, {
   const report = inspectAiPptQuality(result.outline, converted.slides, {
       ...preferences,
       ...preferences,
       minPages: result.outline.pages.length,
       minPages: result.outline.pages.length,
       maxPages: result.outline.pages.length
       maxPages: result.outline.pages.length
     })
     })
+  const layoutIssues = blockingAiPptLayoutIssues(report)
+  if (layoutIssues.length) throw new Error(`第${[...new Set(layoutIssues.map(issue => issue.pageNo))].join('、')}页文字过密,已保留当前课件。请精简并重新排版。`)
+  layoutRepairSource.value = undefined
   const issues = [
   const issues = [
     ...report.errors,
     ...report.errors,
     ...report.warnings.filter(issue => ["image_review", "missing_required_visual", "layout_variety", "layout_consecutive", "rendered_layout_repeat", "invalid_page_design"].includes(issue.code)),
     ...report.warnings.filter(issue => ["image_review", "missing_required_visual", "layout_variety", "layout_consecutive", "rendered_layout_repeat", "invalid_page_design"].includes(issue.code)),

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor