aiGengrate.vue 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985
  1. <template>
  2. <Dialog
  3. :title="'AI生成课程'"
  4. v-model="dialogVisible"
  5. width="90%"
  6. :fullscreen="true"
  7. @update:fullscreen="(value) => (fullscreen = value)"
  8. >
  9. <div class="course-script-editor">
  10. <!-- 全屏遮挡层 -->
  11. <div v-if="isGenerating" class="loading-overlay">
  12. <div class="loading-content">
  13. <div class="loading-spinner"></div>
  14. <div class="loading-text">生成中...</div>
  15. </div>
  16. </div>
  17. <div class="main-container">
  18. <!-- 左侧步骤指示器 -->
  19. <div class="steps-sidebar">
  20. <div class="steps-container">
  21. <template v-for="(step, index) in steps" :key="step.id">
  22. <div
  23. :class="[
  24. 'step-item',
  25. {
  26. process: currentStep === step.id,
  27. finish: step.id < currentStep,
  28. wait: step.id > currentStep
  29. }
  30. ]"
  31. >
  32. <div class="step-circle">{{ step.id }}</div>
  33. <div class="step-title">{{ step.label }}</div>
  34. </div>
  35. <div
  36. v-if="index < steps.length - 1"
  37. class="step-line"
  38. :class="{ active: currentStep > step.id }"
  39. ></div>
  40. </template>
  41. </div>
  42. </div>
  43. <!-- 右侧内容区域 -->
  44. <div class="content-area">
  45. <!-- 步骤1:AI一句话生成 -->
  46. <div v-if="currentStep === 1" class="step-content">
  47. <div class="ai-input-container">
  48. <div class="ai-input-wrapper">
  49. <div class="ai-icon">🤖</div>
  50. <textarea
  51. v-model="scriptPrompt"
  52. placeholder="AI一句话生成课程脚本,例如:生成一节关于牛顿万有引力的小学科学课脚本..."
  53. class="ai-textarea"
  54. ></textarea>
  55. </div>
  56. <div class="selection-group">
  57. <div class="selection-item">
  58. <label>主讲老师</label>
  59. <el-select
  60. v-model="selectedMainTeacher"
  61. filterable
  62. size="large"
  63. placeholder="请选择主讲老师"
  64. style="width: 300px"
  65. clearable
  66. >
  67. <el-option
  68. v-for="teacher in digitalHumans"
  69. :key="teacher.name"
  70. :label="teacher.name"
  71. :value="teacher.name"
  72. />
  73. </el-select>
  74. </div>
  75. <div class="selection-item">
  76. <label>助讲老师</label>
  77. <el-select
  78. v-model="selectedAssistants"
  79. filterable
  80. size="large"
  81. placeholder="请选择助讲老师"
  82. style="width: 300px"
  83. clearable
  84. multiple
  85. >
  86. <el-option
  87. v-for="teacher in digitalHumans"
  88. :key="teacher.name"
  89. :label="teacher.name"
  90. :value="teacher.name"
  91. />
  92. </el-select>
  93. </div>
  94. <div class="selection-item">
  95. <label>主题类型</label>
  96. <el-select
  97. v-model="selectedThemeType"
  98. size="large"
  99. placeholder="请选择主题类型"
  100. style="width: 300px"
  101. >
  102. <el-option label="课程通用" value="13" />
  103. <el-option label="诗词课" value="256" />
  104. </el-select>
  105. </div>
  106. </div>
  107. <div class="button-group">
  108. <button
  109. class="generate-btn primary"
  110. :disabled="
  111. !scriptPrompt || !selectedMainTeacher || !selectedThemeType || isGenerating
  112. "
  113. @click="generateScript"
  114. >
  115. {{ isGenerating ? '生成中...' : '生成课程脚本' }}
  116. </button>
  117. <button
  118. v-if="hasDraftCache"
  119. class="generate-btn secondary"
  120. @click="loadDraftAndGotoStep2"
  121. >
  122. 查看草稿
  123. </button>
  124. </div>
  125. </div>
  126. </div>
  127. <!-- 步骤2:脚本编辑(含背景图/音生成) -->
  128. <div v-else-if="currentStep === 2" class="step-content">
  129. <!-- 固定顶部的一键操作栏 -->
  130. <div class="editor-toolbar sticky-top">
  131. <button
  132. class="toolbar-btn"
  133. @click="generateAllImages"
  134. :disabled="isGeneratingImages || isAnyImageGenerating"
  135. >
  136. {{ isGeneratingImages ? '生成中...' : '一键生成所有背景图' }}
  137. </button>
  138. <button
  139. class="toolbar-btn"
  140. @click="generateAllVoiceovers"
  141. :disabled="isGeneratingVoiceovers || isAnyVoiceoverGenerating"
  142. >
  143. {{ isGeneratingVoiceovers ? '生成中...' : '一键配音' }}
  144. </button>
  145. </div>
  146. <!-- 可滚动的内容区域 -->
  147. <div class="script-editor">
  148. <div
  149. v-for="(section, sectionIndex) in scriptData.sections"
  150. :key="sectionIndex"
  151. class="script-section"
  152. >
  153. <div class="section-header">
  154. <div class="section-name-container">
  155. <label class="section-name-label">环节 {{ sectionIndex + 1 }}</label>
  156. <input
  157. v-model="section.name"
  158. class="section-title"
  159. placeholder="如:环节一(引入)"
  160. />
  161. </div>
  162. <button class="remove-section-btn" @click="removeSection(sectionIndex)">×</button>
  163. </div>
  164. <div class="media-controls">
  165. <div class="media-item">
  166. <div class="media-input-group">
  167. <span class="media-label">背景图</span>
  168. <el-input
  169. v-model="section.backgroundImage.prompt"
  170. type="textarea"
  171. :autosize="{ minRows: 2, maxRows: 4 }"
  172. placeholder="描述词"
  173. class="media-prompt"
  174. />
  175. <el-button
  176. type="primary"
  177. size="small"
  178. :loading="section.backgroundImage.generating"
  179. :disabled="
  180. !section.backgroundImage.prompt || section.backgroundImage.generating
  181. "
  182. @click="generateMedia(sectionIndex)"
  183. class="generate-btn"
  184. >
  185. {{
  186. section.backgroundImage.generating
  187. ? '生成中...'
  188. : section.backgroundImage.url
  189. ? '重新生成'
  190. : '生成'
  191. }}
  192. </el-button>
  193. </div>
  194. <div v-if="section.backgroundImage.url" class="media-preview">
  195. <img :src="section.backgroundImage.url" alt="背景图预览" />
  196. </div>
  197. </div>
  198. <div class="media-item">
  199. <div class="media-input-group">
  200. <span class="media-label">背景音</span>
  201. <el-select
  202. v-model="section.backgroundAudio.type"
  203. placeholder="选择背景音"
  204. :style="{ width: fullscreen ? '240px' : '130px' }"
  205. clearable
  206. size="large"
  207. @change="(value) => handleBackgroundAudioChange(value, section)"
  208. >
  209. <el-option
  210. v-for="musicType in backgroundMusicTypes"
  211. :key="musicType.id"
  212. :label="musicType.name"
  213. :value="musicType.id"
  214. />
  215. </el-select>
  216. <button
  217. v-if="section.backgroundAudio.type"
  218. class="play-btn small"
  219. @click="playBackgroundAudio(section.backgroundAudio.type)"
  220. >
  221. <span class="play-icon">{{
  222. audioState.isPlaying &&
  223. audioState.currentType === 'background' &&
  224. audioState.currentUrl === section.backgroundAudio.url
  225. ? '⏸'
  226. : '▶'
  227. }}</span>
  228. </button>
  229. </div>
  230. </div>
  231. </div>
  232. <div class="dialogues-container">
  233. <div
  234. v-for="(dialogue, dialogueIndex) in section.dialogues"
  235. :key="dialogueIndex"
  236. class="dialogue-item"
  237. :class="[dialogue.type, { hidden: dialogue.type === 'user' }]"
  238. >
  239. <div class="dialogue-header">
  240. <div class="dialogue-type-tag" :class="dialogue.type">
  241. {{
  242. dialogue.type === 'digital'
  243. ? '数字人'
  244. : dialogue.type === 'user'
  245. ? '用户'
  246. : dialogue.type === 'quest'
  247. ? '提问'
  248. : '诗词'
  249. }}
  250. </div>
  251. </div>
  252. <div class="dialogue-row">
  253. <!-- 数字人对话 -->
  254. <template v-if="dialogue.type === 'digital'">
  255. <div class="dialogue-role-select">
  256. <el-select
  257. v-model="dialogue.roleName"
  258. placeholder="选择角色"
  259. style="width: 140px"
  260. clearable
  261. >
  262. <el-option
  263. v-for="role in digitalHumans"
  264. :key="role.id"
  265. :label="role.name"
  266. :value="role.name"
  267. />
  268. </el-select>
  269. </div>
  270. <div class="dialogue-content-container">
  271. <el-input
  272. v-model="dialogue.content"
  273. type="textarea"
  274. class="dialogue-content"
  275. placeholder="对话内容..."
  276. :autosize="{ minRows: 2, maxRows: 4 }"
  277. />
  278. </div>
  279. <div class="action-buttons">
  280. <div class="action-buttons-row">
  281. <button
  282. v-if="dialogue.voiceoverUrl"
  283. class="play-btn"
  284. @click="playVoiceover(dialogue.voiceoverUrl)"
  285. >
  286. <span class="play-icon">{{
  287. audioState.isPlaying &&
  288. audioState.currentType === 'voice' &&
  289. audioState.currentUrl === dialogue.voiceoverUrl
  290. ? '⏸'
  291. : '▶'
  292. }}</span>
  293. </button>
  294. <button
  295. class="remove-btn"
  296. @click="removeDialogue(sectionIndex, dialogueIndex)"
  297. >×</button
  298. >
  299. </div>
  300. <div class="action-buttons-row">
  301. <button
  302. v-if="!dialogue.voiceoverUrl"
  303. class="generate-btn small"
  304. :disabled="
  305. !dialogue.content ||
  306. !dialogue.roleName ||
  307. dialogue.generatingVoiceover
  308. "
  309. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  310. >
  311. <span class="voice-icon">{{
  312. dialogue.generatingVoiceover ? '生成中...' : '生成语音'
  313. }}</span>
  314. </button>
  315. <button
  316. v-if="dialogue.voiceoverUrl"
  317. class="generate-btn small"
  318. :disabled="
  319. !dialogue.content ||
  320. !dialogue.roleName ||
  321. dialogue.generatingVoiceover
  322. "
  323. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  324. >
  325. <span class="voice-icon">{{
  326. dialogue.generatingVoiceover ? '生成中...' : '重新生成'
  327. }}</span>
  328. </button>
  329. </div>
  330. </div>
  331. </template>
  332. <!-- 用户 -->
  333. <template v-else-if="dialogue.type === 'user'">
  334. <div class="dialogue-content-container full-width">
  335. <el-input
  336. v-model="dialogue.content"
  337. type="textarea"
  338. class="dialogue-content"
  339. placeholder="用户回复内容参考语..."
  340. :autosize="{ minRows: 2, maxRows: 4 }"
  341. />
  342. </div>
  343. <div class="dialogue-reply-select">
  344. <el-select
  345. v-model="dialogue.roleName"
  346. placeholder="选择数字人回复"
  347. style="width: 140px"
  348. clearable
  349. >
  350. <el-option
  351. v-for="role in digitalHumans"
  352. :key="role.id"
  353. :label="role.name"
  354. :value="role.name"
  355. />
  356. </el-select>
  357. </div>
  358. <div class="action-buttons">
  359. <div class="action-buttons-row">
  360. <button
  361. class="remove-btn"
  362. @click="removeDialogue(sectionIndex, dialogueIndex)"
  363. >×</button
  364. >
  365. </div>
  366. </div>
  367. </template>
  368. <!-- 提问 -->
  369. <template v-else-if="dialogue.type === 'quest'">
  370. <div class="dialogue-role-select">
  371. <el-select
  372. v-model="dialogue.roleName"
  373. placeholder="选择角色"
  374. style="width: 140px"
  375. clearable
  376. >
  377. <el-option
  378. v-for="role in digitalHumans"
  379. :key="role.id"
  380. :label="role.name"
  381. :value="role.name"
  382. />
  383. </el-select>
  384. </div>
  385. <div class="dialogue-content-container">
  386. <el-input
  387. v-model="dialogue.content"
  388. type="textarea"
  389. class="dialogue-content"
  390. placeholder="提问内容..."
  391. :autosize="{ minRows: 2, maxRows: 4 }"
  392. />
  393. </div>
  394. <div class="action-buttons">
  395. <div class="action-buttons-row">
  396. <button
  397. v-if="dialogue.voiceoverUrl"
  398. class="play-btn"
  399. @click="playVoiceover(dialogue.voiceoverUrl)"
  400. >
  401. <span class="play-icon">{{
  402. audioState.isPlaying &&
  403. audioState.currentType === 'voice' &&
  404. audioState.currentUrl === dialogue.voiceoverUrl
  405. ? '⏸'
  406. : '▶'
  407. }}</span>
  408. </button>
  409. <button
  410. class="remove-btn"
  411. @click="removeDialogue(sectionIndex, dialogueIndex)"
  412. >×</button
  413. >
  414. </div>
  415. <div class="action-buttons-row">
  416. <button
  417. v-if="!dialogue.voiceoverUrl"
  418. class="generate-btn small"
  419. :disabled="
  420. !dialogue.content ||
  421. !dialogue.roleName ||
  422. dialogue.generatingVoiceover
  423. "
  424. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  425. >
  426. <span class="voice-icon">{{
  427. dialogue.generatingVoiceover ? '生成中...' : '生成语音'
  428. }}</span>
  429. </button>
  430. <button
  431. v-if="dialogue.voiceoverUrl"
  432. class="generate-btn small"
  433. :disabled="
  434. !dialogue.content ||
  435. !dialogue.roleName ||
  436. dialogue.generatingVoiceover
  437. "
  438. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  439. >
  440. <span class="voice-icon">{{
  441. dialogue.generatingVoiceover ? '生成中...' : '重新生成'
  442. }}</span>
  443. </button>
  444. </div>
  445. </div>
  446. </template>
  447. <!-- 诗词 -->
  448. <template v-else-if="dialogue.type === 'poem'">
  449. <div class="dialogue-role-select">
  450. <el-select
  451. v-model="dialogue.roleName"
  452. placeholder="选择角色"
  453. style="width: 140px"
  454. clearable
  455. >
  456. <el-option
  457. v-for="role in digitalHumans"
  458. :key="role.id"
  459. :label="role.name"
  460. :value="role.name"
  461. />
  462. </el-select>
  463. </div>
  464. <div class="dialogue-content-container">
  465. <el-input
  466. v-model="dialogue.content"
  467. type="textarea"
  468. class="dialogue-content"
  469. placeholder="诗词内容..."
  470. :autosize="{ minRows: 2, maxRows: 4 }"
  471. />
  472. </div>
  473. <div class="action-buttons">
  474. <div class="action-buttons-row">
  475. <button
  476. v-if="dialogue.voiceoverUrl"
  477. class="play-btn"
  478. @click="playVoiceover(dialogue.voiceoverUrl)"
  479. >
  480. <span class="play-icon">{{
  481. audioState.isPlaying &&
  482. audioState.currentType === 'voice' &&
  483. audioState.currentUrl === dialogue.voiceoverUrl
  484. ? '⏸'
  485. : '▶'
  486. }}</span>
  487. </button>
  488. <button
  489. class="remove-btn"
  490. @click="removeDialogue(sectionIndex, dialogueIndex)"
  491. >×</button
  492. >
  493. </div>
  494. <div class="action-buttons-row">
  495. <button
  496. v-if="!dialogue.voiceoverUrl"
  497. class="generate-btn small"
  498. :disabled="
  499. !dialogue.content ||
  500. !dialogue.roleName ||
  501. dialogue.generatingVoiceover
  502. "
  503. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  504. >
  505. <span class="voice-icon">{{
  506. dialogue.generatingVoiceover ? '生成中...' : '生成语音'
  507. }}</span>
  508. </button>
  509. <button
  510. v-if="dialogue.voiceoverUrl"
  511. class="generate-btn small"
  512. :disabled="
  513. !dialogue.content ||
  514. !dialogue.roleName ||
  515. dialogue.generatingVoiceover
  516. "
  517. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  518. >
  519. <span class="voice-icon">{{
  520. dialogue.generatingVoiceover ? '生成中...' : '重新生成'
  521. }}</span>
  522. </button>
  523. </div>
  524. </div>
  525. </template>
  526. </div>
  527. </div>
  528. <div class="add-dialogue-buttons">
  529. <button class="add-dialogue-btn digital" @click="addDialogue(sectionIndex)"
  530. >+ 添加对话</button
  531. >
  532. <button
  533. class="add-dialogue-btn quest-user"
  534. @click="addQuestWithUserReply(sectionIndex)"
  535. >+ 添加提问与回复</button
  536. >
  537. <button class="add-dialogue-btn poem" @click="addPoemDialogue(sectionIndex)"
  538. >+ 添加诗词</button
  539. >
  540. </div>
  541. </div>
  542. </div>
  543. <button class="add-section-btn" @click="addSection">+ 添加环节</button>
  544. </div>
  545. <div class="preview-actions">
  546. <button v-if="currentStep > 1" class="secondary-btn" @click="currentStep--">
  547. 重新生成
  548. </button>
  549. <button class="primary-btn" @click="nextStep"> 预览完整脚本 </button>
  550. </div>
  551. </div>
  552. <!-- 步骤3:预览与保存 -->
  553. <div v-else-if="currentStep === 3" class="step-content">
  554. <div class="preview-container">
  555. <h3>课程脚本预览</h3>
  556. <div class="scrollable-content">
  557. <br />
  558. <div v-if="isValidationPassed" class="validation-result valid">
  559. {{ validationMessage }}
  560. </div>
  561. <div v-else>
  562. <div
  563. v-for="(error, index) in errorMessages"
  564. :key="index"
  565. class="validation-result invalid"
  566. >
  567. {{ error }}
  568. </div>
  569. </div>
  570. <div class="preview-content">
  571. <div
  572. v-for="(section, sectionIndex) in scriptData.sections"
  573. :key="sectionIndex"
  574. class="preview-section"
  575. :style="{
  576. backgroundImage: section.backgroundImage.url
  577. ? `url(${section.backgroundImage.url})`
  578. : 'none',
  579. backgroundSize: 'cover',
  580. backgroundPosition: 'center',
  581. backgroundRepeat: 'no-repeat'
  582. }"
  583. >
  584. <div class="preview-section-content">
  585. <div class="preview-media">
  586. <div class="preview-media-left">
  587. <label class="section-name-label">环节 {{ sectionIndex + 1 }}</label>
  588. <strong>{{ section.name }}</strong>
  589. </div>
  590. <div class="preview-media-right">
  591. <span v-if="section.backgroundAudio.type" class="preview-audio">
  592. 背景音:{{ section.backgroundAudio.type }}
  593. <button
  594. class="play-btn small"
  595. @click="playBackgroundAudio(section.backgroundAudio.type)"
  596. >
  597. <span class="play-icon">{{
  598. audioState.isPlaying &&
  599. audioState.currentType === 'background' &&
  600. audioState.currentUrl === section.backgroundAudio.url
  601. ? '⏸'
  602. : '▶'
  603. }}</span>
  604. </button>
  605. </span>
  606. </div>
  607. </div>
  608. <div class="preview-dialogues">
  609. <div
  610. v-for="(dialogue, dialogueIndex) in section.dialogues.filter(
  611. (d) => d.type !== 'user'
  612. )"
  613. :key="dialogueIndex"
  614. class="preview-dialogue"
  615. :class="dialogue.type"
  616. >
  617. <div class="dialogue-header">
  618. <div class="dialogue-header-left">
  619. <div class="dialogue-type-tag" :class="dialogue.type">
  620. {{
  621. dialogue.type === 'digital'
  622. ? '数字人'
  623. : dialogue.type === 'user'
  624. ? '用户'
  625. : dialogue.type === 'quest'
  626. ? '提问'
  627. : '诗词'
  628. }}
  629. </div>
  630. <div class="dialogue-role">
  631. {{
  632. dialogue.type !== 'user'
  633. ? getRoleName(dialogue.roleName)
  634. : '用户'
  635. }}:
  636. </div>
  637. </div>
  638. <button
  639. v-if="dialogue.voiceoverUrl"
  640. class="play-btn small"
  641. @click="playVoiceover(dialogue.voiceoverUrl)"
  642. >
  643. <span class="play-icon">{{
  644. audioState.isPlaying &&
  645. audioState.currentType === 'voice' &&
  646. audioState.currentUrl === dialogue.voiceoverUrl
  647. ? '⏸'
  648. : '▶'
  649. }}</span>
  650. </button>
  651. </div>
  652. <div class="dialogue-text" v-html="parseMarkdown(dialogue.content)"></div>
  653. <div
  654. v-if="dialogue.type === 'user' && dialogue.roleName"
  655. class="reply-info"
  656. >
  657. 回复角色:{{ getRoleName(dialogue.roleName) }}
  658. </div>
  659. </div>
  660. </div>
  661. </div>
  662. </div>
  663. </div>
  664. </div>
  665. <div class="preview-actions">
  666. <button class="secondary-btn" @click="currentStep = 2">返回修改</button>
  667. <!-- <button
  668. class="primary-btn"
  669. :disabled="!isValidationPassed"
  670. @click="showVideoPreview"
  671. >
  672. 预览视频
  673. </button>-->
  674. <button class="primary-btn" :disabled="!isValidationPassed" @click="saveScript">
  675. 保存课程脚本
  676. </button>
  677. </div>
  678. </div>
  679. </div>
  680. </div>
  681. </div>
  682. <!-- 视频预览模态框 -->
  683. <VideoPreview
  684. :visible="showVideoPreviewModal"
  685. :script-data="scriptData"
  686. :script-roles="digitalHumans"
  687. @close="closeVideoPreview"
  688. />
  689. </div>
  690. </Dialog>
  691. </template>
  692. <script setup>
  693. import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
  694. import { Dialog } from '@/components/Dialog'
  695. import { ChatMessageApi } from '@/api/ai/chat/message'
  696. import { ChatConversationApi } from '@/api/ai/chat/conversation'
  697. import { ChatRoleApi } from '@/api/ai/model/chatRole'
  698. import { ImageApi } from '@/api/ai/image'
  699. import { TtsApi } from '@/api/ai/tts'
  700. import VideoPreview from '@/views/bjdx/course/aiGenerate/VideoPreview.vue'
  701. import { AiImageStatusEnum, AiPlatformEnum } from '@/views/ai/utils/constants'
  702. import { marked } from 'marked'
  703. import { useUserStore } from '@/store/modules/user'
  704. // 步骤配置
  705. const steps = [
  706. { id: 1, label: 'AI生成脚本' },
  707. { id: 2, label: '编辑脚本与媒体' },
  708. { id: 3, label: '预览与保存' }
  709. ]
  710. // 当前步骤
  711. const currentStep = ref(1)
  712. // 步骤1数据
  713. const scriptPrompt = ref('')
  714. const selectedMainTeacher = ref('')
  715. const selectedAssistants = ref([])
  716. const selectedThemeType = ref()
  717. const isGenerating = ref(false)
  718. // 对话框可见性
  719. const props = defineProps({
  720. visible: {
  721. type: Boolean,
  722. default: false
  723. },
  724. initialStep: {
  725. type: Number,
  726. default: 1
  727. },
  728. initialScriptData: {
  729. type: String,
  730. default: ''
  731. }
  732. })
  733. const dialogVisible = computed({
  734. get: () => props.visible,
  735. set: (value) => emit('update:visible', value)
  736. })
  737. // 获取用户信息
  738. const userStore = useUserStore()
  739. const userId = computed(() => userStore.getUser.id)
  740. // 检查是否存在草稿缓存
  741. const hasDraftCache = ref(false)
  742. // 步骤2生成状态
  743. const isGeneratingImages = ref(false)
  744. const isGeneratingVoiceovers = ref(false)
  745. // 数字人列表
  746. const digitalHumans = ref([])
  747. // 背景音类型
  748. const backgroundMusicTypes = ref([
  749. {
  750. id: '轻松欢快',
  751. name: '轻松欢快',
  752. url: 'https://learn-aliyun-oss.oss-cn-beijing.aliyuncs.com/20260310/AI_1773106630966.MP3'
  753. }
  754. ])
  755. // 从localStorage加载脚本数据
  756. const loadScriptDataFromCache = () => {
  757. try {
  758. const key = `courseScriptData_${userId.value}`
  759. const cachedData = localStorage.getItem(key)
  760. if (cachedData) {
  761. try {
  762. return JSON.parse(cachedData)
  763. } catch (error) {
  764. console.error('解析缓存数据失败:', error)
  765. }
  766. }
  767. } catch (error) {
  768. console.error('获取用户信息失败:', error)
  769. }
  770. return null
  771. }
  772. // 是否为编辑模式
  773. const isEditMode = ref(false)
  774. // 脚本数据结构
  775. const scriptData = reactive(
  776. loadScriptDataFromCache() || {
  777. title: '',
  778. sections: [
  779. {
  780. name: '环节一',
  781. backgroundImage: {
  782. prompt: '',
  783. url: '',
  784. generating: false
  785. },
  786. backgroundAudio: {
  787. type: '',
  788. url: ''
  789. },
  790. dialogues: [
  791. {
  792. type: 'digital',
  793. roleName: '',
  794. content: '',
  795. voiceoverUrl: '',
  796. generatingVoiceover: false
  797. },
  798. {
  799. type: 'user',
  800. roleName: '',
  801. content: ''
  802. }
  803. ]
  804. }
  805. ]
  806. }
  807. )
  808. // 保存脚本数据到localStorage
  809. const saveScriptDataToCache = () => {
  810. try {
  811. const key = `courseScriptData_${userId.value}`
  812. localStorage.setItem(key, JSON.stringify(scriptData))
  813. hasDraftCache.value = true
  814. console.log('保存脚本数据到缓存', key)
  815. } catch (error) {
  816. console.error('保存缓存数据失败:', error)
  817. }
  818. }
  819. // 清空脚本数据缓存
  820. const clearScriptDataCache = () => {
  821. const key = `courseScriptData_${userId.value}`
  822. localStorage.removeItem(key)
  823. hasDraftCache.value = false
  824. console.log('清除脚本数据缓存', key)
  825. }
  826. // 加载草稿并跳转到步骤2
  827. const loadDraftAndGotoStep2 = () => {
  828. const cachedData = loadScriptDataFromCache()
  829. if (cachedData) {
  830. Object.assign(scriptData, cachedData)
  831. currentStep.value = 2
  832. }
  833. }
  834. // 监听脚本数据变化,自动保存到缓存
  835. watch(
  836. () => scriptData,
  837. () => {
  838. saveScriptDataToCache()
  839. },
  840. { deep: true }
  841. )
  842. // 监听对话框可见性变化
  843. watch(
  844. () => props.visible,
  845. (newVisible, oldVisible) => {
  846. if (newVisible) {
  847. // 对话框打开时,设置初始步骤
  848. currentStep.value = props.initialStep
  849. // 清空被替换的URL集合
  850. replacedUrls.value.clear()
  851. // 处理脚本数据
  852. if (props.initialScriptData) {
  853. // 标记为编辑模式
  854. isEditMode.value = true
  855. try {
  856. const parsedData = JSON.parse(props.initialScriptData)
  857. Object.assign(scriptData, parsedData)
  858. } catch (error) {
  859. console.error('解析脚本数据失败:', error)
  860. // 解析失败,尝试加载草稿
  861. const cachedData = loadScriptDataFromCache()
  862. if (cachedData) {
  863. Object.assign(scriptData, cachedData)
  864. }
  865. }
  866. } else {
  867. // 标记为新建模式
  868. isEditMode.value = false
  869. // 没有脚本数据,尝试加载草稿
  870. const cachedData = loadScriptDataFromCache()
  871. if (cachedData) {
  872. Object.assign(scriptData, cachedData)
  873. }
  874. }
  875. } else if (oldVisible) {
  876. // 对话框关闭时
  877. if (props.initialScriptData) {
  878. // 编辑进来的,清空缓存
  879. clearScriptDataCache()
  880. }
  881. // 重置编辑模式标记
  882. isEditMode.value = false
  883. // 新增进来的,保留缓存
  884. }
  885. }
  886. )
  887. // 音频播放状态
  888. const audioState = reactive({
  889. currentAudio: null,
  890. isPlaying: false,
  891. currentType: '',
  892. currentUrl: ''
  893. })
  894. // 存储所有音频实例
  895. const audioInstances = new Map()
  896. // 计算属性:判断是否可以进入下一步
  897. const canProceed = computed(() => {
  898. switch (currentStep.value) {
  899. case 1:
  900. return !!scriptPrompt.value && !!selectedMainTeacher.value && !!selectedThemeType.value
  901. case 2:
  902. case 3:
  903. return scriptData.sections.every(
  904. (section) =>
  905. section.backgroundImage.url &&
  906. section.dialogues.every(
  907. (dialogue) =>
  908. (dialogue.type === 'digital' ||
  909. dialogue.type === 'quest' ||
  910. dialogue.type === 'poem') &&
  911. dialogue.roleName &&
  912. dialogue.content.trim() &&
  913. dialogue.voiceoverUrl
  914. )
  915. )
  916. default:
  917. return false
  918. }
  919. })
  920. // 计算属性:检查是否有任何背景图正在生成
  921. const isAnyImageGenerating = computed(() => {
  922. return scriptData.sections.some((section) => section.backgroundImage.generating)
  923. })
  924. // 计算属性:检查是否有任何配音正在生成
  925. const isAnyVoiceoverGenerating = computed(() => {
  926. return scriptData.sections.some((section) =>
  927. section.dialogues.some((dialogue) => dialogue.generatingVoiceover)
  928. )
  929. })
  930. // 校验结果
  931. const isValidationPassed = ref(false)
  932. const validationMessage = ref('')
  933. const errorMessages = ref([])
  934. // 视频预览状态
  935. const showVideoPreviewModal = ref(false)
  936. // 全屏状态
  937. const fullscreen = ref(false)
  938. // 存储被替换的URL链接集合
  939. const replacedUrls = ref(new Set())
  940. const activeConversationId = ref(null) // 选中的对话编号
  941. const conversationInAbortController = ref() // 对话进行中 abort 控制器(控制 stream 对话)
  942. const conversationInProgress = ref(false) // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true,避免切换对话、删除对话等操作
  943. const enableContext = ref(false) // 是否开启上下文
  944. // 接收 Stream 消息
  945. const receiveMessageFullText = ref('')
  946. const scriptDataTemp = ref(null)
  947. // 步骤1:生成脚本
  948. const generateScript = async () => {
  949. isGenerating.value = true
  950. try {
  951. clearScriptDataCache()
  952. scriptData.title = ''
  953. scriptData.sections = []
  954. receiveMessageFullText.value = ''
  955. scriptDataTemp.value = null
  956. const role = digitalHumans.value.find((r) => r.name === selectedMainTeacher.value)
  957. let content =
  958. scriptPrompt.value +
  959. '(主讲人:' +
  960. role.name +
  961. ',主讲人角色定位:' +
  962. role.description +
  963. ';助讲有:'
  964. let zhujiang = []
  965. selectedAssistants.value.forEach((rName) => {
  966. const role = digitalHumans.value.find((r) => r.name === rName)
  967. zhujiang.push(role.name + '[' + role.description + ']')
  968. })
  969. content += zhujiang.join(',') + ')'
  970. await createAiRoleIdConversation(Number(selectedThemeType.value))
  971. currentStep.value = 2
  972. await doSendMessageStream(activeConversationId.value, content)
  973. } catch (error) {
  974. console.error('生成脚本失败:', error)
  975. } finally {
  976. isGenerating.value = false
  977. }
  978. }
  979. /** 选择 card 角色:新建聊天对话 */
  980. const createAiRoleIdConversation = async (roleId) => {
  981. activeConversationId.value = await ChatConversationApi.createChatConversationMy({
  982. roleId: roleId
  983. })
  984. }
  985. /** 真正执行【发送】消息操作 */
  986. const doSendMessageStream = async (conversationId, content) => {
  987. conversationInAbortController.value = new AbortController()
  988. conversationInProgress.value = true
  989. scriptPrompt.value = ''
  990. try {
  991. let isFirstChunk = true
  992. await ChatMessageApi.sendChatMessageStream(
  993. conversationId,
  994. content,
  995. conversationInAbortController.value,
  996. enableContext.value,
  997. async (res) => {
  998. const { code, data, msg } = JSON.parse(res.data)
  999. if (code !== 0) {
  1000. console.error(`对话异常! ${msg}`)
  1001. return
  1002. }
  1003. if (data.eventType === 'TEXT') {
  1004. if (data.receive?.content === '') {
  1005. return
  1006. }
  1007. if (isFirstChunk) {
  1008. isFirstChunk = false
  1009. }
  1010. receiveMessageFullText.value += data.receive.content
  1011. console.log('数据加载中..')
  1012. try {
  1013. const parsedData = JSON.parse(receiveMessageFullText.value)
  1014. scriptDataTemp.value = parsedData
  1015. Object.assign(scriptData, parsedData)
  1016. } catch (e) {
  1017. // 解析失败,说明数据还不完整,继续等待
  1018. }
  1019. }
  1020. },
  1021. (error) => {
  1022. console.error(`对话异常! ${error}`)
  1023. throw error
  1024. },
  1025. () => {
  1026. try {
  1027. if (receiveMessageFullText.value) {
  1028. console.log('最终数据:', receiveMessageFullText.value)
  1029. const parsedData = JSON.parse(receiveMessageFullText.value)
  1030. console.log('最终数据json:', parsedData)
  1031. scriptDataTemp.value = parsedData
  1032. Object.assign(scriptData, parsedData)
  1033. }
  1034. } catch (e) {
  1035. console.error('最终数据解析失败:', e)
  1036. // 清洗规则:移除```json、```、** 等非JSON标记,只保留中间的JSON内容
  1037. try {
  1038. let cleanJsonStr = receiveMessageFullText.value
  1039. const parsedData = JSON.parse(
  1040. cleanJsonStr
  1041. .replace(/^```json\s*/, '')
  1042. .replace(/\s*```$/, '')
  1043. .replace(/\*\*/g, '')
  1044. .trim()
  1045. )
  1046. console.log('最终清洗后数据json:', parsedData)
  1047. scriptDataTemp.value = parsedData
  1048. Object.assign(scriptData, parsedData)
  1049. } catch (cleanError) {
  1050. console.error('清洗后数据解析失败:', cleanError)
  1051. }
  1052. }
  1053. }
  1054. )
  1055. } catch (error) {
  1056. console.error('发送消息流失败:', error)
  1057. } finally {
  1058. conversationInProgress.value = false
  1059. }
  1060. }
  1061. // 步骤2:添加环节
  1062. const addSection = () => {
  1063. scriptData.sections.push({
  1064. name: `环节${scriptData.sections.length + 1}`,
  1065. backgroundImage: { prompt: '', url: '', generating: false },
  1066. backgroundAudio: { type: '', url: '' },
  1067. dialogues: []
  1068. })
  1069. }
  1070. // 步骤2:添加对话(数字人)
  1071. const addDialogue = (sectionIndex) => {
  1072. scriptData.sections[sectionIndex].dialogues.push({
  1073. type: 'digital',
  1074. roleName: '',
  1075. content: '',
  1076. voiceoverUrl: '',
  1077. generatingVoiceover: false
  1078. })
  1079. }
  1080. // 步骤2:添加用户回复
  1081. const addUserReply = (sectionIndex) => {
  1082. scriptData.sections[sectionIndex].dialogues.push({
  1083. type: 'user',
  1084. content: '',
  1085. roleName: '',
  1086. voiceoverUrl: '',
  1087. generatingVoiceover: false
  1088. })
  1089. }
  1090. // 步骤2:添加提问
  1091. const addQuestDialogue = (sectionIndex) => {
  1092. scriptData.sections[sectionIndex].dialogues.push({
  1093. type: 'quest',
  1094. content: '',
  1095. roleName: '',
  1096. voiceoverUrl: '',
  1097. generatingVoiceover: false
  1098. })
  1099. }
  1100. // 步骤2:添加诗词
  1101. const addPoemDialogue = (sectionIndex) => {
  1102. scriptData.sections[sectionIndex].dialogues.push({
  1103. type: 'poem',
  1104. content: '',
  1105. roleName: '',
  1106. voiceoverUrl: '',
  1107. generatingVoiceover: false
  1108. })
  1109. }
  1110. // 步骤2:添加提问与用户回复
  1111. const addQuestWithUserReply = (sectionIndex) => {
  1112. // 添加提问类型对话
  1113. scriptData.sections[sectionIndex].dialogues.push({
  1114. type: 'quest',
  1115. content: '',
  1116. roleName: '',
  1117. voiceoverUrl: '',
  1118. generatingVoiceover: false
  1119. })
  1120. // 添加用户回复类型对话
  1121. scriptData.sections[sectionIndex].dialogues.push({
  1122. type: 'user',
  1123. content: '',
  1124. roleName: '',
  1125. voiceoverUrl: '',
  1126. generatingVoiceover: false
  1127. })
  1128. }
  1129. // 步骤2:删除对话
  1130. const removeDialogue = (sectionIndex, dialogueIndex) => {
  1131. const dialogues = scriptData.sections[sectionIndex].dialogues
  1132. const dialogue = dialogues[dialogueIndex]
  1133. // 如果是提问类型,同时删除后面的用户回复
  1134. if (
  1135. dialogue.type === 'quest' &&
  1136. dialogueIndex < dialogues.length - 1 &&
  1137. dialogues[dialogueIndex + 1].type === 'user'
  1138. ) {
  1139. dialogues.splice(dialogueIndex, 2)
  1140. } else {
  1141. dialogues.splice(dialogueIndex, 1)
  1142. }
  1143. }
  1144. // 步骤2:删除环节
  1145. const removeSection = (sectionIndex) => {
  1146. if (scriptData.sections.length > 1) {
  1147. scriptData.sections.splice(sectionIndex, 1)
  1148. } else {
  1149. alert('至少需要保留一个环节')
  1150. }
  1151. }
  1152. // 图片生成相关状态
  1153. const inProgressImageMap = ref({}) // 监听的图片映射,key 为 image 编号,value 为 { sectionIndex, type: 'image'|'audio' }
  1154. const inProgressTimer = ref(null) // 生成中的图片定时器,轮询生成进展
  1155. // 步骤2:生成单个媒体(仅背景图)
  1156. const generateMedia = async (sectionIndex) => {
  1157. const section = scriptData.sections[sectionIndex]
  1158. const media = section.backgroundImage
  1159. // 记录旧的URL
  1160. let oldUrl = null
  1161. if (media.url) {
  1162. oldUrl = media.url
  1163. replacedUrls.value.add(oldUrl)
  1164. }
  1165. media.generating = true
  1166. try {
  1167. const form = {
  1168. platform: AiPlatformEnum.DOU_BAO,
  1169. modelId: 56,
  1170. prompt: media.prompt,
  1171. width: 1024,
  1172. height: 768
  1173. }
  1174. const response = await ImageApi.drawImage(form)
  1175. inProgressImageMap.value[response] = {
  1176. sectionIndex
  1177. }
  1178. } catch (error) {
  1179. console.error(`生成图片失败:`, error)
  1180. media.generating = false
  1181. // 生成失败,从replacedUrls中移除旧URL
  1182. if (oldUrl) {
  1183. replacedUrls.value.delete(oldUrl)
  1184. }
  1185. }
  1186. }
  1187. // 步骤2:一键生成所有背景图
  1188. const generateAllImages = async () => {
  1189. isGeneratingImages.value = true
  1190. try {
  1191. for (let i = 0; i < scriptData.sections.length; i++) {
  1192. const section = scriptData.sections[i]
  1193. // 只处理没有背景图URL的环节
  1194. if (!section.backgroundImage.url) {
  1195. await generateMedia(i)
  1196. }
  1197. }
  1198. // 检查是否有图片正在生成
  1199. const checkImagesComplete = setInterval(() => {
  1200. if (Object.keys(inProgressImageMap.value).length === 0) {
  1201. isGeneratingImages.value = false
  1202. clearInterval(checkImagesComplete)
  1203. }
  1204. }, 1000)
  1205. } catch (error) {
  1206. console.error('生成所有背景图失败:', error)
  1207. isGeneratingImages.value = false
  1208. }
  1209. }
  1210. // 轮询生成中的图片列表
  1211. const refreshWatchImages = async () => {
  1212. const imageIds = Object.keys(inProgressImageMap.value).map(Number)
  1213. if (imageIds.length === 0) {
  1214. return
  1215. }
  1216. try {
  1217. const list = await ImageApi.getImageListMyByIds(imageIds)
  1218. const newWatchImages = {}
  1219. list.forEach((image) => {
  1220. const info = inProgressImageMap.value[image.id]
  1221. if (info) {
  1222. if (image.status === AiImageStatusEnum.IN_PROGRESS) {
  1223. newWatchImages[image.id] = info
  1224. } else if (image.status === AiImageStatusEnum.SUCCESS && image.picUrl) {
  1225. const section = scriptData.sections[info.sectionIndex]
  1226. section.backgroundImage.url = image.picUrl
  1227. section.backgroundImage.generating = false
  1228. } else if (image.status === AiImageStatusEnum.FAIL) {
  1229. const section = scriptData.sections[info.sectionIndex]
  1230. section.backgroundImage.generating = false
  1231. // 生成失败,从replacedUrls中移除旧URL
  1232. if (section.backgroundImage.url) {
  1233. replacedUrls.value.delete(section.backgroundImage.url)
  1234. }
  1235. }
  1236. }
  1237. })
  1238. inProgressImageMap.value = newWatchImages
  1239. } catch (error) {
  1240. console.error('轮询图片状态失败:', error)
  1241. }
  1242. }
  1243. // 播放音频通用函数
  1244. const playAudio = (url, type) => {
  1245. if (audioState.currentAudio) {
  1246. audioState.currentAudio.pause()
  1247. audioState.currentAudio.currentTime = 0
  1248. }
  1249. if (audioState.isPlaying && audioState.currentUrl === url && audioState.currentType === type) {
  1250. if (audioState.currentAudio) {
  1251. audioState.currentAudio.pause()
  1252. }
  1253. audioState.isPlaying = false
  1254. return
  1255. }
  1256. let audio = audioInstances.get(`${type}_${url}`)
  1257. if (!audio) {
  1258. audio = new Audio(url)
  1259. audio.autoplay = false
  1260. audioInstances.set(`${type}_${url}`, audio)
  1261. audio.onended = () => {
  1262. audioState.isPlaying = false
  1263. audioState.currentAudio = null
  1264. audioState.currentUrl = ''
  1265. audioState.currentType = ''
  1266. }
  1267. }
  1268. audio.play().catch((error) => {
  1269. console.error('播放失败:', error)
  1270. audioState.isPlaying = false
  1271. })
  1272. audioState.currentAudio = audio
  1273. audioState.isPlaying = true
  1274. audioState.currentUrl = url
  1275. audioState.currentType = type
  1276. }
  1277. // 播放语音
  1278. const playVoiceover = (voiceoverUrl) => {
  1279. playAudio(voiceoverUrl, 'voice')
  1280. }
  1281. // 处理背景音选择变化
  1282. const handleBackgroundAudioChange = (value, section) => {
  1283. if (value) {
  1284. const selectedMusic = backgroundMusicTypes.value.find((music) => music.id === value)
  1285. if (selectedMusic) {
  1286. section.backgroundAudio.url = selectedMusic.url
  1287. }
  1288. } else {
  1289. section.backgroundAudio.url = ''
  1290. }
  1291. }
  1292. // 播放背景音
  1293. const playBackgroundAudio = (musicType) => {
  1294. const selectedMusic = backgroundMusicTypes.value.find((music) => music.id === musicType)
  1295. const audioUrl = selectedMusic ? selectedMusic.url : `https://example.com/${musicType}.mp3`
  1296. playAudio(audioUrl, 'background')
  1297. }
  1298. // 生成单个语音
  1299. const generateVoiceover = async (sectionIndex, dialogueIndex) => {
  1300. const dialogue = scriptData.sections[sectionIndex].dialogues[dialogueIndex]
  1301. // 只处理数字人、提问和诗词类型的对话
  1302. if (dialogue.type !== 'digital' && dialogue.type !== 'quest' && dialogue.type !== 'poem') {
  1303. return
  1304. }
  1305. // 记录旧的URL
  1306. let oldUrl = null
  1307. if (dialogue.voiceoverUrl) {
  1308. oldUrl = dialogue.voiceoverUrl
  1309. replacedUrls.value.add(oldUrl)
  1310. }
  1311. dialogue.generatingVoiceover = true
  1312. let role = digitalHumans.value.find((r) => r.name === dialogue.roleName)
  1313. try {
  1314. // 根据对话类型设置不同的command
  1315. const command =
  1316. dialogue.type === 'poem' ? '要有感情的朗读诗词语句,要符合诗词的节奏和韵律。' : null
  1317. // 调用后端API将文本转成语音
  1318. // 将返回的URL赋值给对话
  1319. dialogue.voiceoverUrl = await TtsApi.convert({
  1320. roleId: Number(role.id),
  1321. content: dialogue.content,
  1322. command: command
  1323. })
  1324. } catch (error) {
  1325. console.error('生成语音失败:', error)
  1326. // 生成失败,从replacedUrls中移除旧URL
  1327. if (oldUrl) {
  1328. replacedUrls.value.delete(oldUrl)
  1329. }
  1330. } finally {
  1331. dialogue.generatingVoiceover = false
  1332. }
  1333. }
  1334. // 步骤3:一键生成所有语音
  1335. const generateAllVoiceovers = async () => {
  1336. isGeneratingVoiceovers.value = true
  1337. try {
  1338. for (let i = 0; i < scriptData.sections.length; i++) {
  1339. for (let j = 0; j < scriptData.sections[i].dialogues.length; j++) {
  1340. const dialogue = scriptData.sections[i].dialogues[j]
  1341. // 只处理没有语音URL的对话
  1342. if (!dialogue.voiceoverUrl) {
  1343. await generateVoiceover(i, j)
  1344. }
  1345. }
  1346. }
  1347. } catch (error) {
  1348. console.error('生成所有语音失败:', error)
  1349. } finally {
  1350. isGeneratingVoiceovers.value = false
  1351. }
  1352. }
  1353. // 获取角色名称
  1354. const getRoleName = (roleName) => {
  1355. const role = digitalHumans.value.find((r) => r.name === roleName)
  1356. return role ? role.name : '未知角色'
  1357. }
  1358. // 解析 Markdown 文本
  1359. const parseMarkdown = (text) => {
  1360. if (!text) return ''
  1361. return marked(text)
  1362. }
  1363. // 步骤4:校验脚本
  1364. const validateScript = () => {
  1365. let isValid = true
  1366. errorMessages.value = []
  1367. // 检查环节名称、背景图
  1368. scriptData.sections.forEach((section, sectionIndex) => {
  1369. if (!section.name.trim() || !section.backgroundImage.url) {
  1370. errorMessages.value.push(`环节${sectionIndex + 1}:名称或背景图未配置!`)
  1371. isValid = false
  1372. }
  1373. // 检查对话
  1374. section.dialogues.forEach((dialogue, dialogueIndex) => {
  1375. // 只检查数字人、提问和诗词类型的对话
  1376. if (dialogue.type === 'digital' || dialogue.type === 'quest' || dialogue.type === 'poem') {
  1377. if (
  1378. !dialogue.roleName ||
  1379. !dialogue.content.trim() ||
  1380. (dialogue.type !== 'poem' && !dialogue.voiceoverUrl)
  1381. ) {
  1382. errorMessages.value.push(
  1383. `环节${sectionIndex + 1}:对话${dialogueIndex + 1}:存在完成内容!`
  1384. )
  1385. isValid = false
  1386. }
  1387. }
  1388. })
  1389. })
  1390. isValidationPassed.value = isValid
  1391. validationMessage.value = errorMessages.value.length > 0 ? '校验失败' : '校验通过'
  1392. }
  1393. // 步骤4:保存脚本
  1394. const saveScript = async () => {
  1395. validateScript()
  1396. if (!isValidationPassed.value) {
  1397. return
  1398. }
  1399. // 保存脚本后清除缓存
  1400. clearScriptDataCache()
  1401. emit('save', scriptData, [...replacedUrls.value])
  1402. emit('update:visible', false)
  1403. }
  1404. // 下一步操作
  1405. const nextStep = () => {
  1406. if (currentStep.value === 2) {
  1407. validateScript()
  1408. }
  1409. currentStep.value++
  1410. }
  1411. // 显示视频预览
  1412. const showVideoPreview = () => {
  1413. showVideoPreviewModal.value = true
  1414. }
  1415. // 关闭视频预览
  1416. const closeVideoPreview = () => {
  1417. showVideoPreviewModal.value = false
  1418. }
  1419. // 组件挂载时
  1420. onMounted(async () => {
  1421. // 设置初始步骤
  1422. currentStep.value = props.initialStep
  1423. try {
  1424. const params = {
  1425. pageOn: 1,
  1426. pageSize: 100,
  1427. category: '小学低年级',
  1428. publicStatus: true
  1429. }
  1430. const { list } = await ChatRoleApi.getMyPage(params)
  1431. params.category += 'AI'
  1432. const { list: listAi } = await ChatRoleApi.getMyPage(params)
  1433. params.category = '全部'
  1434. const { list: listAll } = await ChatRoleApi.getMyPage(params)
  1435. params.category = '全部-Poet'
  1436. const { list: listAllPoet } = await ChatRoleApi.getMyPage(params)
  1437. listAi.push(...list)
  1438. listAi.push(...listAll)
  1439. listAi.push(...listAllPoet)
  1440. digitalHumans.value = listAi
  1441. } catch (error) {
  1442. console.error('获取角色数据失败:', error)
  1443. }
  1444. inProgressTimer.value = setInterval(async () => {
  1445. await refreshWatchImages()
  1446. }, 3000)
  1447. })
  1448. // 关闭事件
  1449. const emit = defineEmits(['update:visible', 'save'])
  1450. const handleClose = () => {
  1451. emit('update:visible', false)
  1452. }
  1453. // 组件卸载时
  1454. onUnmounted(() => {
  1455. if (inProgressTimer.value) {
  1456. clearInterval(inProgressTimer.value)
  1457. }
  1458. })
  1459. </script>
  1460. <style scoped>
  1461. .course-script-editor {
  1462. width: 100%;
  1463. height: 90vh;
  1464. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  1465. display: flex;
  1466. flex-direction: column;
  1467. overflow: hidden;
  1468. background-color: #f8f9fa;
  1469. }
  1470. /* 主容器样式 */
  1471. .main-container {
  1472. flex: 1;
  1473. display: flex;
  1474. overflow: hidden;
  1475. }
  1476. /* 左侧步骤指示器样式 */
  1477. .steps-sidebar {
  1478. width: 200px;
  1479. background-color: #f5f7fa;
  1480. border-right: 1px solid #ebeef5;
  1481. padding: 30px 0;
  1482. display: flex;
  1483. align-items: center;
  1484. }
  1485. /* 右侧内容区域样式 */
  1486. .content-area {
  1487. flex: 1;
  1488. display: flex;
  1489. flex-direction: column;
  1490. overflow: hidden;
  1491. }
  1492. /* 步骤内容样式 */
  1493. .step-content {
  1494. flex: 1;
  1495. padding: 20px;
  1496. overflow: hidden;
  1497. display: flex;
  1498. flex-direction: column;
  1499. background-color: white;
  1500. border-radius: 0;
  1501. box-shadow: none;
  1502. }
  1503. /* 步骤1垂直居中 */
  1504. .step-content:has(.ai-input-container) {
  1505. justify-content: center;
  1506. align-items: center;
  1507. }
  1508. /* 编辑器工具栏样式 - 固定顶部 */
  1509. .editor-toolbar.sticky-top {
  1510. position: sticky;
  1511. top: 0;
  1512. z-index: 100;
  1513. margin-top: -20px;
  1514. margin-left: -20px;
  1515. margin-right: -20px;
  1516. border-radius: 0;
  1517. border-bottom: 1px solid #ebeef5;
  1518. background: rgba(250, 250, 250, 0.95);
  1519. backdrop-filter: blur(10px);
  1520. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  1521. }
  1522. /* 脚本编辑器样式 - 可滚动 */
  1523. .script-editor {
  1524. flex: 1;
  1525. overflow-y: auto;
  1526. margin-top: 20px;
  1527. padding-right: 10px;
  1528. background-color: white;
  1529. border-radius: 8px;
  1530. padding: 20px;
  1531. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  1532. }
  1533. .script-editor::-webkit-scrollbar {
  1534. width: 6px;
  1535. }
  1536. .script-editor::-webkit-scrollbar-track {
  1537. background: #f1f1f1;
  1538. border-radius: 3px;
  1539. }
  1540. .script-editor::-webkit-scrollbar-thumb {
  1541. background: #c1c1c1;
  1542. border-radius: 3px;
  1543. }
  1544. .script-editor::-webkit-scrollbar-thumb:hover {
  1545. background: #a1a1a1;
  1546. }
  1547. /* 步骤导航 */
  1548. .steps-container {
  1549. display: flex;
  1550. flex-direction: column;
  1551. align-items: center;
  1552. gap: 20px;
  1553. width: 100%;
  1554. .step-item {
  1555. display: flex;
  1556. flex-direction: column;
  1557. align-items: center;
  1558. width: 100%;
  1559. .step-circle {
  1560. width: 32px;
  1561. height: 32px;
  1562. border-radius: 50%;
  1563. display: flex;
  1564. align-items: center;
  1565. justify-content: center;
  1566. font-weight: bold;
  1567. margin-bottom: 8px;
  1568. }
  1569. .step-title {
  1570. font-size: 14px;
  1571. text-align: center;
  1572. padding: 0 20px;
  1573. }
  1574. &.process {
  1575. .step-circle {
  1576. background-color: #409eff;
  1577. color: white;
  1578. }
  1579. .step-title {
  1580. color: #409eff;
  1581. }
  1582. }
  1583. &.wait {
  1584. .step-circle {
  1585. background-color: #e4e7ed;
  1586. color: #c0c4cc;
  1587. }
  1588. .step-title {
  1589. color: #c0c4cc;
  1590. }
  1591. }
  1592. &.finish {
  1593. .step-circle {
  1594. background-color: #67c23a;
  1595. color: white;
  1596. }
  1597. .step-title {
  1598. color: #67c23a;
  1599. }
  1600. }
  1601. }
  1602. .step-line {
  1603. width: 2px;
  1604. height: 40px;
  1605. background-color: #e4e7ed;
  1606. &.active {
  1607. background-color: #409eff;
  1608. }
  1609. }
  1610. }
  1611. /* 步骤内容 */
  1612. .step-content {
  1613. background-color: white;
  1614. border-radius: 8px;
  1615. padding: 20px;
  1616. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  1617. }
  1618. /* 按钮组样式 */
  1619. .button-group {
  1620. display: flex;
  1621. gap: 10px;
  1622. margin-top: 20px;
  1623. justify-content: center;
  1624. }
  1625. /* 次要按钮样式 */
  1626. .generate-btn.secondary {
  1627. background-color: #606266;
  1628. color: white;
  1629. }
  1630. .generate-btn.secondary:hover {
  1631. background-color: #ffaa72;
  1632. color: white;
  1633. }
  1634. /* 对话类型标签 */
  1635. .dialogue-type-tag {
  1636. position: absolute;
  1637. top: -10px;
  1638. left: 10px;
  1639. padding: 2px 8px;
  1640. border-radius: 10px;
  1641. font-size: 12px;
  1642. font-weight: 500;
  1643. color: white;
  1644. }
  1645. /* 隐藏用户回复卡片 */
  1646. .dialogue-item.hidden {
  1647. display: none;
  1648. }
  1649. /* 错误信息项样式 */
  1650. .error-item {
  1651. margin-bottom: 8px;
  1652. line-height: 1.4;
  1653. }
  1654. .dialogue-type-tag.digital {
  1655. background-color: #409eff;
  1656. }
  1657. .dialogue-type-tag.user {
  1658. background-color: #67c23a;
  1659. }
  1660. .dialogue-type-tag.quest {
  1661. background-color: #e6a23c;
  1662. }
  1663. .dialogue-type-tag.poem {
  1664. background-color: #909399;
  1665. }
  1666. /* 对话项样式 */
  1667. .dialogue-item {
  1668. position: relative;
  1669. background-color: #f9f9f9;
  1670. border-radius: 8px;
  1671. padding: 20px;
  1672. margin-bottom: 15px;
  1673. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  1674. transition: all 0.3s ease;
  1675. }
  1676. .dialogue-item:hover {
  1677. box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  1678. }
  1679. .dialogue-item.digital {
  1680. border-left: 4px solid #409eff;
  1681. }
  1682. .dialogue-item.user {
  1683. border-left: 4px solid #67c23a;
  1684. }
  1685. .dialogue-item.quest {
  1686. border-left: 4px solid #e6a23c;
  1687. }
  1688. /* 对话头部 */
  1689. .dialogue-header {
  1690. margin-bottom: 10px;
  1691. }
  1692. /* 对话行 */
  1693. .dialogue-row {
  1694. display: flex;
  1695. gap: 15px;
  1696. align-items: flex-start;
  1697. }
  1698. /* 角色选择 */
  1699. .dialogue-role-select {
  1700. flex-shrink: 0;
  1701. }
  1702. /* 回复角色选择 */
  1703. .dialogue-reply-select {
  1704. flex-shrink: 0;
  1705. }
  1706. /* 内容容器 */
  1707. .dialogue-content-container {
  1708. flex: 1;
  1709. min-width: 0;
  1710. }
  1711. /* 添加对话按钮容器 */
  1712. .add-dialogue-buttons {
  1713. display: flex;
  1714. gap: 10px;
  1715. margin-top: 15px;
  1716. }
  1717. /* 添加对话按钮 */
  1718. .add-dialogue-btn {
  1719. padding: 8px 16px;
  1720. border: none;
  1721. border-radius: 4px;
  1722. font-size: 14px;
  1723. font-weight: 500;
  1724. cursor: pointer;
  1725. transition: all 0.3s ease;
  1726. display: flex;
  1727. align-items: center;
  1728. justify-content: center;
  1729. gap: 5px;
  1730. min-width: 120px;
  1731. }
  1732. .add-dialogue-btn.digital {
  1733. background-color: #83c2ff;
  1734. color: white;
  1735. }
  1736. .add-dialogue-btn.digital:hover {
  1737. background-color: #409eff;
  1738. border-color: #4aa2fd;
  1739. color: white;
  1740. }
  1741. .add-dialogue-btn.user {
  1742. background-color: #85ce61;
  1743. color: white;
  1744. }
  1745. .add-dialogue-btn.quest {
  1746. background-color: #e6a23c;
  1747. color: white;
  1748. }
  1749. .add-dialogue-btn.poem {
  1750. background-color: #909399;
  1751. color: white;
  1752. }
  1753. .add-dialogue-btn.quest-user {
  1754. background-color: #e6a23c;
  1755. color: white;
  1756. }
  1757. .add-dialogue-btn.user:hover {
  1758. background-color: #67c23a;
  1759. border-color: #67c23a;
  1760. color: white;
  1761. }
  1762. .add-dialogue-btn.quest:hover {
  1763. background-color: #cf9236;
  1764. border-color: #cf9236;
  1765. color: white;
  1766. }
  1767. .add-dialogue-btn.quest-user:hover {
  1768. background-color: #cf9236;
  1769. border-color: #cf9236;
  1770. color: white;
  1771. }
  1772. .add-dialogue-btn.poem:hover {
  1773. background-color: #73767a;
  1774. border-color: #73767a;
  1775. color: white;
  1776. }
  1777. /* 预览对话样式 */
  1778. .preview-dialogue {
  1779. position: relative;
  1780. margin-bottom: 20px;
  1781. padding: 15px;
  1782. border-radius: 8px;
  1783. background-color: #f9f9f9;
  1784. }
  1785. .preview-dialogue.digital {
  1786. border-left: 4px solid #409eff;
  1787. }
  1788. .preview-dialogue.user {
  1789. border-left: 4px solid #67c23a;
  1790. }
  1791. .preview-dialogue.quest {
  1792. border-left: 4px solid #e6a23c;
  1793. }
  1794. .preview-dialogue.poem {
  1795. border-left: 4px solid #909399;
  1796. }
  1797. .preview-dialogue .dialogue-header {
  1798. display: flex;
  1799. align-items: center;
  1800. justify-content: space-between;
  1801. gap: 0;
  1802. margin-bottom: 10px;
  1803. }
  1804. .preview-dialogue .dialogue-header-left {
  1805. display: flex;
  1806. align-items: center;
  1807. gap: 2px;
  1808. }
  1809. .preview-dialogue .dialogue-type-tag {
  1810. position: static;
  1811. margin-right: 2px;
  1812. }
  1813. /* 回复信息 */
  1814. .reply-info {
  1815. margin-top: 10px;
  1816. padding-top: 10px;
  1817. border-top: 1px solid #e8e8e8;
  1818. font-size: 14px;
  1819. color: #666;
  1820. font-style: italic;
  1821. }
  1822. /* AI输入容器 */
  1823. .ai-input-container {
  1824. max-width: 800px;
  1825. margin: 0 auto;
  1826. padding: 30px;
  1827. background: white;
  1828. border-radius: 16px;
  1829. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  1830. display: flex;
  1831. flex-direction: column;
  1832. min-height: 500px;
  1833. }
  1834. .selection-group {
  1835. margin-bottom: 30px;
  1836. }
  1837. .ai-input-wrapper {
  1838. margin-bottom: 30px;
  1839. }
  1840. .ai-input-container .button-group {
  1841. display: flex;
  1842. gap: 10px;
  1843. margin-top: 30px;
  1844. justify-content: center;
  1845. }
  1846. .ai-input-container .button-group button {
  1847. flex: 1;
  1848. min-width: 200px;
  1849. text-align: center;
  1850. }
  1851. .ai-input-wrapper {
  1852. position: relative;
  1853. margin-bottom: 30px;
  1854. }
  1855. .ai-icon {
  1856. position: absolute;
  1857. top: 20px;
  1858. left: 20px;
  1859. font-size: 28px;
  1860. color: #409eff;
  1861. background: rgba(64, 158, 255, 0.1);
  1862. width: 48px;
  1863. height: 48px;
  1864. border-radius: 12px;
  1865. display: flex;
  1866. align-items: center;
  1867. justify-content: center;
  1868. animation: pulse 2s infinite;
  1869. }
  1870. @keyframes pulse {
  1871. 0% {
  1872. box-shadow: 0 0 0 0 rgba(64, 158, 255, 0.4);
  1873. }
  1874. 70% {
  1875. box-shadow: 0 0 0 10px rgba(64, 158, 255, 0);
  1876. }
  1877. 100% {
  1878. box-shadow: 0 0 0 0 rgba(64, 158, 255, 0);
  1879. }
  1880. }
  1881. .ai-textarea {
  1882. width: 100%;
  1883. min-height: 140px;
  1884. padding: 24px 24px 24px 84px;
  1885. border: 2px solid #e8e8e8;
  1886. border-radius: 16px;
  1887. font-size: 16px;
  1888. resize: vertical;
  1889. transition: all 0.3s ease;
  1890. background: #fafafa;
  1891. line-height: 1.6;
  1892. }
  1893. .ai-textarea:focus {
  1894. outline: none;
  1895. border-color: #409eff;
  1896. background: white;
  1897. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1898. }
  1899. .selection-group {
  1900. display: grid;
  1901. grid-template-columns: 1fr 1fr;
  1902. gap: 24px;
  1903. margin-bottom: 30px;
  1904. }
  1905. .selection-item {
  1906. display: flex;
  1907. flex-direction: column;
  1908. gap: 10px;
  1909. }
  1910. .selection-item label {
  1911. font-weight: 600;
  1912. color: #333;
  1913. font-size: 14px;
  1914. text-transform: uppercase;
  1915. letter-spacing: 0.5px;
  1916. color: #666;
  1917. }
  1918. .selection-item select {
  1919. padding: 14px 16px;
  1920. border: 2px solid #e8e8e8;
  1921. border-radius: 10px;
  1922. font-size: 14px;
  1923. transition: all 0.3s ease;
  1924. background: white;
  1925. }
  1926. .selection-item select:focus {
  1927. outline: none;
  1928. border-color: #409eff;
  1929. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1930. }
  1931. .multi-select {
  1932. display: flex;
  1933. flex-wrap: wrap;
  1934. gap: 10px;
  1935. padding: 12px;
  1936. border: 2px solid #e8e8e8;
  1937. border-radius: 10px;
  1938. background: white;
  1939. transition: all 0.3s ease;
  1940. }
  1941. .multi-select:focus-within {
  1942. border-color: #409eff;
  1943. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1944. }
  1945. .select-option {
  1946. padding: 8px 16px;
  1947. background: #f5f5f5;
  1948. border-radius: 20px;
  1949. cursor: pointer;
  1950. transition: all 0.2s ease;
  1951. font-size: 14px;
  1952. font-weight: 500;
  1953. border: 1px solid transparent;
  1954. }
  1955. .select-option:hover {
  1956. background: #e6f7ff;
  1957. border-color: #91d5ff;
  1958. }
  1959. .select-option.selected {
  1960. background: #409eff;
  1961. color: white;
  1962. border-color: #409eff;
  1963. box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
  1964. }
  1965. /* 加载遮挡层样式 */
  1966. .loading-overlay {
  1967. position: fixed;
  1968. top: 0;
  1969. left: 0;
  1970. width: 100%;
  1971. height: 100%;
  1972. background-color: rgba(0, 0, 0, 0.1);
  1973. display: flex;
  1974. align-items: center;
  1975. justify-content: center;
  1976. z-index: 9999;
  1977. pointer-events: auto;
  1978. }
  1979. .loading-content {
  1980. display: flex;
  1981. flex-direction: column;
  1982. align-items: center;
  1983. gap: 16px;
  1984. background: white;
  1985. padding: 32px;
  1986. border-radius: 12px;
  1987. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  1988. pointer-events: auto;
  1989. }
  1990. .loading-spinner {
  1991. width: 48px;
  1992. height: 48px;
  1993. border: 4px solid #f3f3f3;
  1994. border-top: 4px solid #409eff;
  1995. border-radius: 50%;
  1996. animation: spin 1s linear infinite;
  1997. }
  1998. @keyframes spin {
  1999. 0% {
  2000. transform: rotate(0deg);
  2001. }
  2002. 100% {
  2003. transform: rotate(360deg);
  2004. }
  2005. }
  2006. .loading-text {
  2007. font-size: 16px;
  2008. font-weight: 500;
  2009. color: #333;
  2010. }
  2011. /* 按钮样式 */
  2012. .generate-btn {
  2013. padding: 14px 8px;
  2014. border: none;
  2015. border-radius: 8px;
  2016. font-size: 14px;
  2017. font-weight: 400;
  2018. cursor: pointer;
  2019. transition: all 0.3s ease;
  2020. position: relative;
  2021. overflow: hidden;
  2022. }
  2023. .generate-btn.primary {
  2024. background: linear-gradient(135deg, #409eff, #1890ff);
  2025. color: white;
  2026. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  2027. }
  2028. .generate-btn.primary:hover {
  2029. transform: translateY(-2px);
  2030. box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
  2031. }
  2032. .generate-btn.primary:disabled {
  2033. background: #91c5f7;
  2034. cursor: not-allowed;
  2035. transform: none;
  2036. box-shadow: none;
  2037. }
  2038. .generate-btn.small {
  2039. padding: 8px 16px;
  2040. font-size: 14px;
  2041. border-radius: 8px;
  2042. }
  2043. .generate-btn.small:hover {
  2044. transform: translateY(-1px);
  2045. box-shadow: 0 3px 8px rgba(64, 158, 255, 0.3);
  2046. }
  2047. .generate-btn.small:disabled {
  2048. background: #91c5f7;
  2049. color: white;
  2050. cursor: not-allowed;
  2051. transform: none;
  2052. box-shadow: none;
  2053. }
  2054. .toolbar-btn:disabled {
  2055. background: #f0f0f0;
  2056. color: #c0c0c0;
  2057. border-color: #e0e0e0;
  2058. cursor: not-allowed;
  2059. transform: none;
  2060. box-shadow: none;
  2061. }
  2062. .toolbar-btn:disabled:hover {
  2063. background: #f0f0f0;
  2064. color: #c0c0c0;
  2065. border-color: #e0e0e0;
  2066. transform: none;
  2067. box-shadow: none;
  2068. }
  2069. /* 编辑器工具栏 */
  2070. .editor-toolbar {
  2071. position: sticky;
  2072. top: 20px;
  2073. z-index: 100;
  2074. margin-bottom: 30px;
  2075. padding: 16px 20px;
  2076. background: rgba(250, 250, 250, 0.95);
  2077. backdrop-filter: blur(10px);
  2078. border-radius: 12px;
  2079. border: 1px solid #e8e8e8;
  2080. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  2081. overflow-x: auto;
  2082. overflow-y: hidden;
  2083. white-space: nowrap;
  2084. }
  2085. .editor-toolbar::-webkit-scrollbar {
  2086. height: 4px;
  2087. }
  2088. .editor-toolbar::-webkit-scrollbar-track {
  2089. background: #f1f1f1;
  2090. border-radius: 2px;
  2091. }
  2092. .editor-toolbar::-webkit-scrollbar-thumb {
  2093. background: #c1c1c1;
  2094. border-radius: 2px;
  2095. }
  2096. .editor-toolbar::-webkit-scrollbar-thumb:hover {
  2097. background: #a1a1a1;
  2098. }
  2099. .toolbar-btn {
  2100. padding: 12px 24px;
  2101. margin: 0 12px;
  2102. background: white;
  2103. border: 2px solid #e8e8e8;
  2104. border-radius: 10px;
  2105. cursor: pointer;
  2106. transition: all 0.3s ease;
  2107. font-weight: 500;
  2108. color: #333;
  2109. }
  2110. .toolbar-btn:hover {
  2111. background: #409eff;
  2112. color: white;
  2113. border-color: #409eff;
  2114. transform: translateY(-1px);
  2115. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  2116. }
  2117. /* 脚本编辑器 */
  2118. .script-section {
  2119. margin-top: 40px;
  2120. margin-bottom: 40px;
  2121. padding: 5px 24px 24px;
  2122. background: white;
  2123. border-radius: 16px;
  2124. position: relative;
  2125. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  2126. border: 1px solid #f0f0f0;
  2127. }
  2128. .section-header {
  2129. margin-bottom: 24px;
  2130. display: flex;
  2131. align-items: center;
  2132. gap: 16px;
  2133. }
  2134. .section-name-container {
  2135. display: flex;
  2136. align-items: center;
  2137. flex: 1;
  2138. gap: 12px;
  2139. margin-top: 16px;
  2140. }
  2141. .remove-section-btn {
  2142. background: #ff4d4f;
  2143. border: none;
  2144. color: white;
  2145. font-size: 16px;
  2146. cursor: pointer;
  2147. padding: 0;
  2148. width: 28px;
  2149. height: 28px;
  2150. display: flex;
  2151. align-items: center;
  2152. justify-content: center;
  2153. border-radius: 6px;
  2154. transition: all 0.3s ease;
  2155. flex-shrink: 0;
  2156. }
  2157. .remove-section-btn:hover {
  2158. background: #ff7875;
  2159. transform: scale(1.1);
  2160. box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
  2161. }
  2162. .section-name-label {
  2163. padding: 2px 15px;
  2164. border-radius: 10px;
  2165. font-size: 18px;
  2166. font-weight: 500;
  2167. color: white;
  2168. background-color: #c18484;
  2169. white-space: nowrap;
  2170. display: flex;
  2171. align-items: center;
  2172. height: 44px;
  2173. box-sizing: border-box;
  2174. }
  2175. .section-title {
  2176. flex: 1;
  2177. padding: 14px 16px;
  2178. border: 2px solid #e8e8e8;
  2179. border-radius: 10px;
  2180. font-size: 16px;
  2181. font-weight: 500;
  2182. transition: all 0.3s ease;
  2183. }
  2184. .section-title:focus {
  2185. outline: none;
  2186. border-color: #409eff;
  2187. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  2188. }
  2189. .media-controls {
  2190. display: flex;
  2191. background: linear-gradient(135deg, #f8f9fa, #ffffff);
  2192. padding: 16px 20px;
  2193. border-radius: 10px;
  2194. border: 1px solid #e8e8e8;
  2195. align-items: center;
  2196. justify-content: space-between;
  2197. }
  2198. .media-item {
  2199. display: flex;
  2200. align-items: center;
  2201. gap: 10px;
  2202. margin-right: 50px;
  2203. }
  2204. .media-input-group {
  2205. display: flex;
  2206. align-items: center;
  2207. gap: 10px;
  2208. }
  2209. .media-label {
  2210. font-size: 14px;
  2211. font-weight: 600;
  2212. white-space: nowrap;
  2213. color: #666;
  2214. }
  2215. .media-prompt {
  2216. font-size: 14px;
  2217. transition: all 0.3s ease;
  2218. width: 300px;
  2219. }
  2220. .media-prompt .el-textarea {
  2221. width: 100%;
  2222. min-height: 60px;
  2223. }
  2224. .media-prompt .el-textarea__inner {
  2225. padding: 8px 12px;
  2226. border: 2px solid #e8e8e8;
  2227. border-radius: 8px;
  2228. font-size: 14px;
  2229. transition: all 0.3s ease;
  2230. min-height: 60px;
  2231. resize: none;
  2232. }
  2233. .media-prompt .el-textarea__inner:focus {
  2234. outline: none;
  2235. border-color: #409eff;
  2236. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  2237. }
  2238. .media-preview {
  2239. margin-top: 12px;
  2240. margin-left: 20px;
  2241. }
  2242. .media-preview img {
  2243. max-width: 180px;
  2244. border-radius: 8px;
  2245. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  2246. transition: transform 0.3s ease;
  2247. }
  2248. .media-preview img:hover {
  2249. transform: scale(1.05);
  2250. }
  2251. .dialogues-container {
  2252. margin-top: 48px;
  2253. }
  2254. .dialogue-item {
  2255. margin-bottom: 20px;
  2256. padding: 20px;
  2257. background: #fafafa;
  2258. border-radius: 12px;
  2259. border: 1px solid #e8e8e8;
  2260. transition: all 0.3s ease;
  2261. }
  2262. .dialogue-item:hover {
  2263. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  2264. transform: translateY(-2px);
  2265. }
  2266. .dialogue-row {
  2267. display: flex;
  2268. align-items: flex-start;
  2269. gap: 16px;
  2270. }
  2271. .dialogue-role-select {
  2272. min-width: 140px;
  2273. }
  2274. .dialogue-role-select select {
  2275. width: 100%;
  2276. padding: 10px 12px;
  2277. border: 2px solid #e8e8e8;
  2278. border-radius: 8px;
  2279. font-size: 14px;
  2280. transition: all 0.3s ease;
  2281. }
  2282. .dialogue-role-select select:focus {
  2283. outline: none;
  2284. border-color: #409eff;
  2285. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  2286. }
  2287. .dialogue-content-container {
  2288. flex: 1;
  2289. }
  2290. .dialogue-content:focus {
  2291. outline: none;
  2292. border-color: #409eff;
  2293. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  2294. }
  2295. .remove-btn {
  2296. background: #ff4d4f;
  2297. border: none;
  2298. color: white;
  2299. font-size: 16px;
  2300. cursor: pointer;
  2301. padding: 0;
  2302. width: 28px;
  2303. height: 28px;
  2304. display: flex;
  2305. align-items: center;
  2306. justify-content: center;
  2307. border-radius: 6px;
  2308. transition: all 0.3s ease;
  2309. flex-shrink: 0;
  2310. }
  2311. .remove-btn:hover {
  2312. background: #ff7875;
  2313. transform: scale(1.1);
  2314. box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
  2315. }
  2316. .dialogue-header {
  2317. display: flex;
  2318. justify-content: space-between;
  2319. align-items: center;
  2320. margin-bottom: 8px;
  2321. }
  2322. .dialogue-text {
  2323. flex: 1;
  2324. width: 100%;
  2325. font-size: 16px;
  2326. line-height: 1.6;
  2327. }
  2328. .generate-btn.small {
  2329. padding: 8px;
  2330. background: linear-gradient(135deg, #409eff, #1890ff);
  2331. color: white;
  2332. border: none;
  2333. border-radius: 6px;
  2334. cursor: pointer;
  2335. transition: all 0.3s ease;
  2336. display: flex;
  2337. align-items: center;
  2338. justify-content: center;
  2339. height: 28px;
  2340. font-size: 14px;
  2341. }
  2342. .generate-btn.small:hover {
  2343. transform: scale(1.1);
  2344. box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
  2345. }
  2346. .play-btn {
  2347. padding: 8px;
  2348. background: #52c41a;
  2349. color: white;
  2350. border: none;
  2351. border-radius: 6px;
  2352. cursor: pointer;
  2353. transition: all 0.3s ease;
  2354. display: flex;
  2355. align-items: center;
  2356. justify-content: center;
  2357. width: 28px;
  2358. height: 28px;
  2359. font-size: 14px;
  2360. }
  2361. .play-btn:hover {
  2362. background: #73d13d;
  2363. transform: scale(1.1);
  2364. box-shadow: 0 2px 8px rgba(82, 196, 26, 0.3);
  2365. }
  2366. .play-btn.small {
  2367. padding: 8px;
  2368. width: 28px;
  2369. height: 28px;
  2370. font-size: 14px;
  2371. }
  2372. .voice-icon {
  2373. font-size: 14px;
  2374. line-height: 1;
  2375. }
  2376. .play-icon {
  2377. font-size: 14px;
  2378. line-height: 1;
  2379. }
  2380. .action-buttons {
  2381. display: flex;
  2382. flex-direction: column;
  2383. gap: 8px;
  2384. margin-left: 8px;
  2385. }
  2386. .action-buttons-row {
  2387. display: flex;
  2388. gap: 8px;
  2389. align-items: center;
  2390. justify-content: flex-end;
  2391. }
  2392. .add-dialogue-btn,
  2393. .add-section-btn {
  2394. padding: 12px 24px;
  2395. background: white;
  2396. border: 2px dashed #d9d9d9;
  2397. border-radius: 10px;
  2398. cursor: pointer;
  2399. transition: all 0.3s ease;
  2400. font-weight: 500;
  2401. color: #666;
  2402. margin-top: 16px;
  2403. width: 100%;
  2404. text-align: center;
  2405. }
  2406. .add-dialogue-btn:hover,
  2407. .add-section-btn:hover {
  2408. border-color: #c18484;
  2409. color: white;
  2410. background: rgba(193, 132, 132, 0.6);
  2411. transform: translateY(-1px);
  2412. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
  2413. }
  2414. /* 预览页面 */
  2415. .preview-container {
  2416. width: 100%;
  2417. height: 100%;
  2418. background: white;
  2419. border-radius: 16px;
  2420. padding: 30px;
  2421. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  2422. display: flex;
  2423. flex-direction: column;
  2424. }
  2425. .scrollable-content {
  2426. flex: 1;
  2427. overflow-y: auto;
  2428. margin-bottom: 20px;
  2429. padding-right: 10px;
  2430. }
  2431. .scrollable-content::-webkit-scrollbar {
  2432. width: 6px;
  2433. }
  2434. .scrollable-content::-webkit-scrollbar-track {
  2435. background: #f1f1f1;
  2436. border-radius: 3px;
  2437. }
  2438. .scrollable-content::-webkit-scrollbar-thumb {
  2439. background: #c1c1c1;
  2440. border-radius: 3px;
  2441. }
  2442. .scrollable-content::-webkit-scrollbar-thumb:hover {
  2443. background: #a1a1a1;
  2444. }
  2445. .preview-content {
  2446. margin-top: 20px;
  2447. margin-bottom: 30px;
  2448. }
  2449. .preview-actions {
  2450. margin-top: auto;
  2451. display: flex;
  2452. justify-content: flex-end;
  2453. gap: 12px;
  2454. }
  2455. .validation-result {
  2456. padding: 16px 20px;
  2457. border-radius: 10px;
  2458. font-weight: 500;
  2459. font-size: 14px;
  2460. }
  2461. .validation-result.valid {
  2462. background: #f6ffed;
  2463. border: 2px solid #b7eb8f;
  2464. color: #52c41a;
  2465. box-shadow: 0 2px 8px rgba(82, 196, 26, 0.1);
  2466. }
  2467. .validation-result.invalid {
  2468. background: #fff2f0;
  2469. border: 2px solid #ffccc7;
  2470. color: #ff4d4f;
  2471. box-shadow: 0 2px 8px rgba(255, 77, 79, 0.1);
  2472. }
  2473. .preview-section {
  2474. margin-bottom: 40px;
  2475. padding: 40px;
  2476. border-radius: 12px;
  2477. border: 1px solid #e8e8e8;
  2478. min-height: 300px;
  2479. display: flex;
  2480. align-items: center;
  2481. justify-content: center;
  2482. }
  2483. .preview-section h4 {
  2484. margin-top: 0;
  2485. color: #333;
  2486. font-size: 18px;
  2487. font-weight: 600;
  2488. margin-bottom: 20px;
  2489. }
  2490. .preview-section-content {
  2491. background: rgba(255, 255, 255, 0.2);
  2492. padding: 20px;
  2493. border-radius: 12px;
  2494. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  2495. backdrop-filter: blur(5px);
  2496. width: 80%;
  2497. }
  2498. .preview-media {
  2499. margin: 20px 0;
  2500. padding: 16px;
  2501. background: rgba(255, 255, 255, 0.8);
  2502. border-radius: 10px;
  2503. border: 1px solid #e8e8e8;
  2504. display: flex;
  2505. align-items: center;
  2506. justify-content: space-between;
  2507. flex-wrap: wrap;
  2508. }
  2509. .preview-media-left {
  2510. display: flex;
  2511. align-items: center;
  2512. gap: 12px;
  2513. }
  2514. .preview-media-right {
  2515. display: flex;
  2516. align-items: center;
  2517. gap: 12px;
  2518. }
  2519. .preview-image img {
  2520. max-width: 250px;
  2521. border-radius: 8px;
  2522. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  2523. transition: transform 0.3s ease;
  2524. }
  2525. .preview-image img:hover {
  2526. transform: scale(1.05);
  2527. }
  2528. .preview-audio {
  2529. float: right;
  2530. margin-right: 20px;
  2531. display: flex;
  2532. align-items: center;
  2533. gap: 8px;
  2534. }
  2535. .preview-dialogue {
  2536. margin-bottom: 20px;
  2537. padding: 16px;
  2538. background: white;
  2539. border-radius: 10px;
  2540. border: 1px solid #e8e8e8;
  2541. transition: all 0.3s ease;
  2542. }
  2543. .dialogue-header {
  2544. display: flex;
  2545. justify-content: space-between;
  2546. align-items: center;
  2547. margin-bottom: 8px;
  2548. }
  2549. .preview-dialogue:hover {
  2550. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  2551. }
  2552. .dialogue-role {
  2553. font-weight: 600;
  2554. color: #409eff;
  2555. font-size: 14px;
  2556. }
  2557. .dialogue-text {
  2558. line-height: 1.6;
  2559. font-size: 14px;
  2560. color: #333;
  2561. }
  2562. /* Markdown 样式 */
  2563. .dialogue-text h1,
  2564. .dialogue-text h2,
  2565. .dialogue-text h3,
  2566. .dialogue-text h4,
  2567. .dialogue-text h5,
  2568. .dialogue-text h6 {
  2569. margin: 16px 0 8px 0;
  2570. font-weight: 600;
  2571. line-height: 1.2;
  2572. }
  2573. .dialogue-text h1 {
  2574. font-size: 24px;
  2575. }
  2576. .dialogue-text h2 {
  2577. font-size: 20px;
  2578. }
  2579. .dialogue-text h3 {
  2580. font-size: 18px;
  2581. }
  2582. .dialogue-text h4 {
  2583. font-size: 16px;
  2584. }
  2585. .dialogue-text h5 {
  2586. font-size: 14px;
  2587. }
  2588. .dialogue-text h6 {
  2589. font-size: 12px;
  2590. }
  2591. .dialogue-text p {
  2592. margin: 8px 0;
  2593. }
  2594. .dialogue-text ul,
  2595. .dialogue-text ol {
  2596. margin: 8px 0;
  2597. padding-left: 24px;
  2598. }
  2599. .dialogue-text li {
  2600. margin: 4px 0;
  2601. }
  2602. .dialogue-text strong {
  2603. font-weight: 600;
  2604. }
  2605. .dialogue-text em {
  2606. font-style: italic;
  2607. }
  2608. .dialogue-text a {
  2609. color: #409eff;
  2610. text-decoration: none;
  2611. }
  2612. .dialogue-text a:hover {
  2613. text-decoration: underline;
  2614. }
  2615. .dialogue-text code {
  2616. background: #f5f5f5;
  2617. padding: 2px 4px;
  2618. border-radius: 4px;
  2619. font-family: 'Courier New', Courier, monospace;
  2620. font-size: 14px;
  2621. }
  2622. .dialogue-text pre {
  2623. background: #f5f5f5;
  2624. padding: 12px;
  2625. border-radius: 8px;
  2626. overflow-x: auto;
  2627. margin: 12px 0;
  2628. }
  2629. .dialogue-text pre code {
  2630. background: none;
  2631. padding: 0;
  2632. }
  2633. .voiceover-preview {
  2634. margin-top: 12px;
  2635. padding-top: 12px;
  2636. border-top: 1px solid #f0f0f0;
  2637. }
  2638. .preview-actions {
  2639. display: flex;
  2640. justify-content: center;
  2641. gap: 20px;
  2642. padding-top: 24px;
  2643. border-top: 1px solid #e8e8e8;
  2644. }
  2645. .primary-btn,
  2646. .secondary-btn {
  2647. padding: 14px 32px;
  2648. border: none;
  2649. border-radius: 12px;
  2650. font-size: 16px;
  2651. font-weight: 600;
  2652. cursor: pointer;
  2653. transition: all 0.3s ease;
  2654. position: relative;
  2655. overflow: hidden;
  2656. }
  2657. .primary-btn {
  2658. background: linear-gradient(135deg, #409eff, #1890ff);
  2659. color: white;
  2660. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  2661. }
  2662. .primary-btn:hover {
  2663. transform: translateY(-2px);
  2664. box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
  2665. }
  2666. .primary-btn:disabled {
  2667. background: #91c5f7;
  2668. cursor: not-allowed;
  2669. transform: none;
  2670. box-shadow: none;
  2671. }
  2672. .secondary-btn {
  2673. background: white;
  2674. color: #333;
  2675. border: 2px solid #e8e8e8;
  2676. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  2677. }
  2678. .secondary-btn:hover {
  2679. background: #fafafa;
  2680. border-color: #409eff;
  2681. color: #409eff;
  2682. transform: translateY(-2px);
  2683. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  2684. }
  2685. </style>