AiCoursewareDialog.vue 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669
  1. <template>
  2. <Modal
  3. :visible="visible"
  4. :width="1120"
  5. :content-style="{ maxWidth: 'calc(100vw - 32px)', boxSizing: 'border-box' }"
  6. :close-button="!working"
  7. :close-on-click-mask="!working"
  8. :close-on-esc="!working"
  9. @update:visible="value => emit('update:visible', value)"
  10. >
  11. <div :class="['ai-dialog', workflowStep === 1 ? 'setup-mode' : 'review-mode']">
  12. <div class="header">
  13. <div>
  14. <div class="title">{{ pageTitle }}</div>
  15. <div class="sub">{{ pageMeta }}</div>
  16. </div>
  17. </div>
  18. <div class="workflow-steps">
  19. <div
  20. v-for="step in workflowSteps"
  21. :key="step.value"
  22. :class="['workflow-step', { active: workflowStep === step.value, done: workflowStep > step.value }]"
  23. >
  24. <span class="step-no">{{ workflowStep > step.value ? "✓" : step.value }}</span>
  25. <span>{{ step.label }}</span>
  26. </div>
  27. </div>
  28. <div v-if="outlineLoading" class="loading-strip">
  29. <span class="loading-dot"></span>
  30. <span>正在生成大纲,请稍候</span>
  31. </div>
  32. <div v-else-if="taskInfo" class="progress-strip">
  33. <div class="current-step">{{ currentProgressLabel }}</div>
  34. <div class="progress-line">
  35. <div class="progress-bar" :style="{ width: `${progressValue}%` }"></div>
  36. </div>
  37. <div class="progress-value">{{ progressValue }}%</div>
  38. </div>
  39. <div v-if="workflowStep === 1" class="setup-stage simplified-setup">
  40. <div class="stage-intro">
  41. <div>
  42. <div class="stage-title">设置这节课的基本需求</div>
  43. <div class="stage-desc">只需确认课时和篇幅,样式、素材与质量检查由系统完成。</div>
  44. </div>
  45. <span v-if="outline" class="saved-state">已有大纲,可继续确认</span>
  46. </div>
  47. <div class="setup-primary-grid">
  48. <label>
  49. <span>课时长度</span>
  50. <select v-model.number="preferences.lessonMinutes" :disabled="working">
  51. <option :value="20">20分钟</option>
  52. <option :value="30">30分钟</option>
  53. <option :value="40">40分钟</option>
  54. <option :value="45">45分钟</option>
  55. </select>
  56. </label>
  57. <label>
  58. <span>课件页数</span>
  59. <select v-model="pageRange" :disabled="working">
  60. <option value="9-12">精简版(9~12页)</option>
  61. <option value="12-15">完整课堂(12~15页)</option>
  62. <option value="9-15">由系统决定</option>
  63. </select>
  64. </label>
  65. </div>
  66. <div class="extra">
  67. <div class="label">还有什么特别要求?<span>选填</span></div>
  68. <TextArea v-model:value="extraPrompt" :rows="3" placeholder="例如:多安排节奏游戏,语言适合一年级学生" :disabled="working" />
  69. </div>
  70. <button type="button" class="advanced-toggle" @click="advancedSettingsExpanded = !advancedSettingsExpanded">
  71. {{ advancedSettingsExpanded ? "收起高级设置" : "高级设置" }}
  72. </button>
  73. <div v-if="advancedSettingsExpanded" class="generation-preferences advanced-settings">
  74. <div class="preference-grid">
  75. <label
  76. ><span>素材</span
  77. ><select v-model="preferences.assetStyle" :disabled="working">
  78. <option value="illustration">统一插画</option>
  79. <option value="photo">真实照片</option>
  80. <option value="mixed">插画与照片混合</option>
  81. </select></label
  82. >
  83. <label
  84. ><span>教材原图</span
  85. ><select v-model="preferences.sourceImagePolicy" :disabled="working">
  86. <option value="strict">优先保留</option>
  87. <option value="balanced">适度使用</option>
  88. <option value="creative">自由创作</option>
  89. </select></label
  90. >
  91. </div>
  92. <div class="media-options">
  93. <label><input v-model="preferences.requireAudio" type="checkbox" :disabled="working" />需要音频</label>
  94. <label><input v-model="preferences.requireVideo" type="checkbox" :disabled="working" />需要视频</label>
  95. <label><input v-model="preferences.enableAnimations" type="checkbox" :disabled="working" />启用克制动画</label>
  96. </div>
  97. </div>
  98. </div>
  99. <div v-if="workflowStep === 3 && draftConverted" class="result-preview">
  100. <div :class="['draft-status', draftPreparationState]">
  101. <span class="draft-status-icon">{{ draftPreparationState === "ready" ? "✓" : draftPreparationState === "failed" ? "!" : "" }}</span>
  102. <div>
  103. <strong>{{ draftStatusTitle }}</strong>
  104. <span>{{ draftStatusDescription }}</span>
  105. </div>
  106. </div>
  107. <div class="draft-workspace">
  108. <div class="draft-page-list" aria-label="课件页面">
  109. <button
  110. v-for="(slide, index) in draftConverted.slides"
  111. :key="slide.id"
  112. type="button"
  113. :class="['draft-page-item', { active: selectedDraftPageIndex === index }]"
  114. @click="selectedDraftPageIndex = index"
  115. >
  116. <ThumbnailSlide :slide="slide" :size="148" />
  117. <span>{{ formatPageNo(index + 1) }} · {{ draftOutline?.pages[index]?.title || "未命名页面" }}</span>
  118. </button>
  119. </div>
  120. <div v-if="selectedDraftSlide" class="draft-preview-pane">
  121. <div class="draft-preview-toolbar">
  122. <div>
  123. <span>第{{ selectedDraftPageIndex + 1 }} / {{ draftConverted.slides.length }}页</span>
  124. <strong>{{ selectedDraftPage?.title || "课件页面" }}</strong>
  125. </div>
  126. <button type="button" :disabled="working" @click="regenerateDraftPage(selectedDraftPageIndex)">重新生成本页</button>
  127. </div>
  128. <div class="draft-canvas-shell">
  129. <ThumbnailSlide :slide="selectedDraftSlide" :size="680" />
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <div v-else-if="workflowStep === 2 && outline" class="outline">
  135. <div class="sample-stage-head">
  136. <div class="sample-template-current">
  137. <span>当前样式</span>
  138. <strong>{{ selectedTemplate.name }}</strong>
  139. <small v-if="selectedTemplate.id === recommendedTemplate.id">系统推荐</small>
  140. </div>
  141. <button type="button" :disabled="working" @click="templatePickerExpanded = !templatePickerExpanded">
  142. {{ templatePickerExpanded ? "收起模板" : "更换模板" }}
  143. </button>
  144. </div>
  145. <div class="sample-carousel-shell">
  146. <button
  147. type="button"
  148. class="sample-carousel-arrow previous"
  149. aria-label="查看前面的页面"
  150. :disabled="!canScrollSamplePrevious"
  151. @click="scrollSampleCarousel(-1)"
  152. >
  153. </button>
  154. <div ref="sampleCarouselRef" class="sample-thumbnail-track" @scroll="updateSampleCarouselNavigation">
  155. <button
  156. v-for="(slide, index) in previewSlides"
  157. :key="slide.id"
  158. type="button"
  159. :class="['sample-thumbnail-item', { active: selectedPageNo === outline.pages[index]?.pageNo }]"
  160. :disabled="working"
  161. :title="outline.pages[index]?.title || `第${index + 1}页`"
  162. @click="selectSamplePage(outline.pages[index]?.pageNo || index + 1, index)"
  163. >
  164. <ThumbnailSlide :slide="slide" :size="116" />
  165. <span>{{ outline.pages[index]?.title || `第${index + 1}页` }}</span>
  166. </button>
  167. </div>
  168. <button
  169. type="button"
  170. class="sample-carousel-arrow next"
  171. aria-label="查看后面的页面"
  172. :disabled="!canScrollSampleNext"
  173. @click="scrollSampleCarousel(1)"
  174. >
  175. </button>
  176. </div>
  177. <div v-if="templatePickerExpanded" class="compact-template-panel">
  178. <div class="sample-template-picker">
  179. <button
  180. v-for="template in visibleTemplates"
  181. :key="template.id"
  182. type="button"
  183. :class="['sample-template-option', { active: selectedTemplateId === template.id }]"
  184. :disabled="working"
  185. @click="selectTemplate(template.id, true)"
  186. >
  187. <span class="template-real-cover option" :style="templateCoverStyle(template.id)"></span>
  188. <span
  189. ><strong>{{ template.name }}</strong
  190. ><small>{{ template.id === recommendedTemplate.id ? "系统推荐 · " : "" }}{{ template.scene }}</small></span
  191. >
  192. </button>
  193. </div>
  194. <button v-if="!showAllTemplates" type="button" class="show-all-templates" @click="showAllTemplates = true">查看全部模板</button>
  195. <div v-if="selectedTemplateFit.level === 'low'" class="template-fit-warning">
  196. <span>当前模板不太适合这节课:{{ selectedTemplateFit.reason }}</span>
  197. <button type="button" :disabled="working" @click="useRecommendedTemplate">切换为系统推荐</button>
  198. </div>
  199. </div>
  200. <div v-if="sampleSlide && selectedPage" class="sample-detail-section">
  201. <div class="sample-detail-heading">
  202. <div>
  203. <span>第{{ samplePageNo }}页</span>
  204. <strong>{{ samplePageTitle }}</strong>
  205. </div>
  206. <small>{{ samplePageReason }}</small>
  207. </div>
  208. <div class="sample-detail-layout">
  209. <section class="sample-outline-panel" aria-label="页面内容编辑">
  210. <div class="page-editor simplified-page-editor">
  211. <div class="editor-head">
  212. <div class="title-editor">
  213. <label class="outline-field-label">页面主题</label>
  214. <input v-model="selectedPage.title" class="page-title" :disabled="working" />
  215. </div>
  216. </div>
  217. <div class="field-card">
  218. <div class="field-title">学生看到的内容</div>
  219. <input
  220. :value="studentHeadline"
  221. :disabled="working"
  222. class="headline-input"
  223. placeholder="这一页给学生看的核心标题"
  224. @input="event => updateStudentHeadline(selectedPage!, event)"
  225. />
  226. <textarea
  227. :value="studentPoints.join('\n')"
  228. :disabled="working"
  229. class="page-bullets"
  230. placeholder="每行一条学生可见要点,避免写老师操作步骤"
  231. @input="event => updateStudentPoints(selectedPage!, event)"
  232. ></textarea>
  233. <div v-if="studentContentReadabilityHint" class="content-readability-hint">
  234. {{ studentContentReadabilityHint }}
  235. </div>
  236. </div>
  237. </div>
  238. </section>
  239. <section class="sample-preview-column" aria-label="页面预览及调整">
  240. <div class="sample-canvas">
  241. <ThumbnailSlide
  242. :slide="sampleSlide"
  243. :size="600"
  244. :show-background-error="true"
  245. @background-load-state="handleSampleBackgroundLoadState"
  246. />
  247. </div>
  248. <div v-if="sampleBackgroundState.status === 'error'" class="template-load-error">模板背景加载失败,请更换模板或稍后重试</div>
  249. <div class="sample-feedback">
  250. <div class="feedback-label">调整当前页面</div>
  251. <div class="feedback-chips">
  252. <button
  253. v-for="item in sampleFeedbackOptions"
  254. :key="item"
  255. type="button"
  256. :class="{ active: sampleFeedbackTags.includes(item) }"
  257. :disabled="working"
  258. @click="toggleSampleFeedback(item)"
  259. >
  260. {{ item }}
  261. </button>
  262. </div>
  263. <div class="sample-feedback-action">
  264. <textarea
  265. v-model="sampleFeedbackText"
  266. :disabled="working"
  267. placeholder="也可以直接说明你希望怎么调整"
  268. @input="invalidateVisualApproval"
  269. ></textarea>
  270. <Button @click="regenerateSamplePage" :disabled="working">调整当前页面</Button>
  271. </div>
  272. </div>
  273. </section>
  274. </div>
  275. </div>
  276. </div>
  277. <div class="footer">
  278. <Button @click="emit('update:visible', false)" :disabled="working">取消</Button>
  279. <template v-if="isSetupStep">
  280. <Button v-if="outline" @click="workflowStep = 2" :disabled="working">继续选择样式</Button>
  281. <Button type="primary" @click="handleOutline" :disabled="working">{{ outline ? "按当前设置重新生成" : "开始生成课件" }}</Button>
  282. </template>
  283. <template v-else-if="isStyleStep">
  284. <Button @click="workflowStep = 1" :disabled="working">返回修改需求</Button>
  285. <Button type="primary" @click="confirmSamplesAndGenerate" :disabled="working || sampleBackgroundState.status === 'error'"
  286. >使用此样式并生成课件</Button
  287. >
  288. </template>
  289. <template v-else>
  290. <Button v-if="draftPreparationState !== 'optimizing'" @click="backToOutline">返回调整</Button>
  291. <span v-if="draftPreparationState === 'optimizing'" class="footer-progress">正在准备可用课件…</span>
  292. <Button v-else-if="draftPreparationState === 'failed'" type="primary" @click="retryAutomaticOptimization">重新自动优化</Button>
  293. <Button v-else-if="draftPreparationState === 'ready'" type="primary" @click="applyDraft">应用到当前课件</Button>
  294. </template>
  295. </div>
  296. </div>
  297. </Modal>
  298. </template>
  299. <script lang="ts" setup>
  300. import { ref, reactive, computed, watch, nextTick } from "vue"
  301. import { ElMessage } from "element-plus"
  302. import Modal from "@/components/Modal.vue"
  303. import Button from "@/components/Button.vue"
  304. import TextArea from "@/components/TextArea.vue"
  305. import ThumbnailSlide from "@/views/components/ThumbnailSlide/index.vue"
  306. import queryParams from "@/queryParams"
  307. import usePptWork from "@/store/pptWork"
  308. import { useSlidesStore } from "@/store"
  309. import useHistorySnapshot from "@/hooks/useHistorySnapshot"
  310. import { httpAjaxErrMsg } from "@/plugins/httpAjax"
  311. import {
  312. aiCoursewareGenerateApi,
  313. aiCoursewareOutlineApi,
  314. aiCoursewareResultApi,
  315. aiCoursewareTaskApi,
  316. type AiCoursewareOutline,
  317. type AiCoursewarePage,
  318. type AiCoursewarePreferences,
  319. type AiCoursewareTaskInfo,
  320. type AiCoursewareGenerateResult
  321. } from "@/api/aiCourseware"
  322. import { aiCoursewareToSlides } from "@/utils/aiCoursewareToSlides"
  323. import { inspectAiPptQuality, type AiPptQualityReport } from "@/utils/aiPptQuality"
  324. import {
  325. AI_COURSEWARE_TEMPLATES,
  326. getAiCoursewareTemplate,
  327. recommendAiCoursewareTemplate,
  328. scoreAiCoursewareTemplate,
  329. type AiCoursewareTemplateId
  330. } from "@/config/aiCoursewareTemplates"
  331. import { getAiCoursewareTemplateMaster } from "@/config/aiCoursewareTemplateMasters"
  332. import { resolveTemplateAssetUrl } from "@/utils/templateAssetUrl"
  333. import type { Slide, SlideTheme } from "@/types/slides"
  334. const props = defineProps<{
  335. visible: boolean
  336. }>()
  337. const emit = defineEmits<{
  338. (event: "update:visible", payload: boolean): void
  339. }>()
  340. const pptWork = usePptWork()
  341. const slidesStore = useSlidesStore()
  342. const { addHistorySnapshot } = useHistorySnapshot()
  343. const extraPrompt = ref("")
  344. const outline = ref<AiCoursewareOutline>()
  345. const taskInfo = ref<AiCoursewareTaskInfo>()
  346. const workflowStep = ref<1 | 2 | 3>(1)
  347. const isSetupStep = computed(() => workflowStep.value === 1)
  348. const isStyleStep = computed(() => workflowStep.value === 2)
  349. const workflowSteps = [
  350. { value: 1, label: "设置需求" },
  351. { value: 2, label: "选择样式" },
  352. { value: 3, label: "预览并应用" }
  353. ] as const
  354. const taskMode = ref<"full" | "sample">("full")
  355. const coursewareTemplates = AI_COURSEWARE_TEMPLATES
  356. const defaultTemplateId = AI_COURSEWARE_TEMPLATES[0].id
  357. const selectedTemplateId = ref<AiCoursewareTemplateId>(defaultTemplateId)
  358. const templateSelectionMode = ref<"auto" | "manual">("auto")
  359. const templatePickerExpanded = ref(false)
  360. const advancedSettingsExpanded = ref(false)
  361. const showAllTemplates = ref(false)
  362. const paletteVariant = ref(0)
  363. const pageRange = ref("9-12")
  364. const preferences = reactive<AiCoursewarePreferences>({
  365. lessonMinutes: 40,
  366. minPages: 9,
  367. maxPages: 12,
  368. assetStyle: "illustration",
  369. sourceImagePolicy: "balanced",
  370. requireAudio: false,
  371. requireVideo: false,
  372. enableAnimations: true
  373. })
  374. const approvedSamplePages = ref<number[]>([])
  375. const sampleBackgroundState = ref<{ status: "none" | "loading" | "loaded" | "error"; url: string }>({ status: "none", url: "" })
  376. const sampleFeedbackOptions = ["画风不合适", "页面太空", "图片不合适", "文字太多"]
  377. const sampleFeedbackTags = ref<string[]>([])
  378. const sampleFeedbackText = ref("")
  379. const draftOutline = ref<AiCoursewareOutline>()
  380. const draftConverted = ref<{ title: string; theme: Partial<SlideTheme>; slides: Slide[] }>()
  381. const draftQuality = ref<AiPptQualityReport>()
  382. const draftPreparationState = ref<"idle" | "optimizing" | "ready" | "failed">("idle")
  383. const automaticRepairAttempts = ref(0)
  384. const MAX_AUTOMATIC_REPAIR_ATTEMPTS = 1
  385. const TEACHER_VISIBLE_PATTERN = /(?:教师|老师)(?:讲述|提问|引导|指导|组织|巡视|示范)|(?:引导|指导|组织)学生/
  386. const PLACEHOLDER_PATTERN = /(?:待补充|待完善|请输入|可参考教材|placeholder|lorem ipsum|\{\{.+?\}\}|\[.+?占位.+?\])/i
  387. const pollTimer = ref<number>()
  388. const selectedPageNo = ref(1)
  389. const sampleCarouselRef = ref<HTMLElement>()
  390. const canScrollSamplePrevious = ref(false)
  391. const canScrollSampleNext = ref(false)
  392. const selectedDraftPageIndex = ref(0)
  393. const outlineLoading = ref(false)
  394. const working = computed(
  395. () =>
  396. outlineLoading.value ||
  397. draftPreparationState.value === "optimizing" ||
  398. taskInfo.value?.status === "PENDING" ||
  399. taskInfo.value?.status === "RUNNING"
  400. )
  401. const selectedTemplate = computed(() => getAiCoursewareTemplate(selectedTemplateId.value))
  402. const selectedStyle = computed(() => selectedTemplate.value.baseStyle)
  403. const templateRecommendation = computed(() =>
  404. outline.value ? recommendAiCoursewareTemplate(outline.value) : { id: defaultTemplateId, reason: "生成大纲后将根据课程内容自动推荐" }
  405. )
  406. const recommendedTemplate = computed(() => getAiCoursewareTemplate(templateRecommendation.value.id))
  407. const visibleTemplates = computed(() => {
  408. if (showAllTemplates.value) return coursewareTemplates
  409. const recommendedId = recommendedTemplate.value.id
  410. return [...coursewareTemplates]
  411. .sort((left, right) => {
  412. if (left.id === recommendedId) return -1
  413. if (right.id === recommendedId) return 1
  414. return outline.value ? templateFit(right.id).score - templateFit(left.id).score : 0
  415. })
  416. .slice(0, 4)
  417. })
  418. const selectedTemplateFit = computed(() =>
  419. outline.value
  420. ? scoreAiCoursewareTemplate(outline.value, selectedTemplateId.value)
  421. : { templateId: selectedTemplateId.value, score: 80, level: "usable" as const, label: "可以使用" as const, reason: "生成大纲后评估" }
  422. )
  423. const progressValue = computed(() => taskInfo.value?.progress || 0)
  424. const progressSteps = [
  425. { threshold: 0, label: "准备中" },
  426. { threshold: 25, label: "生成内容" },
  427. { threshold: 50, label: "优化设计" },
  428. { threshold: 65, label: "匹配图片" },
  429. { threshold: 100, label: "生成完成" }
  430. ]
  431. const currentProgressLabel = computed(() => {
  432. const matched = [...progressSteps].reverse().find(step => progressValue.value >= step.threshold)
  433. return shortProgressLabel(taskInfo.value?.message) || matched?.label || "处理中"
  434. })
  435. const pageTitle = computed(() => outline.value?.chapterName || outline.value?.title || "AI生成课件")
  436. const pageMeta = computed(() => {
  437. if (!outline.value) return `根据当前教材生成${preferences.minPages}至${preferences.maxPages}页音乐课件`
  438. return [...[outline.value.gradeName, outline.value.unitName].filter(Boolean), `共${outline.value.pages.length}页`].join(" · ")
  439. })
  440. const selectedPage = computed(() => {
  441. const pages = outline.value?.pages || []
  442. return pages.find(page => page.pageNo === selectedPageNo.value) || pages[0]
  443. })
  444. const studentHeadline = computed(() => selectedPage.value?.studentContent?.headline || selectedPage.value?.subtitle || "")
  445. const studentPoints = computed(() => {
  446. if (!selectedPage.value) return []
  447. return selectedPage.value.studentContent?.points?.length ? selectedPage.value.studentContent.points : selectedPage.value.bullets || []
  448. })
  449. const studentContentReadabilityHint = computed(() => {
  450. const contentCount = studentPoints.value.length + (studentHeadline.value ? 1 : 0)
  451. return contentCount > 6 ? `当前有${contentCount}条学生内容,预览会完整显示,但投屏字号可能变小,建议适当精简。` : ""
  452. })
  453. const samplePageIndex = computed(() => {
  454. const pages = outline.value?.pages || []
  455. const selectedIndex = pages.findIndex(page => page.pageNo === selectedPageNo.value)
  456. return selectedIndex >= 0 ? selectedIndex : 0
  457. })
  458. const samplePageNo = computed(() => outline.value?.pages[samplePageIndex.value]?.pageNo || samplePageIndex.value + 1)
  459. const samplePageTitle = computed(() => outline.value?.pages[samplePageIndex.value]?.title || "代表页面")
  460. const representativeSamples = computed(() => {
  461. const pages = outline.value?.pages || []
  462. if (!pages.length) return []
  463. const selected: Array<{ pageNo: number; label: string }> = []
  464. const add = (page: AiCoursewarePage | undefined, label: string) => {
  465. if (page && !selected.some(item => item.pageNo === page.pageNo)) selected.push({ pageNo: page.pageNo, label })
  466. }
  467. add(pages[0], "封面主视觉")
  468. add(
  469. pages.find(
  470. page =>
  471. [
  472. "hero_focus",
  473. "media_focus",
  474. "split_content",
  475. "diagram_focus",
  476. "story_stage",
  477. "full_image_question",
  478. "split_image",
  479. "observe_question"
  480. ].includes(page.visualPlan?.layout || "") && page.pageNo !== pages[0].pageNo
  481. ),
  482. "内容主视觉"
  483. )
  484. add(
  485. pages.find(page =>
  486. ["activity", "summary", "action_demo", "group_mission", "performance_stage", "activity_steps", "practice_check"].includes(
  487. page.visualPlan?.layout || ""
  488. )
  489. ),
  490. "课堂活动"
  491. )
  492. pages.forEach(page => {
  493. if (selected.length < 3) add(page, selected.length === 1 ? "内容主视觉" : "课堂活动")
  494. })
  495. return selected.slice(0, 3).map((item, index) => ({ ...item, order: index + 1 }))
  496. })
  497. const selectedDraftPage = computed(() => draftOutline.value?.pages[selectedDraftPageIndex.value])
  498. const selectedDraftSlide = computed(() => draftConverted.value?.slides[selectedDraftPageIndex.value])
  499. const draftStatusTitle = computed(() => {
  500. if (draftPreparationState.value === "ready") return "课件已准备完成"
  501. if (draftPreparationState.value === "failed") return "部分页面还未处理完成"
  502. return "正在自动检查和优化课件"
  503. })
  504. const draftStatusDescription = computed(() => {
  505. if (draftPreparationState.value === "ready") return "系统已完成内容、排版和教学可用性检查,可以直接预览并应用。"
  506. if (draftPreparationState.value === "failed") return "无需逐项修改,点击重新自动优化即可继续。"
  507. return "正在清理重复内容、调整版式并修复问题页面,请稍候。"
  508. })
  509. const requiredSamplePages = computed(() => representativeSamples.value.map(item => item.pageNo))
  510. const allSamplesApproved = computed(
  511. () => requiredSamplePages.value.length === 3 && requiredSamplePages.value.every(pageNo => approvedSamplePages.value.includes(pageNo))
  512. )
  513. const samplePageReason = computed(() => {
  514. const layout = outline.value?.pages[samplePageIndex.value]?.visualPlan?.layout || ""
  515. if (["activity_steps", "action_demo", "group_mission", "performance_stage"].includes(layout)) return "这是课堂活动页,适合判断互动方式和信息层级"
  516. if (["cover_scene", "story_stage", "full_image_question", "observe_question"].includes(layout))
  517. return "这是主视觉页面,适合判断画风、配色和场景表现"
  518. if (["summary_checklist", "visual_summary", "practice_check"].includes(layout)) return "这是总结检测页,适合判断文字密度和阅读效率"
  519. return "这是你当前选中的页面,可用来判断版式和学生阅读体验"
  520. })
  521. const previewSlides = computed(() => {
  522. if (!outline.value?.pages.length) return undefined
  523. const previewOutline = { ...outline.value, style: selectedStyle.value }
  524. return aiCoursewareToSlides(previewOutline, {
  525. enableAnimations: preferences.enableAnimations,
  526. paletteVariant: paletteVariant.value,
  527. templateId: selectedTemplateId.value
  528. }).slides
  529. })
  530. const sampleSlide = computed(() => previewSlides.value?.[samplePageIndex.value])
  531. function updateSampleCarouselNavigation() {
  532. const carousel = sampleCarouselRef.value
  533. if (!carousel) {
  534. canScrollSamplePrevious.value = false
  535. canScrollSampleNext.value = false
  536. return
  537. }
  538. canScrollSamplePrevious.value = carousel.scrollLeft > 2
  539. canScrollSampleNext.value = carousel.scrollLeft + carousel.clientWidth < carousel.scrollWidth - 2
  540. }
  541. function scrollSampleCarousel(direction: -1 | 1) {
  542. const carousel = sampleCarouselRef.value
  543. if (!carousel) return
  544. carousel.scrollBy({ left: direction * Math.max(320, carousel.clientWidth * 0.72), behavior: "smooth" })
  545. }
  546. function selectSamplePage(pageNo: number, index: number) {
  547. if (selectedPageNo.value !== pageNo) {
  548. sampleFeedbackTags.value = []
  549. sampleFeedbackText.value = ""
  550. }
  551. selectedPageNo.value = pageNo
  552. const item = sampleCarouselRef.value?.children.item(index) as HTMLElement | null
  553. item?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" })
  554. }
  555. watch(selectedTemplateId, () => {
  556. paletteVariant.value = 0
  557. if (outline.value) outline.value.style = selectedStyle.value
  558. invalidateVisualApproval()
  559. })
  560. watch(pageRange, value => {
  561. const [minPages, maxPages] = value.split("-").map(Number)
  562. preferences.minPages = minPages
  563. preferences.maxPages = maxPages
  564. })
  565. watch(preferences, () => invalidateVisualApproval(), { deep: true })
  566. watch(
  567. outline,
  568. () => {
  569. if (!outline.value) return
  570. if (templateSelectionMode.value === "auto") selectedTemplateId.value = templateRecommendation.value.id
  571. invalidateVisualApproval()
  572. },
  573. { deep: true }
  574. )
  575. watch(
  576. () => props.visible,
  577. visible => {
  578. if (!visible) clearTask()
  579. }
  580. )
  581. watch(
  582. [workflowStep, selectedTemplateId, () => outline.value?.pages.length],
  583. async () => {
  584. await nextTick()
  585. updateSampleCarouselNavigation()
  586. },
  587. { immediate: true }
  588. )
  589. async function handleOutline() {
  590. if (!pptWork.id) {
  591. ElMessage.error("当前课件ID为空")
  592. return
  593. }
  594. outlineLoading.value = true
  595. const res = await httpAjaxErrMsg(aiCoursewareOutlineApi, {
  596. id: pptWork.id,
  597. fromType: queryParams.pptResourcesType || queryParams.fromType,
  598. extraPrompt: buildExtraPrompt(),
  599. preferences: { ...preferences }
  600. }).finally(() => {
  601. outlineLoading.value = false
  602. })
  603. if (res.code === 200) {
  604. outline.value = res.data as AiCoursewareOutline
  605. if (templateSelectionMode.value === "auto") selectedTemplateId.value = recommendAiCoursewareTemplate(outline.value).id
  606. outline.value.style = selectedStyle.value
  607. outline.value.templateId = selectedTemplateId.value
  608. selectedPageNo.value = outline.value.pages[0]?.pageNo || 1
  609. sampleFeedbackTags.value = []
  610. sampleFeedbackText.value = ""
  611. workflowStep.value = 2
  612. }
  613. }
  614. async function handleGenerate() {
  615. const sourceOutline = draftOutline.value || outline.value
  616. if (!sourceOutline || !pptWork.id) return
  617. if (!allSamplesApproved.value) {
  618. ElMessage.error("请先确认三张代表样稿")
  619. return
  620. }
  621. draftConverted.value = undefined
  622. draftQuality.value = undefined
  623. draftPreparationState.value = "idle"
  624. automaticRepairAttempts.value = 0
  625. sourceOutline.style = selectedStyle.value
  626. sourceOutline.templateId = selectedTemplateId.value
  627. taskMode.value = "full"
  628. const res = await httpAjaxErrMsg(aiCoursewareGenerateApi, {
  629. id: pptWork.id,
  630. fromType: queryParams.pptResourcesType || queryParams.fromType,
  631. outline: sourceOutline,
  632. templateId: selectedTemplateId.value,
  633. visualPrompt: buildVisualPrompt(),
  634. preferences: { ...preferences }
  635. })
  636. if (res.code !== 200) return
  637. taskInfo.value = res.data as AiCoursewareTaskInfo
  638. await pollTask(taskInfo.value.taskId)
  639. }
  640. async function regenerateSamplePage() {
  641. if (!outline.value || !pptWork.id) return
  642. approvedSamplePages.value = approvedSamplePages.value.filter(pageNo => pageNo !== samplePageNo.value)
  643. taskMode.value = "sample"
  644. if (sampleFeedbackTags.value.includes("画风不合适")) paletteVariant.value = (paletteVariant.value + 1) % 3
  645. const feedback = [...sampleFeedbackTags.value, sampleFeedbackText.value.trim()].filter(Boolean).join(";")
  646. const res = await httpAjaxErrMsg(aiCoursewareGenerateApi, {
  647. id: pptWork.id,
  648. fromType: queryParams.pptResourcesType || queryParams.fromType,
  649. outline: outline.value,
  650. templateId: selectedTemplateId.value,
  651. visualPrompt: `${buildVisualPrompt()}当前只调整第${samplePageNo.value}页样张。${feedback ? `用户反馈:${feedback}。` : "请更换视觉组织方式,保持教学目标不变。"}`,
  652. preferences: { ...preferences },
  653. regeneratePageNo: samplePageNo.value
  654. })
  655. if (res.code !== 200) return
  656. taskInfo.value = res.data as AiCoursewareTaskInfo
  657. await pollTask(taskInfo.value.taskId)
  658. }
  659. async function pollTask(taskId: string) {
  660. if (pollTimer.value) window.clearInterval(pollTimer.value)
  661. await fetchTask(taskId)
  662. if (taskInfo.value?.status === "PENDING" || taskInfo.value?.status === "RUNNING") {
  663. pollTimer.value = window.setInterval(() => fetchTask(taskId), 2000)
  664. }
  665. }
  666. async function fetchTask(taskId: string) {
  667. const res = await httpAjaxErrMsg(aiCoursewareTaskApi, taskId)
  668. if (res.code !== 200) {
  669. clearTask()
  670. return
  671. }
  672. taskInfo.value = res.data as AiCoursewareTaskInfo
  673. if (taskInfo.value.status === "DONE") {
  674. clearPollTimer()
  675. if (taskMode.value === "sample") await loadSampleResult(taskId)
  676. else await loadDraft(taskId)
  677. } else if (taskInfo.value.status === "FAILED") {
  678. clearPollTimer()
  679. const message = taskInfo.value.message || "AI课件生成失败"
  680. clearTask()
  681. if (workflowStep.value === 3) {
  682. draftPreparationState.value = "failed"
  683. console.error("AI课件自动优化失败", message)
  684. ElMessage.error("自动优化未完成,请重新尝试")
  685. } else {
  686. ElMessage.error(message)
  687. }
  688. }
  689. }
  690. function clearTask() {
  691. clearPollTimer()
  692. taskInfo.value = undefined
  693. }
  694. function clearPollTimer() {
  695. if (pollTimer.value) {
  696. window.clearInterval(pollTimer.value)
  697. pollTimer.value = undefined
  698. }
  699. }
  700. async function loadDraft(taskId: string) {
  701. const res = await httpAjaxErrMsg(aiCoursewareResultApi, taskId)
  702. if (res.code !== 200) {
  703. clearTask()
  704. return
  705. }
  706. const result = res.data as AiCoursewareGenerateResult
  707. draftOutline.value = result.outline
  708. draftOutline.value.templateId = selectedTemplateId.value
  709. selectedDraftPageIndex.value = 0
  710. workflowStep.value = 3
  711. clearTask()
  712. await prepareDraftForUse()
  713. }
  714. async function loadSampleResult(taskId: string) {
  715. const res = await httpAjaxErrMsg(aiCoursewareResultApi, taskId)
  716. if (res.code !== 200) {
  717. clearTask()
  718. return
  719. }
  720. const result = res.data as AiCoursewareGenerateResult
  721. outline.value = result.outline
  722. outline.value.style = selectedStyle.value
  723. outline.value.templateId = selectedTemplateId.value
  724. sampleFeedbackTags.value = []
  725. sampleFeedbackText.value = ""
  726. workflowStep.value = 2
  727. clearTask()
  728. ElMessage.success(`第${samplePageNo.value}页样张已重新生成,请再次确认视觉方向`)
  729. }
  730. function rebuildDraftPreview() {
  731. if (!draftOutline.value) {
  732. draftConverted.value = undefined
  733. draftQuality.value = undefined
  734. return
  735. }
  736. draftOutline.value.style = selectedStyle.value
  737. draftOutline.value.templateId = selectedTemplateId.value
  738. draftConverted.value = aiCoursewareToSlides(draftOutline.value, {
  739. enableAnimations: preferences.enableAnimations,
  740. paletteVariant: paletteVariant.value,
  741. templateId: selectedTemplateId.value
  742. })
  743. draftQuality.value = inspectAiPptQuality(draftOutline.value, draftConverted.value.slides, preferences)
  744. }
  745. async function regenerateDraftPage(index: number) {
  746. if (!draftOutline.value || !pptWork.id) return
  747. draftPreparationState.value = "optimizing"
  748. automaticRepairAttempts.value = 0
  749. taskMode.value = "full"
  750. const res = await httpAjaxErrMsg(aiCoursewareGenerateApi, {
  751. id: pptWork.id,
  752. fromType: queryParams.pptResourcesType || queryParams.fromType,
  753. outline: draftOutline.value,
  754. templateId: selectedTemplateId.value,
  755. visualPrompt: `${buildVisualPrompt()}请重新生成本页并主动修正学生可见内容、文字密度和版式问题。`,
  756. preferences: { ...preferences },
  757. regeneratePageNo: index + 1
  758. })
  759. if (res.code !== 200) {
  760. draftPreparationState.value = "failed"
  761. return
  762. }
  763. taskInfo.value = res.data as AiCoursewareTaskInfo
  764. await pollTask(taskInfo.value.taskId)
  765. }
  766. function applyDraft() {
  767. if (!draftConverted.value || !draftQuality.value?.passed) return
  768. slidesStore.setTitle(draftConverted.value.title)
  769. slidesStore.setTheme(draftConverted.value.theme)
  770. slidesStore.setSlides(draftConverted.value.slides)
  771. slidesStore.updateSlideIndex(0)
  772. addHistorySnapshot()
  773. ElMessage.success("PPT已应用,请检查后手动保存")
  774. emit("update:visible", false)
  775. }
  776. function backToOutline() {
  777. clearTask()
  778. if (draftOutline.value) outline.value = draftOutline.value
  779. draftOutline.value = undefined
  780. draftConverted.value = undefined
  781. draftQuality.value = undefined
  782. draftPreparationState.value = "idle"
  783. automaticRepairAttempts.value = 0
  784. workflowStep.value = 2
  785. }
  786. function invalidateVisualApproval() {
  787. approvedSamplePages.value = []
  788. }
  789. async function confirmSamplesAndGenerate() {
  790. const slides = previewSlides.value || []
  791. if (!outline.value || slides.length !== outline.value.pages.length) {
  792. ElMessage.error("页面预览尚未准备完成,请稍后重试")
  793. return
  794. }
  795. const backgroundUrls = Array.from(
  796. new Set(slides.map(slide => (slide.background?.type === "image" ? resolveTemplateAssetUrl(slide.background.image) : "")).filter(Boolean))
  797. )
  798. try {
  799. await Promise.all(backgroundUrls.map(preloadImage))
  800. } catch {
  801. ElMessage.error("模板背景加载失败,请更换模板或稍后重试")
  802. return
  803. }
  804. approvedSamplePages.value = [...requiredSamplePages.value]
  805. await handleGenerate()
  806. }
  807. function handleSampleBackgroundLoadState(payload: { status: "none" | "loading" | "loaded" | "error"; url: string }) {
  808. sampleBackgroundState.value = payload
  809. if (payload.status === "error") {
  810. approvedSamplePages.value = approvedSamplePages.value.filter(pageNo => pageNo !== samplePageNo.value)
  811. console.error("AI课件模板背景加载失败", {
  812. templateId: selectedTemplateId.value,
  813. pageNo: samplePageNo.value,
  814. layout: outline.value?.pages[samplePageIndex.value]?.visualPlan?.layout,
  815. url: payload.url
  816. })
  817. }
  818. }
  819. function toggleSampleFeedback(item: string) {
  820. approvedSamplePages.value = approvedSamplePages.value.filter(pageNo => pageNo !== samplePageNo.value)
  821. sampleFeedbackTags.value = sampleFeedbackTags.value.includes(item)
  822. ? sampleFeedbackTags.value.filter(value => value !== item)
  823. : [...sampleFeedbackTags.value, item]
  824. }
  825. function selectTemplate(templateId: AiCoursewareTemplateId, fromSample = false) {
  826. templateSelectionMode.value = "manual"
  827. selectedTemplateId.value = templateId
  828. if (fromSample) {
  829. templatePickerExpanded.value = false
  830. showAllTemplates.value = false
  831. ElMessage.success(`已切换为${getAiCoursewareTemplate(templateId).name},已同步重排样张结构`)
  832. }
  833. }
  834. function useRecommendedTemplate() {
  835. templateSelectionMode.value = "auto"
  836. selectedTemplateId.value = templateRecommendation.value.id
  837. ElMessage.success(`已使用系统推荐的${recommendedTemplate.value.name}`)
  838. }
  839. function templateCoverStyle(templateId: AiCoursewareTemplateId): Record<string, string> {
  840. const master = getAiCoursewareTemplateMaster(templateId)
  841. const cover = master.pages.find(page => page.layout === "cover") || master.pages[0]
  842. const backgroundImage = resolveTemplateAssetUrl(cover?.backgroundImage)
  843. if (backgroundImage) return { backgroundImage: `url("${backgroundImage}")` }
  844. return { background: cover?.background || selectedTemplate.value.palettes[0].background }
  845. }
  846. function preloadImage(url: string) {
  847. if (!url || typeof Image === "undefined") return Promise.resolve()
  848. return new Promise<void>((resolve, reject) => {
  849. const image = new Image()
  850. image.onload = () => resolve()
  851. image.onerror = () => reject(new Error(`failed to load ${url}`))
  852. image.src = url
  853. })
  854. }
  855. function templateFit(templateId: AiCoursewareTemplateId) {
  856. return outline.value
  857. ? scoreAiCoursewareTemplate(outline.value, templateId)
  858. : { templateId, score: 80, level: "usable" as const, label: "可以使用" as const, reason: "生成大纲后评估" }
  859. }
  860. async function prepareDraftForUse() {
  861. if (!draftOutline.value) return
  862. draftPreparationState.value = "optimizing"
  863. normalizeDraftLocally()
  864. rebuildDraftPreview()
  865. if (draftQuality.value?.passed) {
  866. draftPreparationState.value = "ready"
  867. ElMessage.success("课件已完成自动检查,可以直接应用")
  868. return
  869. }
  870. console.warn("AI课件自动检查发现待修复项", draftQuality.value?.errors)
  871. if (automaticRepairAttempts.value >= MAX_AUTOMATIC_REPAIR_ATTEMPTS) {
  872. draftPreparationState.value = "failed"
  873. return
  874. }
  875. automaticRepairAttempts.value += 1
  876. await requestAutomaticRepair()
  877. }
  878. async function requestAutomaticRepair() {
  879. if (!draftOutline.value || !pptWork.id || !draftQuality.value) {
  880. draftPreparationState.value = "failed"
  881. return
  882. }
  883. const repairSummary = draftQuality.value.errors
  884. .slice(0, 12)
  885. .map(issue => `${issue.pageNo ? `第${issue.pageNo}页` : "整套课件"}:${issue.message}`)
  886. .join(";")
  887. taskMode.value = "full"
  888. const res = await httpAjaxErrMsg(aiCoursewareGenerateApi, {
  889. id: pptWork.id,
  890. fromType: queryParams.pptResourcesType || queryParams.fromType,
  891. outline: draftOutline.value,
  892. templateId: selectedTemplateId.value,
  893. visualPrompt: `${buildVisualPrompt()}系统检查发现以下问题,请在保持教学目标和页数不变的前提下全部修正:${repairSummary}。`,
  894. preferences: { ...preferences }
  895. })
  896. if (res.code !== 200) {
  897. draftPreparationState.value = "failed"
  898. return
  899. }
  900. taskInfo.value = res.data as AiCoursewareTaskInfo
  901. await pollTask(taskInfo.value.taskId)
  902. }
  903. async function retryAutomaticOptimization() {
  904. automaticRepairAttempts.value = 0
  905. await prepareDraftForUse()
  906. }
  907. function normalizeDraftLocally() {
  908. if (!draftOutline.value) return
  909. const imageUseCounts = new Map<string, number>()
  910. draftOutline.value.pages.forEach((page, index) => {
  911. if (!page.visualPlan) page.visualPlan = {}
  912. if (!page.studentContent) page.studentContent = { headline: "", points: [] }
  913. const movedTeacherNotes: string[] = []
  914. const headline = cleanDraftText(page.studentContent.headline, 24)
  915. if (isTeacherOnlyText(headline)) movedTeacherNotes.push(headline)
  916. page.studentContent.headline = isTeacherOnlyText(headline) ? "" : headline
  917. const excluded = new Set([page.title, page.studentContent.headline].map(normalizeDraftText).filter(Boolean))
  918. const pointKeys = new Set<string>()
  919. const points = (page.studentContent.points?.length ? page.studentContent.points : page.bullets || [])
  920. .map(item => cleanDraftText(item, 22))
  921. .filter(item => {
  922. if (!item) return false
  923. if (isTeacherOnlyText(item)) {
  924. movedTeacherNotes.push(item)
  925. return false
  926. }
  927. const key = normalizeDraftText(item)
  928. if (!key || excluded.has(key) || pointKeys.has(key)) return false
  929. pointKeys.add(key)
  930. return true
  931. })
  932. .slice(0, 4)
  933. page.studentContent.points = points
  934. page.bullets = [...points]
  935. page.visualPlan.visualDensity = points.length <= 2 ? "low" : points.length >= 4 ? "high" : "medium"
  936. if (movedTeacherNotes.length) {
  937. if (!page.activity) page.activity = { task: "", steps: [] }
  938. page.activity.steps = uniqueDraftTexts([...(page.activity.steps || []), ...movedTeacherNotes])
  939. }
  940. if (!page.classroomAction) {
  941. page.classroomAction = { teacherInstruction: "", studentTask: page.studentContent.headline || page.title, interactionType: "" }
  942. }
  943. const studentTask = cleanDraftText(page.classroomAction.studentTask, 24)
  944. page.classroomAction.studentTask = !studentTask || isTeacherOnlyText(studentTask) ? page.studentContent.headline || page.title : studentTask
  945. const layout = page.visualPlan.layout || ""
  946. if (["hero_focus", "media_focus", "split_content", "diagram_focus"].includes(layout)) {
  947. page.visualPlan.focalContent ||= page.title
  948. page.visualPlan.mainVisual ||= page.imageKeywords?.[0] || `${page.title}的课堂主视觉`
  949. }
  950. if (page.image?.url) {
  951. const useCount = (imageUseCounts.get(page.image.url) || 0) + 1
  952. imageUseCounts.set(page.image.url, useCount)
  953. if (useCount > 2) {
  954. page.image = undefined
  955. page.resourceBindings = (page.resourceBindings || []).filter(binding => binding.resourceType !== "IMG")
  956. }
  957. }
  958. if (index > 0) {
  959. const fallbackInstruction = `引导学生完成“${page.classroomAction.studentTask || page.title}”,根据学生的语言、动作或声音表现及时反馈。`
  960. const instruction = cleanDraftText(page.classroomAction.teacherInstruction || page.teacherTips || page.speakerNotes) || fallbackInstruction
  961. page.classroomAction.teacherInstruction = instruction
  962. page.teacherTips ||= instruction
  963. page.speakerNotes ||= instruction
  964. }
  965. })
  966. }
  967. function cleanDraftText(value?: string, limit?: number) {
  968. const cleaned = String(value || "")
  969. .replace(/\s+/g, " ")
  970. .trim()
  971. return limit ? cleaned.slice(0, limit) : cleaned
  972. }
  973. function normalizeDraftText(value?: string) {
  974. return cleanDraftText(value)
  975. .replace(/[,。!?、;:,.!?;:\s]+/g, "")
  976. .toLowerCase()
  977. }
  978. function uniqueDraftTexts(values: string[]) {
  979. const keys = new Set<string>()
  980. return values.filter(value => {
  981. const key = normalizeDraftText(value)
  982. if (!key || keys.has(key)) return false
  983. keys.add(key)
  984. return true
  985. })
  986. }
  987. function isTeacherOnlyText(value?: string) {
  988. const text = cleanDraftText(value)
  989. return Boolean(text && (TEACHER_VISIBLE_PATTERN.test(text) || PLACEHOLDER_PATTERN.test(text)))
  990. }
  991. function updateStudentHeadline(page: AiCoursewarePage, event: Event) {
  992. if (!page.studentContent) page.studentContent = { headline: "", points: [] }
  993. page.studentContent.headline = (event.target as HTMLInputElement).value.trim()
  994. }
  995. function updateStudentPoints(page: AiCoursewarePage, event: Event) {
  996. if (!page.studentContent) page.studentContent = { headline: "", points: [] }
  997. const points = (event.target as HTMLTextAreaElement).value
  998. .split("\n")
  999. .map(item => item.trim())
  1000. .filter(Boolean)
  1001. page.studentContent.points = points
  1002. page.bullets = points
  1003. }
  1004. function buildExtraPrompt() {
  1005. return extraPrompt.value.trim()
  1006. }
  1007. function buildVisualPrompt() {
  1008. const base = selectedTemplate.value.visualPrompt
  1009. const system = `模板布局族:${selectedTemplate.value.layoutFamily}。字体体系:${selectedTemplate.value.typography}。背景体系:${selectedTemplate.value.backgroundStyle}。素材画风:${selectedTemplate.value.illustrationStyle}。`
  1010. const layouts = [...new Set(selectedTemplate.value.layoutCapabilities || Object.values(selectedTemplate.value.pageLayouts))].join("、")
  1011. const asset =
  1012. preferences.assetStyle === "illustration"
  1013. ? "主视觉使用统一画风插画。"
  1014. : preferences.assetStyle === "photo"
  1015. ? "主视觉优先真实照片。"
  1016. : "插画和真实照片按教学内容合理混用。"
  1017. const source =
  1018. preferences.sourceImagePolicy === "strict"
  1019. ? "优先保留教材原图,不随意替换。"
  1020. : preferences.sourceImagePolicy === "creative"
  1021. ? "允许根据教学目标重新创作主视觉。"
  1022. : "教材原图与新视觉保持平衡。"
  1023. const palette =
  1024. paletteVariant.value === 1
  1025. ? "配色使用清新蓝绿体系。"
  1026. : paletteVariant.value === 2
  1027. ? "配色使用柔和紫色与珊瑚色体系。"
  1028. : "配色保持明快且有清晰对比。"
  1029. return `${base}${system}可用视觉版式:${layouts}。版式只按每页真实内容需求选择,不得反向增加歌词、谱例、聆听或活动页面。模板场景:${selectedTemplate.value.scene}。${asset}${source}${palette}整套课件必须共享角色外观、环境、光线和重复道具;一页只保留一个视觉焦点。`
  1030. }
  1031. function formatPageNo(pageNo?: number) {
  1032. return String(pageNo || 0).padStart(2, "0")
  1033. }
  1034. function shortProgressLabel(message?: string) {
  1035. if (!message) return ""
  1036. if (message.includes("重新生成第")) return "重做样张"
  1037. if (message.includes("读取") || message.includes("等待")) return "准备中"
  1038. if (message.includes("页面") || message.includes("内容")) return "生成内容"
  1039. if (message.includes("优化") || message.includes("教学设计")) return "优化设计"
  1040. if (message.includes("图片") || message.includes("检索")) return "匹配图片"
  1041. if (message.includes("完成")) return "生成完成"
  1042. if (message.includes("失败")) return "生成失败"
  1043. return message.length > 4 ? message.slice(0, 4) : message
  1044. }
  1045. </script>
  1046. <style lang="scss" scoped>
  1047. .ai-dialog {
  1048. max-height: calc(100vh - 64px);
  1049. display: flex;
  1050. flex-direction: column;
  1051. color: #1f2933;
  1052. }
  1053. .ai-dialog.review-mode {
  1054. height: 82vh;
  1055. }
  1056. .ai-dialog.review-mode .header {
  1057. .title {
  1058. font-size: 22px;
  1059. line-height: 1.25;
  1060. }
  1061. .sub {
  1062. margin-top: 3px;
  1063. font-size: 13px;
  1064. }
  1065. }
  1066. .header,
  1067. .footer {
  1068. display: flex;
  1069. align-items: center;
  1070. justify-content: space-between;
  1071. }
  1072. .header,
  1073. .workflow-steps,
  1074. .footer {
  1075. flex-shrink: 0;
  1076. }
  1077. .title {
  1078. font-size: 24px;
  1079. font-weight: 700;
  1080. color: #1f2933;
  1081. }
  1082. .sub {
  1083. margin-top: 6px;
  1084. color: #7b8794;
  1085. font-size: 14px;
  1086. }
  1087. .workflow-steps {
  1088. display: grid;
  1089. grid-template-columns: repeat(3, 1fr);
  1090. margin-top: 12px;
  1091. padding: 4px;
  1092. border-radius: 8px;
  1093. background: #f4f7fa;
  1094. }
  1095. .workflow-step {
  1096. position: relative;
  1097. display: flex;
  1098. align-items: center;
  1099. justify-content: center;
  1100. gap: 8px;
  1101. height: 34px;
  1102. color: #7b8794;
  1103. font-size: 13px;
  1104. font-weight: 600;
  1105. &.active {
  1106. border-radius: 6px;
  1107. background: #fff;
  1108. color: $themeColor;
  1109. box-shadow: 0 2px 8px rgba(31, 41, 51, 0.08);
  1110. }
  1111. &.done {
  1112. color: #168f86;
  1113. }
  1114. }
  1115. .step-no {
  1116. display: inline-flex;
  1117. align-items: center;
  1118. justify-content: center;
  1119. width: 22px;
  1120. height: 22px;
  1121. border-radius: 50%;
  1122. background: #e7edf5;
  1123. font-size: 12px;
  1124. }
  1125. .workflow-step.active .step-no {
  1126. background: $themeColor;
  1127. color: #fff;
  1128. }
  1129. .workflow-step.done .step-no {
  1130. background: #dff3ed;
  1131. color: #168f86;
  1132. }
  1133. .setup-stage {
  1134. min-height: 0;
  1135. flex: 0 1 auto;
  1136. overflow: auto;
  1137. padding-right: 4px;
  1138. }
  1139. .stage-intro {
  1140. display: flex;
  1141. align-items: center;
  1142. justify-content: space-between;
  1143. gap: 20px;
  1144. margin-top: 16px;
  1145. padding: 14px 16px;
  1146. border-radius: 8px;
  1147. background: #f7faff;
  1148. }
  1149. .stage-title {
  1150. color: #1f2933;
  1151. font-size: 16px;
  1152. font-weight: 700;
  1153. }
  1154. .stage-desc {
  1155. margin-top: 4px;
  1156. color: #7b8794;
  1157. font-size: 12px;
  1158. }
  1159. .saved-state {
  1160. flex-shrink: 0;
  1161. padding: 5px 9px;
  1162. border-radius: 999px;
  1163. background: #eaf7f4;
  1164. color: #168f86;
  1165. font-size: 12px;
  1166. font-weight: 600;
  1167. }
  1168. .progress-strip,
  1169. .loading-strip {
  1170. margin-top: 12px;
  1171. height: 42px;
  1172. display: flex;
  1173. align-items: center;
  1174. gap: 12px;
  1175. }
  1176. .loading-strip {
  1177. color: #52616b;
  1178. font-size: 13px;
  1179. }
  1180. .loading-dot {
  1181. width: 14px;
  1182. height: 14px;
  1183. border: 2px solid #d7e7ff;
  1184. border-top-color: $themeColor;
  1185. border-radius: 50%;
  1186. animation: loading-rotate 0.8s linear infinite;
  1187. }
  1188. .current-step {
  1189. width: 64px;
  1190. flex-shrink: 0;
  1191. color: $themeColor;
  1192. font-size: 13px;
  1193. font-weight: 600;
  1194. white-space: nowrap;
  1195. }
  1196. .progress-value {
  1197. width: 42px;
  1198. text-align: right;
  1199. font-size: 13px;
  1200. color: $themeColor;
  1201. font-weight: 700;
  1202. }
  1203. .progress-line {
  1204. height: 6px;
  1205. flex: 1;
  1206. overflow: hidden;
  1207. border-radius: 999px;
  1208. background: #e7edf5;
  1209. }
  1210. .progress-bar {
  1211. height: 100%;
  1212. border-radius: inherit;
  1213. background: $themeColor;
  1214. transition: width 0.25s ease;
  1215. }
  1216. @keyframes loading-rotate {
  1217. to {
  1218. transform: rotate(360deg);
  1219. }
  1220. }
  1221. .extra {
  1222. margin-top: 12px;
  1223. }
  1224. .setup-primary-grid {
  1225. display: grid;
  1226. grid-template-columns: repeat(2, minmax(0, 1fr));
  1227. gap: 12px;
  1228. margin-top: 14px;
  1229. label > span {
  1230. display: block;
  1231. margin-bottom: 6px;
  1232. color: #52616b;
  1233. font-size: 13px;
  1234. }
  1235. select {
  1236. width: 100%;
  1237. height: 38px;
  1238. padding: 0 10px;
  1239. border: 1px solid #dfe5ec;
  1240. border-radius: 7px;
  1241. background: #fff;
  1242. color: #33404d;
  1243. }
  1244. }
  1245. .template-real-cover {
  1246. display: block;
  1247. width: 116px;
  1248. aspect-ratio: 16 / 9;
  1249. border-radius: 6px;
  1250. background-position: center;
  1251. background-size: cover;
  1252. box-shadow: inset 0 0 0 1px rgba(31, 41, 51, 0.08);
  1253. &.option {
  1254. width: 100%;
  1255. margin-bottom: 8px;
  1256. }
  1257. }
  1258. .compact-template-selector {
  1259. padding: 12px;
  1260. border: 1px solid #edf1f5;
  1261. border-radius: 8px;
  1262. }
  1263. .show-all-templates,
  1264. .advanced-toggle,
  1265. .outline-toggle {
  1266. margin-top: 10px;
  1267. padding: 0;
  1268. border: 0;
  1269. background: transparent;
  1270. color: $themeColor;
  1271. font-size: 12px;
  1272. cursor: pointer;
  1273. }
  1274. .advanced-toggle {
  1275. color: #657381;
  1276. }
  1277. .advanced-settings {
  1278. margin-top: 8px;
  1279. }
  1280. .generation-preferences {
  1281. margin-top: 12px;
  1282. padding: 12px;
  1283. border: 1px solid #e5eaf0;
  1284. border-radius: 8px;
  1285. background: #fafcff;
  1286. }
  1287. .preference-grid {
  1288. display: grid;
  1289. grid-template-columns: repeat(4, minmax(140px, 1fr));
  1290. gap: 10px;
  1291. label,
  1292. span {
  1293. display: block;
  1294. }
  1295. span {
  1296. margin-bottom: 5px;
  1297. color: #52616b;
  1298. font-size: 12px;
  1299. }
  1300. input,
  1301. select {
  1302. width: 100%;
  1303. height: 34px;
  1304. padding: 0 8px;
  1305. border: 1px solid #dfe5ec;
  1306. border-radius: 6px;
  1307. background: #fff;
  1308. }
  1309. }
  1310. .media-options {
  1311. display: flex;
  1312. gap: 18px;
  1313. margin-top: 10px;
  1314. color: #52616b;
  1315. font-size: 13px;
  1316. input {
  1317. margin-right: 6px;
  1318. }
  1319. }
  1320. .style-selector {
  1321. margin-top: 12px;
  1322. }
  1323. .template-selector-head {
  1324. display: flex;
  1325. align-items: flex-end;
  1326. justify-content: space-between;
  1327. gap: 16px;
  1328. }
  1329. .template-help {
  1330. margin-top: -3px;
  1331. color: #7b8794;
  1332. font-size: 12px;
  1333. }
  1334. .auto-template-button {
  1335. flex-shrink: 0;
  1336. padding: 5px 10px;
  1337. border: 1px solid #cfe0f6;
  1338. border-radius: 6px;
  1339. background: #f5f9ff;
  1340. color: $themeColor;
  1341. font-size: 12px;
  1342. cursor: pointer;
  1343. }
  1344. .template-recommendation {
  1345. display: flex;
  1346. align-items: center;
  1347. gap: 8px;
  1348. margin-top: 8px;
  1349. padding: 8px 10px;
  1350. border-radius: 6px;
  1351. background: #eef6ff;
  1352. color: #52616b;
  1353. font-size: 12px;
  1354. span:first-child {
  1355. padding: 2px 6px;
  1356. border-radius: 999px;
  1357. background: $themeColor;
  1358. color: #fff;
  1359. }
  1360. strong {
  1361. color: #1f2933;
  1362. }
  1363. }
  1364. .style-options {
  1365. display: grid;
  1366. grid-template-columns: repeat(3, minmax(0, 1fr));
  1367. gap: 10px;
  1368. margin-top: 9px;
  1369. }
  1370. .style-option {
  1371. min-width: 0;
  1372. padding: 9px;
  1373. border: 1px solid #dfe5ec;
  1374. border-radius: 8px;
  1375. background: #fff;
  1376. text-align: left;
  1377. cursor: pointer;
  1378. }
  1379. .style-option strong,
  1380. .style-option span,
  1381. .style-option small {
  1382. display: block;
  1383. }
  1384. .style-option > span:not(.template-mini):not(.template-card-title) {
  1385. margin-top: 4px;
  1386. color: #7b8794;
  1387. font-size: 12px;
  1388. }
  1389. .style-option small {
  1390. margin-top: 6px;
  1391. color: #52616b;
  1392. font-size: 11px;
  1393. font-weight: 600;
  1394. }
  1395. .style-option.active {
  1396. border-color: $themeColor;
  1397. box-shadow: 0 0 0 2px rgba($themeColor, 0.12);
  1398. }
  1399. .template-mini {
  1400. position: relative;
  1401. height: 66px;
  1402. overflow: hidden;
  1403. margin-bottom: 8px;
  1404. border-radius: 6px;
  1405. background: var(--template-background);
  1406. box-shadow: inset 0 0 0 1px rgba(31, 41, 51, 0.06);
  1407. i {
  1408. position: absolute;
  1409. display: block;
  1410. }
  1411. .mini-band {
  1412. left: 0;
  1413. top: 0;
  1414. width: 32%;
  1415. height: 100%;
  1416. background: var(--template-primary);
  1417. }
  1418. .mini-title {
  1419. left: 38%;
  1420. top: 13px;
  1421. width: 42%;
  1422. height: 7px;
  1423. border-radius: 4px;
  1424. background: var(--template-primary);
  1425. }
  1426. .mini-content {
  1427. left: 38%;
  1428. width: 52%;
  1429. height: 14px;
  1430. border-radius: 3px;
  1431. background: var(--template-surface);
  1432. box-shadow: 0 2px 5px rgba(31, 41, 51, 0.08);
  1433. }
  1434. .mini-content.first {
  1435. top: 29px;
  1436. }
  1437. .mini-content.second {
  1438. top: 47px;
  1439. width: 37%;
  1440. }
  1441. .mini-accent {
  1442. right: 7%;
  1443. bottom: 6px;
  1444. width: 11px;
  1445. height: 11px;
  1446. border-radius: 50%;
  1447. background: var(--template-accent);
  1448. }
  1449. }
  1450. .template-card-title {
  1451. display: flex !important;
  1452. align-items: center;
  1453. justify-content: space-between;
  1454. gap: 8px;
  1455. em {
  1456. padding: 2px 5px;
  1457. border-radius: 999px;
  1458. background: #eaf7f4;
  1459. color: #168f86;
  1460. font-size: 10px;
  1461. font-style: normal;
  1462. font-weight: 600;
  1463. }
  1464. }
  1465. .label {
  1466. margin-bottom: 8px;
  1467. font-size: 14px;
  1468. color: #52616b;
  1469. }
  1470. .outline {
  1471. margin-top: 10px;
  1472. min-height: 0;
  1473. flex: 1;
  1474. display: block;
  1475. overflow: auto;
  1476. padding-right: 4px;
  1477. }
  1478. .sample-stage-head {
  1479. display: flex;
  1480. align-items: center;
  1481. justify-content: space-between;
  1482. gap: 12px;
  1483. button {
  1484. height: 30px;
  1485. padding: 0 10px;
  1486. border: 1px solid #cbd9e8;
  1487. border-radius: 6px;
  1488. background: #fff;
  1489. color: $themeColor;
  1490. font-size: 12px;
  1491. cursor: pointer;
  1492. }
  1493. }
  1494. .sample-template-current {
  1495. display: flex;
  1496. align-items: center;
  1497. min-width: 0;
  1498. gap: 7px;
  1499. color: #657381;
  1500. font-size: 12px;
  1501. strong {
  1502. overflow: hidden;
  1503. color: #1f2933;
  1504. font-size: 14px;
  1505. text-overflow: ellipsis;
  1506. white-space: nowrap;
  1507. }
  1508. small {
  1509. flex-shrink: 0;
  1510. padding: 2px 6px;
  1511. border-radius: 999px;
  1512. background: #eaf7f4;
  1513. color: #168f86;
  1514. font-size: 10px;
  1515. font-weight: 600;
  1516. }
  1517. }
  1518. .sample-carousel-shell {
  1519. display: grid;
  1520. grid-template-columns: 30px minmax(0, 1fr) 30px;
  1521. align-items: center;
  1522. gap: 6px;
  1523. margin-top: 8px;
  1524. }
  1525. .sample-carousel-arrow {
  1526. width: 30px;
  1527. height: 30px;
  1528. padding: 0;
  1529. border: 1px solid #d8e1eb;
  1530. border-radius: 50%;
  1531. background: #fff;
  1532. color: #52616b;
  1533. font-size: 21px;
  1534. line-height: 26px;
  1535. cursor: pointer;
  1536. box-shadow: 0 3px 10px rgba(31, 41, 51, 0.08);
  1537. &:hover:not(:disabled) {
  1538. border-color: $themeColor;
  1539. color: $themeColor;
  1540. }
  1541. &:disabled {
  1542. opacity: 0.28;
  1543. cursor: default;
  1544. }
  1545. }
  1546. .sample-thumbnail-track {
  1547. display: flex;
  1548. gap: 8px;
  1549. min-width: 0;
  1550. overflow-x: auto;
  1551. padding: 2px;
  1552. scroll-behavior: smooth;
  1553. scroll-snap-type: x proximity;
  1554. scrollbar-width: none;
  1555. &::-webkit-scrollbar {
  1556. display: none;
  1557. }
  1558. }
  1559. .sample-thumbnail-item {
  1560. width: 120px;
  1561. flex: 0 0 120px;
  1562. padding: 0;
  1563. overflow: hidden;
  1564. border: 2px solid transparent;
  1565. border-radius: 6px;
  1566. background: #fff;
  1567. color: #52616b;
  1568. text-align: left;
  1569. cursor: pointer;
  1570. scroll-snap-align: start;
  1571. box-shadow: 0 2px 7px rgba(31, 41, 51, 0.07);
  1572. transition:
  1573. border-color 0.16s ease,
  1574. box-shadow 0.16s ease;
  1575. &.active {
  1576. border-color: $themeColor;
  1577. box-shadow: 0 0 0 2px rgba($themeColor, 0.1);
  1578. }
  1579. > span {
  1580. display: block;
  1581. padding: 5px 6px 6px;
  1582. overflow: hidden;
  1583. font-size: 11px;
  1584. font-weight: 600;
  1585. text-overflow: ellipsis;
  1586. white-space: nowrap;
  1587. }
  1588. }
  1589. .compact-template-panel {
  1590. margin-top: 8px;
  1591. padding: 10px;
  1592. border: 1px solid #e5eaf0;
  1593. border-radius: 8px;
  1594. background: #fafcff;
  1595. .sample-template-picker {
  1596. grid-template-columns: repeat(4, minmax(0, 1fr));
  1597. }
  1598. .template-real-cover.option {
  1599. width: 86px;
  1600. flex-shrink: 0;
  1601. margin: 0;
  1602. }
  1603. }
  1604. .sample-detail-section {
  1605. margin-top: 10px;
  1606. }
  1607. .sample-detail-heading {
  1608. display: flex;
  1609. align-items: center;
  1610. justify-content: space-between;
  1611. min-height: 26px;
  1612. gap: 16px;
  1613. margin-bottom: 6px;
  1614. > div {
  1615. display: flex;
  1616. align-items: baseline;
  1617. min-width: 0;
  1618. gap: 8px;
  1619. }
  1620. span {
  1621. flex-shrink: 0;
  1622. color: $themeColor;
  1623. font-size: 12px;
  1624. font-weight: 700;
  1625. }
  1626. strong {
  1627. overflow: hidden;
  1628. color: #1f2933;
  1629. font-size: 15px;
  1630. text-overflow: ellipsis;
  1631. white-space: nowrap;
  1632. }
  1633. small {
  1634. overflow: hidden;
  1635. max-width: 48%;
  1636. color: #8a96a3;
  1637. font-size: 11px;
  1638. text-align: right;
  1639. text-overflow: ellipsis;
  1640. white-space: nowrap;
  1641. }
  1642. }
  1643. .sample-detail-layout {
  1644. display: grid;
  1645. grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1.48fr);
  1646. align-items: stretch;
  1647. gap: 12px;
  1648. }
  1649. .sample-outline-panel,
  1650. .sample-preview-column {
  1651. min-width: 0;
  1652. padding: 12px;
  1653. border: 1px solid #dfe6ee;
  1654. border-radius: 8px;
  1655. background: #fff;
  1656. }
  1657. .sample-outline-panel {
  1658. display: flex;
  1659. }
  1660. .sample-preview-column {
  1661. display: flex;
  1662. flex-direction: column;
  1663. }
  1664. .simplified-page-editor {
  1665. display: flex;
  1666. width: 100%;
  1667. flex-direction: column;
  1668. padding: 0;
  1669. overflow: visible;
  1670. border: 0;
  1671. border-radius: 0;
  1672. background: transparent;
  1673. .title-editor {
  1674. max-width: none;
  1675. }
  1676. }
  1677. .simplified-page-editor .field-card {
  1678. margin-top: 11px;
  1679. padding: 11px 0 0;
  1680. border: 0;
  1681. border-top: 1px solid #edf1f5;
  1682. border-radius: 0;
  1683. background: transparent;
  1684. }
  1685. .simplified-page-editor .page-bullets {
  1686. min-height: 124px;
  1687. height: 124px;
  1688. }
  1689. .content-readability-hint {
  1690. margin-top: 6px;
  1691. color: #b76e00;
  1692. font-size: 11px;
  1693. line-height: 1.45;
  1694. }
  1695. .representative-samples {
  1696. display: grid;
  1697. grid-template-columns: repeat(3, minmax(0, 1fr));
  1698. gap: 6px;
  1699. margin-bottom: 10px;
  1700. button {
  1701. display: grid;
  1702. grid-template-columns: 24px 1fr;
  1703. grid-template-rows: auto auto;
  1704. column-gap: 6px;
  1705. align-items: center;
  1706. min-width: 0;
  1707. padding: 7px;
  1708. border: 1px solid #dfe5ec;
  1709. border-radius: 6px;
  1710. background: #fff;
  1711. color: #52616b;
  1712. text-align: left;
  1713. cursor: pointer;
  1714. }
  1715. button.active {
  1716. border-color: $themeColor;
  1717. background: #f5f9ff;
  1718. }
  1719. button.approved span {
  1720. background: #1f9d69;
  1721. }
  1722. span {
  1723. grid-row: 1 / 3;
  1724. display: grid;
  1725. width: 24px;
  1726. height: 24px;
  1727. place-items: center;
  1728. border-radius: 50%;
  1729. background: $themeColor;
  1730. color: #fff;
  1731. font-size: 11px;
  1732. font-weight: 700;
  1733. }
  1734. strong,
  1735. small {
  1736. overflow: hidden;
  1737. text-overflow: ellipsis;
  1738. white-space: nowrap;
  1739. }
  1740. strong {
  1741. font-size: 11px;
  1742. }
  1743. small {
  1744. color: #8a96a3;
  1745. font-size: 9px;
  1746. }
  1747. &.story {
  1748. .mini-band {
  1749. width: 100%;
  1750. height: 100%;
  1751. opacity: 0.22;
  1752. }
  1753. .mini-title {
  1754. left: 10%;
  1755. top: 12px;
  1756. width: 46%;
  1757. }
  1758. .mini-content {
  1759. left: 10%;
  1760. background: rgba(255, 255, 255, 0.9);
  1761. }
  1762. .mini-accent {
  1763. right: 12%;
  1764. bottom: 13px;
  1765. width: 30px;
  1766. height: 30px;
  1767. opacity: 0.85;
  1768. }
  1769. }
  1770. &.activity {
  1771. .mini-band {
  1772. left: 7%;
  1773. top: 12px;
  1774. width: 18%;
  1775. height: 42px;
  1776. border-radius: 50%;
  1777. }
  1778. .mini-title {
  1779. left: 32%;
  1780. width: 48%;
  1781. }
  1782. .mini-content.first {
  1783. left: 32%;
  1784. top: 29px;
  1785. width: 58%;
  1786. }
  1787. .mini-content.second {
  1788. left: 32%;
  1789. top: 47px;
  1790. width: 45%;
  1791. }
  1792. }
  1793. &.technology {
  1794. background: var(--template-dark, #102744);
  1795. .mini-band {
  1796. width: 100%;
  1797. height: 3px;
  1798. opacity: 0.8;
  1799. }
  1800. .mini-title {
  1801. left: 10%;
  1802. background: var(--template-secondary);
  1803. }
  1804. .mini-content {
  1805. left: 10%;
  1806. width: 76%;
  1807. background: rgba(255, 255, 255, 0.15);
  1808. }
  1809. .mini-accent {
  1810. border-radius: 3px;
  1811. }
  1812. }
  1813. &.culture {
  1814. .mini-band {
  1815. left: 78%;
  1816. width: 14%;
  1817. height: 100%;
  1818. opacity: 0.18;
  1819. }
  1820. .mini-title {
  1821. left: 10%;
  1822. width: 44%;
  1823. }
  1824. .mini-content {
  1825. left: 10%;
  1826. width: 58%;
  1827. background: var(--template-soft);
  1828. box-shadow: none;
  1829. }
  1830. }
  1831. &.academic {
  1832. .mini-band {
  1833. width: 4%;
  1834. }
  1835. .mini-title {
  1836. left: 12%;
  1837. width: 54%;
  1838. }
  1839. .mini-content {
  1840. left: 12%;
  1841. width: 76%;
  1842. border-radius: 0;
  1843. box-shadow: none;
  1844. }
  1845. .mini-accent {
  1846. border-radius: 1px;
  1847. }
  1848. }
  1849. em.fit-usable {
  1850. background: #fff7e6;
  1851. color: #b76e00;
  1852. }
  1853. em.fit-low {
  1854. background: #fff1f0;
  1855. color: #cf1322;
  1856. }
  1857. }
  1858. .template-fit-warning {
  1859. display: flex;
  1860. align-items: center;
  1861. justify-content: space-between;
  1862. gap: 12px;
  1863. margin-top: 10px;
  1864. padding: 9px 12px;
  1865. border: 1px solid #ffd591;
  1866. border-radius: 7px;
  1867. background: #fffbe6;
  1868. color: #874d00;
  1869. font-size: 12px;
  1870. button {
  1871. flex: 0 0 auto;
  1872. border: 0;
  1873. background: transparent;
  1874. color: $themeColor;
  1875. font-weight: 700;
  1876. cursor: pointer;
  1877. }
  1878. }
  1879. .template-fit-warning.compact {
  1880. margin: 0 0 10px;
  1881. }
  1882. .template-load-error {
  1883. margin-bottom: 10px;
  1884. color: #b42318;
  1885. font-size: 12px;
  1886. overflow-wrap: anywhere;
  1887. }
  1888. .sample-template-picker {
  1889. display: grid;
  1890. grid-template-columns: repeat(2, minmax(0, 1fr));
  1891. gap: 6px;
  1892. margin: -2px 0 10px;
  1893. }
  1894. .sample-template-option {
  1895. display: flex;
  1896. align-items: center;
  1897. gap: 8px;
  1898. min-width: 0;
  1899. padding: 7px 8px;
  1900. border: 1px solid #dfe5ec;
  1901. border-radius: 6px;
  1902. background: #fff;
  1903. text-align: left;
  1904. cursor: pointer;
  1905. &.active {
  1906. border-color: $themeColor;
  1907. background: #f5f9ff;
  1908. }
  1909. > span:last-child {
  1910. min-width: 0;
  1911. }
  1912. strong,
  1913. small {
  1914. display: block;
  1915. }
  1916. strong {
  1917. overflow: hidden;
  1918. color: #33404d;
  1919. font-size: 11px;
  1920. text-overflow: ellipsis;
  1921. white-space: nowrap;
  1922. }
  1923. small {
  1924. margin-top: 2px;
  1925. color: #8a96a3;
  1926. font-size: 9px;
  1927. }
  1928. }
  1929. .template-swatches {
  1930. display: flex;
  1931. flex-shrink: 0;
  1932. overflow: hidden;
  1933. width: 34px;
  1934. height: 28px;
  1935. border-radius: 4px;
  1936. i {
  1937. flex: 1;
  1938. }
  1939. }
  1940. .sample-page-control {
  1941. display: grid;
  1942. grid-template-columns: auto minmax(0, 1fr) auto;
  1943. gap: 7px;
  1944. button,
  1945. select {
  1946. height: 32px;
  1947. border: 1px solid #dfe5ec;
  1948. border-radius: 6px;
  1949. background: #fff;
  1950. color: #52616b;
  1951. font-family: inherit;
  1952. font-size: 12px;
  1953. }
  1954. button {
  1955. padding: 0 10px;
  1956. cursor: pointer;
  1957. }
  1958. button:disabled {
  1959. cursor: not-allowed;
  1960. opacity: 0.45;
  1961. }
  1962. select {
  1963. min-width: 0;
  1964. padding: 0 8px;
  1965. }
  1966. }
  1967. .sample-feedback {
  1968. margin-top: auto;
  1969. padding-top: 10px;
  1970. border-top: 1px solid #e5eaf0;
  1971. }
  1972. .feedback-label {
  1973. color: #52616b;
  1974. font-size: 12px;
  1975. font-weight: 600;
  1976. }
  1977. .feedback-chips {
  1978. display: flex;
  1979. flex-wrap: wrap;
  1980. gap: 6px;
  1981. margin-top: 6px;
  1982. button {
  1983. height: 26px;
  1984. padding: 0 9px;
  1985. border: 1px solid #dfe5ec;
  1986. border-radius: 999px;
  1987. background: #fff;
  1988. color: #52616b;
  1989. font-family: inherit;
  1990. font-size: 11px;
  1991. cursor: pointer;
  1992. }
  1993. button.active {
  1994. border-color: $themeColor;
  1995. background: rgba($themeColor, 0.08);
  1996. color: $themeColor;
  1997. }
  1998. }
  1999. .sample-feedback textarea {
  2000. width: 100%;
  2001. height: 48px;
  2002. margin: 0;
  2003. padding: 8px 10px;
  2004. border: 1px solid #dfe5ec;
  2005. border-radius: 6px;
  2006. box-sizing: border-box;
  2007. resize: none;
  2008. font-family: inherit;
  2009. font-size: 12px;
  2010. line-height: 1.5;
  2011. }
  2012. .sample-feedback-action {
  2013. display: grid;
  2014. grid-template-columns: minmax(0, 1fr) auto;
  2015. align-items: end;
  2016. gap: 8px;
  2017. margin-top: 6px;
  2018. :deep(.button) {
  2019. height: 34px;
  2020. line-height: 34px;
  2021. white-space: nowrap;
  2022. }
  2023. }
  2024. .sample-canvas {
  2025. position: relative;
  2026. display: flex;
  2027. align-items: center;
  2028. justify-content: center;
  2029. overflow: auto;
  2030. min-height: 0;
  2031. flex: 1 1 auto;
  2032. padding: 10px;
  2033. border: 0;
  2034. border-radius: 6px;
  2035. background: #f1f4f8;
  2036. :deep(.thumbnail-slide) {
  2037. flex-shrink: 0;
  2038. border-radius: 6px;
  2039. box-shadow: 0 8px 24px rgba(31, 41, 51, 0.14);
  2040. }
  2041. }
  2042. .result-preview {
  2043. min-height: 0;
  2044. flex: 1;
  2045. margin-top: 14px;
  2046. display: flex;
  2047. flex-direction: column;
  2048. overflow: hidden;
  2049. }
  2050. .draft-status {
  2051. display: flex;
  2052. align-items: center;
  2053. gap: 12px;
  2054. padding: 12px 14px;
  2055. border: 1px solid #dce8f7;
  2056. border-radius: 10px;
  2057. background: #f6f9fe;
  2058. color: #35516f;
  2059. &.ready {
  2060. border-color: #cce8df;
  2061. background: #f0faf7;
  2062. color: #16776f;
  2063. }
  2064. &.failed {
  2065. border-color: #f3d7b2;
  2066. background: #fff8ee;
  2067. color: #9a5b08;
  2068. }
  2069. > div {
  2070. min-width: 0;
  2071. flex: 1;
  2072. }
  2073. strong,
  2074. span {
  2075. display: block;
  2076. }
  2077. strong {
  2078. color: #1f2933;
  2079. font-size: 14px;
  2080. }
  2081. > div > span {
  2082. margin-top: 3px;
  2083. font-size: 12px;
  2084. }
  2085. }
  2086. .draft-status-icon {
  2087. width: 28px;
  2088. height: 28px;
  2089. flex-shrink: 0;
  2090. display: inline-flex !important;
  2091. align-items: center;
  2092. justify-content: center;
  2093. border: 2px solid currentColor;
  2094. border-radius: 50%;
  2095. font-size: 15px !important;
  2096. font-weight: 800;
  2097. .optimizing & {
  2098. border-color: #c6d7ee;
  2099. border-top-color: $themeColor;
  2100. animation: loading-rotate 0.8s linear infinite;
  2101. }
  2102. }
  2103. .draft-workspace {
  2104. min-height: 0;
  2105. flex: 1;
  2106. display: grid;
  2107. grid-template-columns: 170px minmax(0, 1fr);
  2108. gap: 16px;
  2109. margin-top: 12px;
  2110. }
  2111. .draft-page-list {
  2112. min-height: 0;
  2113. overflow-y: auto;
  2114. padding: 3px 7px 3px 3px;
  2115. }
  2116. .draft-page-item {
  2117. width: 100%;
  2118. padding: 6px;
  2119. border: 1px solid transparent;
  2120. border-radius: 8px;
  2121. background: transparent;
  2122. color: #52616b;
  2123. text-align: left;
  2124. cursor: pointer;
  2125. transition:
  2126. border-color 0.16s ease,
  2127. background 0.16s ease;
  2128. + .draft-page-item {
  2129. margin-top: 7px;
  2130. }
  2131. &:hover {
  2132. background: #f5f8fc;
  2133. }
  2134. &.active {
  2135. border-color: $themeColor;
  2136. background: rgba($themeColor, 0.06);
  2137. box-shadow: 0 0 0 2px rgba($themeColor, 0.08);
  2138. }
  2139. :deep(.thumbnail-slide) {
  2140. border-radius: 5px;
  2141. box-shadow: 0 3px 10px rgba(31, 41, 51, 0.1);
  2142. }
  2143. > span {
  2144. display: block;
  2145. margin-top: 6px;
  2146. overflow: hidden;
  2147. font-size: 11px;
  2148. line-height: 1.4;
  2149. text-overflow: ellipsis;
  2150. white-space: nowrap;
  2151. }
  2152. }
  2153. .draft-preview-pane {
  2154. min-width: 0;
  2155. min-height: 0;
  2156. display: flex;
  2157. flex-direction: column;
  2158. }
  2159. .draft-preview-toolbar {
  2160. display: flex;
  2161. align-items: center;
  2162. justify-content: space-between;
  2163. gap: 14px;
  2164. margin-bottom: 8px;
  2165. span,
  2166. strong {
  2167. display: block;
  2168. }
  2169. span {
  2170. color: #7b8794;
  2171. font-size: 11px;
  2172. }
  2173. strong {
  2174. margin-top: 2px;
  2175. color: #1f2933;
  2176. font-size: 14px;
  2177. }
  2178. button {
  2179. padding: 7px 11px;
  2180. border: 1px solid #d9e2ec;
  2181. border-radius: 6px;
  2182. background: #fff;
  2183. color: #52616b;
  2184. cursor: pointer;
  2185. }
  2186. }
  2187. .draft-canvas-shell {
  2188. min-width: 0;
  2189. min-height: 0;
  2190. flex: 1;
  2191. display: flex;
  2192. align-items: center;
  2193. justify-content: center;
  2194. overflow: auto;
  2195. padding: 18px;
  2196. border: 1px solid #e2e8f0;
  2197. border-radius: 10px;
  2198. background: #eef2f7;
  2199. :deep(.thumbnail-slide) {
  2200. flex-shrink: 0;
  2201. border-radius: 7px;
  2202. box-shadow: 0 14px 34px rgba(31, 41, 51, 0.16);
  2203. }
  2204. }
  2205. .page-actions {
  2206. display: grid;
  2207. gap: 7px;
  2208. padding: 8px;
  2209. select,
  2210. input {
  2211. min-width: 0;
  2212. height: 30px;
  2213. padding: 0 7px;
  2214. border: 1px solid #dfe5ec;
  2215. border-radius: 5px;
  2216. font-size: 12px;
  2217. }
  2218. > div {
  2219. display: flex;
  2220. flex-wrap: wrap;
  2221. gap: 5px;
  2222. }
  2223. button {
  2224. padding: 4px 7px;
  2225. border: 1px solid #dfe5ec;
  2226. border-radius: 5px;
  2227. background: #fff;
  2228. color: #52616b;
  2229. font-size: 11px;
  2230. cursor: pointer;
  2231. }
  2232. button:disabled {
  2233. cursor: not-allowed;
  2234. opacity: 0.5;
  2235. }
  2236. }
  2237. .page-nav {
  2238. overflow: auto;
  2239. border: 1px solid #edf1f5;
  2240. border-radius: 8px;
  2241. background: #fafcff;
  2242. padding: 8px;
  2243. }
  2244. .nav-item {
  2245. width: 100%;
  2246. display: flex;
  2247. align-items: center;
  2248. gap: 10px;
  2249. min-height: 42px;
  2250. padding: 8px 10px;
  2251. border: 0;
  2252. border-radius: 6px;
  2253. background: transparent;
  2254. color: #52616b;
  2255. text-align: left;
  2256. cursor: pointer;
  2257. &.active {
  2258. background: #eaf4ff;
  2259. color: #1f2933;
  2260. .nav-no {
  2261. color: #fff;
  2262. background: $themeColor;
  2263. }
  2264. }
  2265. }
  2266. .nav-no {
  2267. width: 34px;
  2268. height: 28px;
  2269. line-height: 28px;
  2270. text-align: center;
  2271. border-radius: 5px;
  2272. color: #7b8794;
  2273. background: #edf1f5;
  2274. flex-shrink: 0;
  2275. font-size: 12px;
  2276. font-weight: 600;
  2277. }
  2278. .nav-title {
  2279. min-width: 0;
  2280. overflow: hidden;
  2281. text-overflow: ellipsis;
  2282. white-space: nowrap;
  2283. font-size: 13px;
  2284. font-weight: 600;
  2285. }
  2286. .page-editor {
  2287. min-width: 0;
  2288. overflow: auto;
  2289. border: 1px solid #edf1f5;
  2290. border-radius: 8px;
  2291. background: #fff;
  2292. padding: 16px;
  2293. }
  2294. .editor-head {
  2295. display: block;
  2296. }
  2297. .title-editor {
  2298. max-width: 460px;
  2299. }
  2300. .outline-field-label {
  2301. display: block;
  2302. margin-bottom: 8px;
  2303. color: #52616b;
  2304. font-size: 13px;
  2305. font-weight: 600;
  2306. }
  2307. .purpose-card {
  2308. margin-top: 12px;
  2309. }
  2310. .field-grid {
  2311. margin-top: 12px;
  2312. display: grid;
  2313. grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  2314. gap: 12px;
  2315. }
  2316. .field-card {
  2317. padding: 12px;
  2318. border: 1px solid #edf1f5;
  2319. border-radius: 8px;
  2320. background: #fbfcfe;
  2321. &.visual {
  2322. background: #fffaf3;
  2323. }
  2324. }
  2325. .field-title {
  2326. margin-bottom: 8px;
  2327. color: #52616b;
  2328. font-size: 13px;
  2329. font-weight: 600;
  2330. }
  2331. .page-title,
  2332. .purpose-input,
  2333. .headline-input,
  2334. .page-bullets,
  2335. .page-design,
  2336. .keyword-input,
  2337. .remark-input {
  2338. width: 100%;
  2339. border: 1px solid #d9d9d9;
  2340. border-radius: 6px;
  2341. box-sizing: border-box;
  2342. font-family: inherit;
  2343. }
  2344. .page-title {
  2345. height: 36px;
  2346. padding: 0 10px;
  2347. font-size: 16px;
  2348. font-weight: 600;
  2349. }
  2350. .purpose-input {
  2351. height: 36px;
  2352. padding: 0 10px;
  2353. font-size: 14px;
  2354. }
  2355. .headline-input {
  2356. height: 36px;
  2357. padding: 0 10px;
  2358. margin-bottom: 10px;
  2359. font-size: 14px;
  2360. }
  2361. .page-bullets,
  2362. .page-design {
  2363. height: 150px;
  2364. padding: 10px;
  2365. resize: vertical;
  2366. line-height: 1.5;
  2367. }
  2368. .full-field {
  2369. margin-top: 12px;
  2370. }
  2371. .page-design {
  2372. height: 90px;
  2373. }
  2374. .resource-card {
  2375. margin-top: 12px;
  2376. padding: 10px 12px;
  2377. border: 1px solid #dcefe9;
  2378. border-radius: 6px;
  2379. background: #f6fbf9;
  2380. }
  2381. .resource-head {
  2382. display: flex;
  2383. align-items: baseline;
  2384. gap: 10px;
  2385. }
  2386. .resource-hint {
  2387. color: #7b8794;
  2388. font-size: 12px;
  2389. }
  2390. .resource-list {
  2391. display: flex;
  2392. flex-wrap: wrap;
  2393. gap: 8px;
  2394. }
  2395. .resource-item {
  2396. display: flex;
  2397. align-items: center;
  2398. min-width: 0;
  2399. height: 30px;
  2400. padding: 0 10px;
  2401. border: 1px solid #cfe6de;
  2402. border-radius: 4px;
  2403. background: #fff;
  2404. font-size: 12px;
  2405. }
  2406. .resource-type {
  2407. margin-right: 8px;
  2408. color: #168f86;
  2409. font-weight: 600;
  2410. }
  2411. .resource-name {
  2412. max-width: 240px;
  2413. overflow: hidden;
  2414. color: #374151;
  2415. text-overflow: ellipsis;
  2416. white-space: nowrap;
  2417. }
  2418. .keyword-card {
  2419. margin-top: 12px;
  2420. }
  2421. .keyword-head {
  2422. display: flex;
  2423. align-items: baseline;
  2424. gap: 10px;
  2425. margin-bottom: 8px;
  2426. }
  2427. .keyword-label {
  2428. color: #52616b;
  2429. font-size: 13px;
  2430. font-weight: 600;
  2431. }
  2432. .keyword-hint {
  2433. color: #9aa5b1;
  2434. font-size: 12px;
  2435. }
  2436. .keyword-input {
  2437. height: 34px;
  2438. padding: 0 10px;
  2439. }
  2440. .remark-card {
  2441. margin-top: 12px;
  2442. padding: 10px 12px;
  2443. border-radius: 6px;
  2444. background: #f7f9fc;
  2445. }
  2446. .remark-head {
  2447. display: flex;
  2448. align-items: baseline;
  2449. gap: 10px;
  2450. margin-bottom: 8px;
  2451. }
  2452. .remark-title {
  2453. color: #52616b;
  2454. font-size: 13px;
  2455. font-weight: 600;
  2456. }
  2457. .remark-hint {
  2458. color: #9aa5b1;
  2459. font-size: 12px;
  2460. }
  2461. .remark-input {
  2462. height: 72px;
  2463. padding: 10px;
  2464. resize: vertical;
  2465. line-height: 1.5;
  2466. background: #fff;
  2467. }
  2468. .task {
  2469. min-height: 20px;
  2470. }
  2471. .footer {
  2472. margin-top: 14px;
  2473. padding-top: 12px;
  2474. border-top: 1px solid #edf1f5;
  2475. background: #fff;
  2476. justify-content: flex-end;
  2477. gap: 10px;
  2478. :deep(.button.primary) {
  2479. min-width: 154px;
  2480. height: 40px;
  2481. line-height: 40px;
  2482. font-size: 14px;
  2483. font-weight: 700;
  2484. }
  2485. }
  2486. .footer-progress {
  2487. min-width: 154px;
  2488. color: $themeColor;
  2489. font-size: 13px;
  2490. font-weight: 600;
  2491. text-align: center;
  2492. }
  2493. .ai-dialog.review-mode .footer {
  2494. margin-top: 10px;
  2495. padding-top: 10px;
  2496. :deep(.button.primary) {
  2497. height: 36px;
  2498. line-height: 36px;
  2499. }
  2500. }
  2501. @media (max-width: 900px) {
  2502. .ai-dialog.review-mode {
  2503. height: calc(100vh - 64px);
  2504. }
  2505. .setup-primary-grid,
  2506. .sample-detail-layout {
  2507. grid-template-columns: 1fr;
  2508. }
  2509. .sample-canvas {
  2510. justify-self: center;
  2511. max-width: 100%;
  2512. }
  2513. .sample-preview-column {
  2514. order: -1;
  2515. }
  2516. .compact-template-panel .sample-template-picker {
  2517. grid-template-columns: repeat(2, minmax(0, 1fr));
  2518. }
  2519. .draft-workspace {
  2520. grid-template-columns: 1fr;
  2521. }
  2522. .draft-page-list {
  2523. display: flex;
  2524. gap: 8px;
  2525. overflow-x: auto;
  2526. overflow-y: hidden;
  2527. padding: 3px 3px 8px;
  2528. }
  2529. .draft-page-item {
  2530. width: 160px;
  2531. flex-shrink: 0;
  2532. + .draft-page-item {
  2533. margin-top: 0;
  2534. }
  2535. }
  2536. }
  2537. @media (max-width: 640px) {
  2538. .workflow-step {
  2539. gap: 4px;
  2540. font-size: 12px;
  2541. }
  2542. .step-no {
  2543. width: 20px;
  2544. height: 20px;
  2545. }
  2546. .sample-carousel-shell {
  2547. grid-template-columns: 30px minmax(0, 1fr) 30px;
  2548. gap: 5px;
  2549. }
  2550. .sample-carousel-arrow {
  2551. width: 30px;
  2552. height: 30px;
  2553. }
  2554. .sample-feedback-action {
  2555. grid-template-columns: 1fr;
  2556. }
  2557. .sample-detail-heading {
  2558. align-items: flex-start;
  2559. flex-direction: column;
  2560. gap: 3px;
  2561. small {
  2562. max-width: none;
  2563. text-align: left;
  2564. white-space: normal;
  2565. }
  2566. }
  2567. .compact-template-panel .sample-template-picker {
  2568. grid-template-columns: 1fr;
  2569. }
  2570. .draft-status,
  2571. .draft-preview-toolbar,
  2572. .sample-stage-head {
  2573. align-items: flex-start;
  2574. flex-direction: column;
  2575. }
  2576. .footer {
  2577. flex-wrap: wrap;
  2578. }
  2579. }
  2580. </style>