aiGengrate.vue 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295
  1. <template>
  2. <div class="course-script-editor">
  3. <!-- 全屏遮挡层 -->
  4. <div v-if="isGenerating" class="loading-overlay">
  5. <div class="loading-content">
  6. <div class="loading-spinner"></div>
  7. <div class="loading-text">生成中...</div>
  8. </div>
  9. </div>
  10. <div class="main-container">
  11. <!-- 左侧步骤指示器 -->
  12. <div class="steps-sidebar">
  13. <div class="steps-container">
  14. <template v-for="(step, index) in steps" :key="step.id">
  15. <div
  16. :class="['step-item', { process: currentStep === step.id, finish: step.id < currentStep, wait: step.id > currentStep }]"
  17. >
  18. <div class="step-circle">{{ step.id }}</div>
  19. <div class="step-title">{{ step.label }}</div>
  20. </div>
  21. <div v-if="index < steps.length - 1" class="step-line" :class="{ active: currentStep > step.id }"></div>
  22. </template>
  23. </div>
  24. </div>
  25. <!-- 右侧内容区域 -->
  26. <div class="content-area">
  27. <!-- 步骤1:AI一句话生成 -->
  28. <div v-if="currentStep === 1" class="step-content">
  29. <div class="ai-input-container">
  30. <div class="ai-input-wrapper">
  31. <div class="ai-icon">🤖</div>
  32. <textarea
  33. v-model="scriptPrompt"
  34. placeholder="AI一句话生成课程脚本,例如:生成一节关于牛顿万有引力的小学科学课脚本..."
  35. class="ai-textarea"
  36. ></textarea>
  37. </div>
  38. <div class="selection-group">
  39. <div class="selection-item">
  40. <label>主讲老师</label>
  41. <el-select v-model="selectedMainTeacher" filterable size="large" placeholder="请选择主讲老师" style="width: 300px" clearable>
  42. <el-option
  43. v-for="teacher in digitalHumans"
  44. :key="teacher.name"
  45. :label="teacher.name"
  46. :value="teacher.name"
  47. />
  48. </el-select>
  49. </div>
  50. <div class="selection-item">
  51. <label>助讲老师</label>
  52. <el-select v-model="selectedAssistants" filterable size="large" placeholder="请选择助讲老师" style="width: 300px" clearable multiple>
  53. <el-option
  54. v-for="teacher in digitalHumans"
  55. :key="teacher.name"
  56. :label="teacher.name"
  57. :value="teacher.name"
  58. />
  59. </el-select>
  60. </div>
  61. </div>
  62. <button
  63. class="generate-btn primary"
  64. :disabled="!scriptPrompt || !selectedMainTeacher || isGenerating"
  65. @click="generateScript"
  66. >
  67. {{ isGenerating ? '生成中...' : '生成课程脚本' }}
  68. </button>
  69. </div>
  70. </div>
  71. <!-- 步骤2:脚本编辑(含背景图/音生成) -->
  72. <div v-else-if="currentStep === 2" class="step-content">
  73. <!-- 固定顶部的一键操作栏 -->
  74. <div class="editor-toolbar sticky-top">
  75. <button
  76. class="toolbar-btn"
  77. @click="generateAllImages"
  78. :disabled="isGeneratingImages || isAnyImageGenerating"
  79. >
  80. {{ isGeneratingImages ? '生成中...' : '一键生成所有背景图' }}
  81. </button>
  82. <button
  83. class="toolbar-btn"
  84. @click="generateAllVoiceovers"
  85. :disabled="isGeneratingVoiceovers || isAnyVoiceoverGenerating"
  86. >
  87. {{ isGeneratingVoiceovers ? '生成中...' : '一键配音' }}
  88. </button>
  89. </div>
  90. <!-- 可滚动的内容区域 -->
  91. <div class="script-editor">
  92. <div
  93. v-for="(section, sectionIndex) in scriptData.sections"
  94. :key="sectionIndex"
  95. class="script-section"
  96. >
  97. <div class="section-header">
  98. <div class="section-name-container">
  99. <label class="section-name-label">环节 {{sectionIndex+1}}</label>
  100. <input
  101. v-model="section.name"
  102. class="section-title"
  103. placeholder="如:环节一(引入)"
  104. />
  105. </div>
  106. <button class="remove-section-btn" @click="removeSection(sectionIndex)">×</button>
  107. </div>
  108. <div class="media-controls" >
  109. <div class="media-item">
  110. <div class="media-input-group">
  111. <span class="media-label">背景图</span>
  112. <el-input
  113. v-model="section.backgroundImage.prompt"
  114. type="textarea"
  115. :autosize="{ minRows: 2, maxRows: 4 }"
  116. placeholder="描述词"
  117. class="media-prompt"
  118. />
  119. <el-button
  120. type="primary"
  121. size="small"
  122. :loading="section.backgroundImage.generating"
  123. :disabled="!section.backgroundImage.prompt || section.backgroundImage.generating"
  124. @click="generateMedia(sectionIndex)"
  125. class="generate-btn"
  126. >
  127. {{ section.backgroundImage.generating ? '生成中...' : (section.backgroundImage.url ? '重新生成' : '生成') }}
  128. </el-button>
  129. </div>
  130. <div v-if="section.backgroundImage.url" class="media-preview">
  131. <img :src="section.backgroundImage.url" alt="背景图预览" />
  132. </div>
  133. </div>
  134. <div class="media-item">
  135. <div class="media-input-group">
  136. <span class="media-label">背景音</span>
  137. <el-select v-model="section.backgroundAudio.type" placeholder="选择背景音" style="width: 240px" clearable size="large" @change="(value) => handleBackgroundAudioChange(value, section)">
  138. <el-option
  139. v-for="musicType in backgroundMusicTypes"
  140. :key="musicType.id"
  141. :label="musicType.name"
  142. :value="musicType.id"
  143. />
  144. </el-select>
  145. <button
  146. v-if="section.backgroundAudio.type"
  147. class="play-btn small"
  148. @click="playBackgroundAudio(section.backgroundAudio.type)"
  149. >
  150. <span class="play-icon">{{ audioState.isPlaying && audioState.currentType === 'background' && audioState.currentUrl === section.backgroundAudio.url ? '⏸' : '▶' }}</span>
  151. </button>
  152. </div>
  153. </div>
  154. </div>
  155. <div class="dialogues-container">
  156. <div
  157. v-for="(dialogue, dialogueIndex) in section.dialogues"
  158. :key="dialogueIndex"
  159. class="dialogue-item"
  160. :class="dialogue.type"
  161. >
  162. <div class="dialogue-header">
  163. <div class="dialogue-type-tag" :class="dialogue.type">
  164. {{ dialogue.type === 'digital' ? '数字人' : '用户' }}
  165. </div>
  166. </div>
  167. <div class="dialogue-row">
  168. <!-- 数字人对话 -->
  169. <template v-if="dialogue.type === 'digital'">
  170. <div class="dialogue-role-select">
  171. <el-select v-model="dialogue.roleName" placeholder="选择角色" style="width: 140px" clearable>
  172. <el-option
  173. v-for="role in digitalHumans"
  174. :key="role.id"
  175. :label="role.name"
  176. :value="role.name"
  177. />
  178. </el-select>
  179. </div>
  180. <div class="dialogue-content-container">
  181. <el-input
  182. v-model="dialogue.content"
  183. type="textarea"
  184. class="dialogue-content"
  185. placeholder="对话内容..."
  186. :autosize="{ minRows: 2, maxRows: 4 }"
  187. />
  188. </div>
  189. <div class="action-buttons">
  190. <div class="action-buttons-row">
  191. <button
  192. v-if="dialogue.voiceoverUrl"
  193. class="play-btn"
  194. @click="playVoiceover(dialogue.voiceoverUrl)"
  195. >
  196. <span class="play-icon">{{ audioState.isPlaying && audioState.currentType === 'voice' && audioState.currentUrl === dialogue.voiceoverUrl ? '⏸' : '▶' }}</span>
  197. </button>
  198. <button class="remove-btn" @click="removeDialogue(sectionIndex, dialogueIndex)">×</button>
  199. </div>
  200. <div class="action-buttons-row">
  201. <button
  202. v-if="!dialogue.voiceoverUrl"
  203. class="generate-btn small"
  204. :disabled="!dialogue.content || !dialogue.roleName || dialogue.generatingVoiceover"
  205. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  206. >
  207. <span class="voice-icon">{{ dialogue.generatingVoiceover ? '生成中...' : '生成语音' }}</span>
  208. </button>
  209. <button
  210. v-if="dialogue.voiceoverUrl"
  211. class="generate-btn small"
  212. :disabled="!dialogue.content || !dialogue.roleName || dialogue.generatingVoiceover"
  213. @click="generateVoiceover(sectionIndex, dialogueIndex)"
  214. >
  215. <span class="voice-icon">{{ dialogue.generatingVoiceover ? '生成中...' : '重新生成' }}</span>
  216. </button>
  217. </div>
  218. </div>
  219. </template>
  220. <!-- 用户 -->
  221. <template v-else-if="dialogue.type === 'user'">
  222. <div class="dialogue-content-container full-width">
  223. <el-input
  224. v-model="dialogue.content"
  225. type="textarea"
  226. class="dialogue-content"
  227. placeholder="用户回复内容..."
  228. :autosize="{ minRows: 2, maxRows: 4 }"
  229. />
  230. </div>
  231. <div class="dialogue-reply-select">
  232. <el-select v-model="dialogue.roleName" placeholder="选择数字人回复" style="width: 140px" clearable>
  233. <el-option
  234. v-for="role in digitalHumans"
  235. :key="role.id"
  236. :label="role.name"
  237. :value="role.name"
  238. />
  239. </el-select>
  240. </div>
  241. <div class="action-buttons">
  242. <div class="action-buttons-row">
  243. <button class="remove-btn" @click="removeDialogue(sectionIndex, dialogueIndex)">×</button>
  244. </div>
  245. </div>
  246. </template>
  247. </div>
  248. </div>
  249. <div class="add-dialogue-buttons">
  250. <button class="add-dialogue-btn digital" @click="addDialogue(sectionIndex)">+ 添加对话</button>
  251. <button class="add-dialogue-btn user" @click="addUserReply(sectionIndex)">+ 添加用户回复</button>
  252. </div>
  253. </div>
  254. </div>
  255. <button class="add-section-btn" @click="addSection">+ 添加环节</button>
  256. </div>
  257. <div class="preview-actions">
  258. <button
  259. v-if="currentStep > 1"
  260. class="secondary-btn"
  261. @click="currentStep--"
  262. >
  263. 重新生成
  264. </button>
  265. <button
  266. class="primary-btn"
  267. :disabled="!canProceed"
  268. @click="nextStep"
  269. >
  270. 预览完整脚本
  271. </button>
  272. </div>
  273. </div>
  274. <!-- 步骤3:预览与保存 -->
  275. <div v-else-if="currentStep === 3" class="step-content">
  276. <div class="preview-container">
  277. <h3>课程脚本预览</h3>
  278. <br/>
  279. <div class="validation-result" :class="{ valid: isValidationPassed, invalid: !isValidationPassed }">
  280. {{ validationMessage }}
  281. </div>
  282. <div class="preview-content">
  283. <div
  284. v-for="(section, sectionIndex) in scriptData.sections"
  285. :key="sectionIndex"
  286. class="preview-section"
  287. :style="{ backgroundImage: section.backgroundImage.url ? `url(${section.backgroundImage.url})` : 'none', backgroundSize: 'cover', backgroundPosition: 'center', backgroundRepeat: 'no-repeat' }"
  288. >
  289. <div class="preview-section-content">
  290. <div class="preview-media">
  291. <div class="preview-media-left">
  292. <label class="section-name-label">环节 {{sectionIndex+1}}</label>
  293. <strong>{{ section.name }}</strong>
  294. </div>
  295. <div class="preview-media-right">
  296. <span v-if="section.backgroundAudio.type" class="preview-audio">
  297. 背景音:{{ section.backgroundAudio.type }}
  298. <button
  299. class="play-btn small"
  300. @click="playBackgroundAudio(section.backgroundAudio.type)"
  301. >
  302. <span class="play-icon">{{ audioState.isPlaying && audioState.currentType === 'background' && audioState.currentUrl === section.backgroundAudio.url ? '⏸' : '▶' }}</span>
  303. </button>
  304. </span>
  305. </div>
  306. </div>
  307. <div class="preview-dialogues">
  308. <div
  309. v-for="(dialogue, dialogueIndex) in section.dialogues"
  310. :key="dialogueIndex"
  311. class="preview-dialogue"
  312. :class="dialogue.type"
  313. >
  314. <div class="dialogue-header">
  315. <div class="dialogue-header-left">
  316. <div class="dialogue-type-tag" :class="dialogue.type">
  317. {{ dialogue.type === 'digital' ? '数字人' : '用户' }}
  318. </div>
  319. <div class="dialogue-role">
  320. {{ dialogue.type === 'digital' ? getRoleName(dialogue.roleName) : '用户' }}:
  321. </div>
  322. </div>
  323. <button
  324. v-if="dialogue.voiceoverUrl && dialogue.type === 'digital'"
  325. class="play-btn small"
  326. @click="playVoiceover(dialogue.voiceoverUrl)"
  327. >
  328. <span class="play-icon">{{ audioState.isPlaying && audioState.currentType === 'voice' && audioState.currentUrl === dialogue.voiceoverUrl ? '⏸' : '▶' }}</span>
  329. </button>
  330. </div>
  331. <div class="dialogue-text" v-html="parseMarkdown(dialogue.content)"></div>
  332. <div v-if="dialogue.type === 'user' && dialogue.roleName" class="reply-info">
  333. 回复角色:{{ getRoleName(dialogue.roleName) }}
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. <div class="preview-actions">
  341. <button class="secondary-btn" @click="currentStep = 2">返回修改</button>
  342. <button
  343. class="primary-btn"
  344. :disabled="!isValidationPassed"
  345. @click="showVideoPreview"
  346. >
  347. 预览视频
  348. </button>
  349. <button
  350. class="primary-btn"
  351. :disabled="!isValidationPassed"
  352. @click="saveScript"
  353. >
  354. 保存课程脚本
  355. </button>
  356. </div>
  357. </div>
  358. </div>
  359. </div>
  360. </div>
  361. </div>
  362. <!-- 视频预览模态框 -->
  363. <VideoPreview
  364. :visible="showVideoPreviewModal"
  365. :script-data="scriptData"
  366. :script-roles="digitalHumans"
  367. @close="closeVideoPreview"
  368. />
  369. </template>
  370. <script setup>
  371. import { ref, reactive, computed, onMounted, onUnmounted, watch } from 'vue'
  372. import { ChatMessageApi } from '@/api/ai/chat/message'
  373. import { ChatConversationApi } from '@/api/ai/chat/conversation'
  374. import { ChatRoleApi } from '@/api/ai/model/chatRole'
  375. import { ImageApi } from '@/api/ai/image'
  376. import { TtsApi } from '@/api/ai/tts'
  377. import VideoPreview from '@/views/bjdx/course/aiGenerate/VideoPreview.vue'
  378. import { AiImageStatusEnum } from '@/views/ai/utils/constants'
  379. import { marked } from 'marked'
  380. // 步骤配置
  381. const steps = [
  382. { id: 1, label: 'AI生成脚本' },
  383. { id: 2, label: '编辑脚本与媒体' },
  384. { id: 3, label: '预览与保存' }
  385. ]
  386. // 当前步骤
  387. const currentStep = ref(2)
  388. // 步骤1数据
  389. const scriptPrompt = ref('请给我一个讲解万有引力的课程')
  390. const selectedMainTeacher = ref('牛顿')
  391. const selectedAssistants = ref([])
  392. const isGenerating = ref(false)
  393. // 步骤2生成状态
  394. const isGeneratingImages = ref(false)
  395. const isGeneratingVoiceovers = ref(false)
  396. // 数字人列表
  397. const digitalHumans = ref([])
  398. // 背景音类型
  399. const backgroundMusicTypes = ref([
  400. { id: '轻松欢快', name: '轻松欢快', url: 'http://192.168.110.9:8080/admin-api/infra/file/29/get/20260228/bgm_1772265321253.MP3' },
  401. ])
  402. // 从localStorage加载脚本数据
  403. const loadScriptDataFromCache = () => {
  404. const cachedData = localStorage.getItem('courseScriptData')
  405. if (cachedData) {
  406. try {
  407. return JSON.parse(cachedData)
  408. } catch (error) {
  409. console.error('解析缓存数据失败:', error)
  410. }
  411. }
  412. return {
  413. title: '',
  414. sections: [
  415. {
  416. name: '环节一',
  417. backgroundImage: {
  418. prompt: '',
  419. url: '',
  420. generating: false
  421. },
  422. backgroundAudio: {
  423. type: '',
  424. url: ''
  425. },
  426. dialogues: [
  427. {
  428. type: 'digital',
  429. roleName: '',
  430. content: '',
  431. voiceoverUrl: '',
  432. generatingVoiceover: false
  433. },
  434. {
  435. type: 'user',
  436. roleName: '',
  437. content: '',
  438. }
  439. ]
  440. }
  441. ]
  442. }
  443. }
  444. // 脚本数据结构
  445. const scriptData = reactive(loadScriptDataFromCache())
  446. // 保存脚本数据到localStorage
  447. const saveScriptDataToCache = () => {
  448. try {
  449. localStorage.setItem('courseScriptData', JSON.stringify(scriptData))
  450. } catch (error) {
  451. console.error('保存缓存数据失败:', error)
  452. }
  453. }
  454. // 清空脚本数据缓存
  455. const clearScriptDataCache = () => {
  456. localStorage.removeItem('courseScriptData')
  457. }
  458. // 监听脚本数据变化,自动保存到缓存
  459. watch(() => scriptData, () => {
  460. saveScriptDataToCache()
  461. }, { deep: true })
  462. // 音频播放状态
  463. const audioState = reactive({
  464. currentAudio: null,
  465. isPlaying: false,
  466. currentType: '',
  467. currentUrl: ''
  468. })
  469. // 存储所有音频实例
  470. const audioInstances = new Map()
  471. // 计算属性:判断是否可以进入下一步
  472. const canProceed = computed(() => {
  473. switch (currentStep.value) {
  474. case 1:
  475. return !!scriptPrompt.value && !!selectedMainTeacher.value
  476. case 2:
  477. case 3:
  478. return scriptData.sections.every(section =>
  479. section.backgroundImage.url && section.dialogues.every(dialogue => dialogue.type !== "digital" || dialogue.voiceoverUrl)
  480. )
  481. default:
  482. return false
  483. }
  484. })
  485. // 计算属性:检查是否有任何背景图正在生成
  486. const isAnyImageGenerating = computed(() => {
  487. return scriptData.sections.some(section => section.backgroundImage.generating)
  488. })
  489. // 计算属性:检查是否有任何配音正在生成
  490. const isAnyVoiceoverGenerating = computed(() => {
  491. return scriptData.sections.some(section =>
  492. section.dialogues.some(dialogue => dialogue.generatingVoiceover)
  493. )
  494. })
  495. // 校验结果
  496. const isValidationPassed = ref(false)
  497. const validationMessage = ref('')
  498. // 视频预览状态
  499. const showVideoPreviewModal = ref(false)
  500. const activeConversationId = ref(null) // 选中的对话编号
  501. const conversationInAbortController = ref() // 对话进行中 abort 控制器(控制 stream 对话)
  502. const conversationInProgress = ref(false) // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true,避免切换对话、删除对话等操作
  503. const enableContext = ref(false) // 是否开启上下文
  504. // 接收 Stream 消息
  505. const receiveMessageFullText = ref('')
  506. const scriptDataTemp = ref(null)
  507. // 步骤1:生成脚本
  508. const generateScript = async () => {
  509. isGenerating.value = true
  510. try {
  511. clearScriptDataCache()
  512. scriptData.title = ''
  513. scriptData.sections = []
  514. receiveMessageFullText.value = ''
  515. scriptDataTemp.value = null
  516. const role = digitalHumans.value.find(r => r.name === selectedMainTeacher.value)
  517. let content = scriptPrompt.value + "(主讲人:" + role.name + "[" + role.description + "],助讲:"
  518. let zhujiang = []
  519. selectedAssistants.value.forEach((rName) => {
  520. const role = digitalHumans.value.find(r => r.name === rName)
  521. zhujiang.push( role.name + "[" + role.description + "]")
  522. })
  523. content+= zhujiang.join(',') + ")";
  524. await createAiRoleIdConversation(13)
  525. currentStep.value = 2
  526. await doSendMessageStream(activeConversationId.value, content)
  527. } catch (error) {
  528. console.error('生成脚本失败:', error)
  529. } finally {
  530. isGenerating.value = false
  531. }
  532. }
  533. /** 选择 card 角色:新建聊天对话 */
  534. const createAiRoleIdConversation = async (roleId) => {
  535. activeConversationId.value = await ChatConversationApi.createChatConversationMy({
  536. roleId: roleId
  537. })
  538. }
  539. /** 真正执行【发送】消息操作 */
  540. const doSendMessageStream = async (conversationId, content) => {
  541. conversationInAbortController.value = new AbortController()
  542. conversationInProgress.value = true
  543. scriptPrompt.value = ''
  544. try {
  545. let isFirstChunk = true
  546. await ChatMessageApi.sendChatMessageStream(
  547. conversationId,
  548. content,
  549. conversationInAbortController.value,
  550. enableContext.value,
  551. async (res) => {
  552. const { code, data, msg } = JSON.parse(res.data)
  553. if (code !== 0) {
  554. console.error(`对话异常! ${msg}`)
  555. return
  556. }
  557. if (data.eventType === 'TEXT') {
  558. if (data.receive?.content === '') {
  559. return
  560. }
  561. if (isFirstChunk) {
  562. isFirstChunk = false
  563. }
  564. receiveMessageFullText.value += data.receive.content
  565. try {
  566. const parsedData = JSON.parse(receiveMessageFullText.value)
  567. scriptDataTemp.value = parsedData
  568. Object.assign(scriptData, parsedData)
  569. } catch (e) {
  570. // 解析失败,说明数据还不完整,继续等待
  571. }
  572. }
  573. },
  574. (error) => {
  575. console.error(`对话异常! ${error}`)
  576. throw error
  577. },
  578. () => {
  579. try {
  580. if (receiveMessageFullText.value) {
  581. const parsedData = JSON.parse(receiveMessageFullText.value)
  582. scriptDataTemp.value = parsedData
  583. Object.assign(scriptData, parsedData)
  584. }
  585. } catch (e) {
  586. console.error("最终数据解析失败:", e)
  587. }
  588. }
  589. )
  590. } catch (error) {
  591. console.error("发送消息流失败:", error)
  592. } finally {
  593. conversationInProgress.value = false
  594. }
  595. }
  596. // 步骤2:添加环节
  597. const addSection = () => {
  598. scriptData.sections.push({
  599. name: `环节${scriptData.sections.length + 1}`,
  600. backgroundImage: { prompt: '', url: '', generating: false },
  601. backgroundAudio: { type: '', url: '' },
  602. dialogues: []
  603. })
  604. }
  605. // 步骤2:添加对话(数字人)
  606. const addDialogue = (sectionIndex) => {
  607. scriptData.sections[sectionIndex].dialogues.push({
  608. type: 'digital',
  609. roleName: '',
  610. content: '',
  611. voiceoverUrl: '',
  612. generatingVoiceover: false
  613. })
  614. }
  615. // 步骤2:添加用户回复
  616. const addUserReply = (sectionIndex) => {
  617. scriptData.sections[sectionIndex].dialogues.push({
  618. type: 'user',
  619. content: '',
  620. roleName: '',
  621. voiceoverUrl: '',
  622. generatingVoiceover: false
  623. })
  624. }
  625. // 步骤2:删除对话
  626. const removeDialogue = (sectionIndex, dialogueIndex) => {
  627. scriptData.sections[sectionIndex].dialogues.splice(dialogueIndex, 1)
  628. }
  629. // 步骤2:删除环节
  630. const removeSection = (sectionIndex) => {
  631. if (scriptData.sections.length > 1) {
  632. scriptData.sections.splice(sectionIndex, 1)
  633. } else {
  634. alert('至少需要保留一个环节')
  635. }
  636. }
  637. // 图片生成相关状态
  638. const inProgressImageMap = ref({}) // 监听的图片映射,key 为 image 编号,value 为 { sectionIndex, type: 'image'|'audio' }
  639. const inProgressTimer = ref(null) // 生成中的图片定时器,轮询生成进展
  640. // 步骤2:生成单个媒体(仅背景图)
  641. const generateMedia = async (sectionIndex) => {
  642. const section = scriptData.sections[sectionIndex]
  643. const media = section.backgroundImage
  644. media.generating = true
  645. try {
  646. const form = {
  647. platform: 'DOU_BAO',
  648. modelId: 56,
  649. prompt: media.prompt,
  650. width: 1024,
  651. height: 768
  652. }
  653. const response = await ImageApi.drawImage(form)
  654. inProgressImageMap.value[response] = {
  655. sectionIndex
  656. }
  657. } catch (error) {
  658. console.error(`生成图片失败:`, error)
  659. media.generating = false
  660. }
  661. }
  662. // 步骤2:一键生成所有背景图
  663. const generateAllImages = async () => {
  664. isGeneratingImages.value = true
  665. try {
  666. for (let i = 0; i < scriptData.sections.length; i++) {
  667. const section = scriptData.sections[i]
  668. // 只处理没有背景图URL的环节
  669. if (!section.backgroundImage.url) {
  670. await generateMedia(i)
  671. }
  672. }
  673. // 检查是否有图片正在生成
  674. const checkImagesComplete = setInterval(() => {
  675. if (Object.keys(inProgressImageMap.value).length === 0) {
  676. isGeneratingImages.value = false
  677. clearInterval(checkImagesComplete)
  678. }
  679. }, 1000)
  680. } catch (error) {
  681. console.error('生成所有背景图失败:', error)
  682. isGeneratingImages.value = false
  683. }
  684. }
  685. // 轮询生成中的图片列表
  686. const refreshWatchImages = async () => {
  687. const imageIds = Object.keys(inProgressImageMap.value).map(Number)
  688. if (imageIds.length === 0) {
  689. return
  690. }
  691. try {
  692. const list = await ImageApi.getImageListMyByIds(imageIds)
  693. const newWatchImages = {}
  694. list.forEach((image) => {
  695. const info = inProgressImageMap.value[image.id]
  696. if (info) {
  697. if (image.status === AiImageStatusEnum.IN_PROGRESS) {
  698. newWatchImages[image.id] = info
  699. } else if (image.status === AiImageStatusEnum.SUCCESS && image.picUrl) {
  700. const section = scriptData.sections[info.sectionIndex]
  701. section.backgroundImage.url = image.picUrl
  702. section.backgroundImage.generating = false
  703. } else if (image.status === AiImageStatusEnum.FAIL) {
  704. const section = scriptData.sections[info.sectionIndex]
  705. section.backgroundImage.generating = false
  706. }
  707. }
  708. })
  709. inProgressImageMap.value = newWatchImages
  710. } catch (error) {
  711. console.error('轮询图片状态失败:', error)
  712. }
  713. }
  714. // 播放音频通用函数
  715. const playAudio = (url, type) => {
  716. if (audioState.currentAudio) {
  717. audioState.currentAudio.pause()
  718. audioState.currentAudio.currentTime = 0
  719. }
  720. if (audioState.isPlaying && audioState.currentUrl === url && audioState.currentType === type) {
  721. if (audioState.currentAudio) {
  722. audioState.currentAudio.pause()
  723. }
  724. audioState.isPlaying = false
  725. return
  726. }
  727. let audio = audioInstances.get(`${type}_${url}`)
  728. if (!audio) {
  729. audio = new Audio(url)
  730. audioInstances.set(`${type}_${url}`, audio)
  731. audio.onended = () => {
  732. audioState.isPlaying = false
  733. audioState.currentAudio = null
  734. audioState.currentUrl = ''
  735. audioState.currentType = ''
  736. }
  737. }
  738. audio.play().catch(error => {
  739. console.error('播放失败:', error)
  740. audioState.isPlaying = false
  741. })
  742. audioState.currentAudio = audio
  743. audioState.isPlaying = true
  744. audioState.currentUrl = url
  745. audioState.currentType = type
  746. }
  747. // 播放语音
  748. const playVoiceover = (voiceoverUrl) => {
  749. playAudio(voiceoverUrl, 'voice')
  750. }
  751. // 处理背景音选择变化
  752. const handleBackgroundAudioChange = (value, section) => {
  753. if (value) {
  754. const selectedMusic = backgroundMusicTypes.value.find(music => music.id === value)
  755. if (selectedMusic) {
  756. section.backgroundAudio.url = selectedMusic.url
  757. }
  758. } else {
  759. section.backgroundAudio.url = ''
  760. }
  761. }
  762. // 播放背景音
  763. const playBackgroundAudio = (musicType) => {
  764. const selectedMusic = backgroundMusicTypes.value.find(music => music.id === musicType)
  765. const audioUrl = selectedMusic ? selectedMusic.url : `https://example.com/${musicType}.mp3`
  766. playAudio(audioUrl, 'background')
  767. }
  768. // 生成单个语音
  769. const generateVoiceover = async (sectionIndex, dialogueIndex) => {
  770. const dialogue = scriptData.sections[sectionIndex].dialogues[dialogueIndex]
  771. // 只处理数字人类型的对话
  772. if (dialogue.type !== 'digital') {
  773. return
  774. }
  775. dialogue.generatingVoiceover = true
  776. let role = digitalHumans.value.find(r => r.name === dialogue.roleName)
  777. try {
  778. // 调用后端API将文本转成语音
  779. const speechUrl = await TtsApi.convert({
  780. roleId: Number(role.id),
  781. content: dialogue.content
  782. })
  783. // 将返回的URL赋值给对话
  784. dialogue.voiceoverUrl = speechUrl
  785. } catch (error) {
  786. console.error('生成语音失败:', error)
  787. } finally {
  788. dialogue.generatingVoiceover = false
  789. }
  790. }
  791. // 步骤3:一键生成所有语音
  792. const generateAllVoiceovers = async () => {
  793. isGeneratingVoiceovers.value = true
  794. try {
  795. for (let i = 0; i < scriptData.sections.length; i++) {
  796. for (let j = 0; j < scriptData.sections[i].dialogues.length; j++) {
  797. const dialogue = scriptData.sections[i].dialogues[j]
  798. // 只处理没有语音URL的对话
  799. if (!dialogue.voiceoverUrl) {
  800. await generateVoiceover(i, j)
  801. }
  802. }
  803. }
  804. } catch (error) {
  805. console.error('生成所有语音失败:', error)
  806. } finally {
  807. isGeneratingVoiceovers.value = false
  808. }
  809. }
  810. // 获取角色名称
  811. const getRoleName = (roleName) => {
  812. const role = digitalHumans.value.find(r => r.name === roleName)
  813. return role ? role.name : '未知角色'
  814. }
  815. // 解析 Markdown 文本
  816. const parseMarkdown = (text) => {
  817. if (!text) return ''
  818. return marked(text)
  819. }
  820. // 步骤4:校验脚本
  821. const validateScript = () => {
  822. let isValid = true
  823. let message = '校验通过'
  824. if (!scriptData.sections.every(s => s.name.trim())) {
  825. isValid = false
  826. message = '存在空的环节名称'
  827. } else if (!scriptData.sections.every(s => s.backgroundImage.url)) {
  828. isValid = false
  829. message = '存在未生成的背景图'
  830. } else if (!scriptData.sections.every(s =>
  831. s.dialogues.every(d => (d.type === 'digital' && d.roleName && d.content.trim() && d.voiceoverUrl) || (d.type === 'user' && d.roleName && d.content.trim()))
  832. )) {
  833. isValid = false
  834. message = '存在未完成的对话或语音'
  835. }
  836. isValidationPassed.value = isValid
  837. validationMessage.value = message
  838. }
  839. // 步骤4:保存脚本
  840. const saveScript = async () => {
  841. validateScript()
  842. if (!isValidationPassed.value) {
  843. return
  844. }
  845. console.log('scriptData===', JSON.stringify(scriptData))
  846. }
  847. // 下一步操作
  848. const nextStep = () => {
  849. if (canProceed.value) {
  850. if (currentStep.value === 2) {
  851. validateScript()
  852. }
  853. currentStep.value++
  854. }
  855. }
  856. // 显示视频预览
  857. const showVideoPreview = () => {
  858. showVideoPreviewModal.value = true
  859. }
  860. // 关闭视频预览
  861. const closeVideoPreview = () => {
  862. showVideoPreviewModal.value = false
  863. }
  864. // 组件挂载时
  865. onMounted(async () => {
  866. try {
  867. const params = {
  868. pageOn: 1,
  869. pageSize: 100,
  870. category: "小学低年级",
  871. publicStatus: true
  872. }
  873. const { list } = await ChatRoleApi.getMyPage(params)
  874. params.category += "AI"
  875. const { list:listAi } = await ChatRoleApi.getMyPage(params)
  876. list.push(...listAi)
  877. digitalHumans.value = list
  878. } catch (error) {
  879. console.error('获取角色数据失败:', error)
  880. }
  881. inProgressTimer.value = setInterval(async () => {
  882. await refreshWatchImages()
  883. }, 3000)
  884. })
  885. // 组件卸载时
  886. onUnmounted(() => {
  887. if (inProgressTimer.value) {
  888. clearInterval(inProgressTimer.value)
  889. }
  890. })
  891. </script>
  892. <style scoped>
  893. .course-script-editor {
  894. width: 100%;
  895. height: 100vh;
  896. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  897. display: flex;
  898. flex-direction: column;
  899. overflow: hidden;
  900. background-color: #f8f9fa;
  901. }
  902. /* 主容器样式 */
  903. .main-container {
  904. flex: 1;
  905. display: flex;
  906. overflow: hidden;
  907. }
  908. /* 左侧步骤指示器样式 */
  909. .steps-sidebar {
  910. width: 200px;
  911. background-color: #f5f7fa;
  912. border-right: 1px solid #ebeef5;
  913. padding: 30px 0;
  914. display: flex;
  915. align-items: center;
  916. }
  917. /* 右侧内容区域样式 */
  918. .content-area {
  919. flex: 1;
  920. display: flex;
  921. flex-direction: column;
  922. overflow: hidden;
  923. }
  924. /* 步骤内容样式 */
  925. .step-content {
  926. flex: 1;
  927. padding: 20px;
  928. overflow: hidden;
  929. display: flex;
  930. flex-direction: column;
  931. background-color: white;
  932. border-radius: 0;
  933. box-shadow: none;
  934. }
  935. /* 步骤1垂直居中 */
  936. .step-content:has(.ai-input-container) {
  937. justify-content: center;
  938. align-items: center;
  939. }
  940. /* 编辑器工具栏样式 - 固定顶部 */
  941. .editor-toolbar.sticky-top {
  942. position: sticky;
  943. top: 0;
  944. z-index: 100;
  945. margin-top: -20px;
  946. margin-left: -20px;
  947. margin-right: -20px;
  948. border-radius: 0;
  949. border-bottom: 1px solid #ebeef5;
  950. background: rgba(250, 250, 250, 0.95);
  951. backdrop-filter: blur(10px);
  952. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  953. }
  954. /* 脚本编辑器样式 - 可滚动 */
  955. .script-editor {
  956. flex: 1;
  957. overflow-y: auto;
  958. margin-top: 20px;
  959. padding-right: 10px;
  960. background-color: white;
  961. border-radius: 8px;
  962. padding: 20px;
  963. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  964. }
  965. .script-editor::-webkit-scrollbar {
  966. width: 6px;
  967. }
  968. .script-editor::-webkit-scrollbar-track {
  969. background: #f1f1f1;
  970. border-radius: 3px;
  971. }
  972. .script-editor::-webkit-scrollbar-thumb {
  973. background: #c1c1c1;
  974. border-radius: 3px;
  975. }
  976. .script-editor::-webkit-scrollbar-thumb:hover {
  977. background: #a1a1a1;
  978. }
  979. /* 步骤导航 */
  980. .steps-container {
  981. display: flex;
  982. flex-direction: column;
  983. align-items: center;
  984. gap: 20px;
  985. width: 100%;
  986. .step-item {
  987. display: flex;
  988. flex-direction: column;
  989. align-items: center;
  990. width: 100%;
  991. .step-circle {
  992. width: 32px;
  993. height: 32px;
  994. border-radius: 50%;
  995. display: flex;
  996. align-items: center;
  997. justify-content: center;
  998. font-weight: bold;
  999. margin-bottom: 8px;
  1000. }
  1001. .step-title {
  1002. font-size: 14px;
  1003. text-align: center;
  1004. padding: 0 20px;
  1005. }
  1006. &.process {
  1007. .step-circle {
  1008. background-color: #409EFF;
  1009. color: white;
  1010. }
  1011. .step-title {
  1012. color: #409EFF;
  1013. }
  1014. }
  1015. &.wait {
  1016. .step-circle {
  1017. background-color: #E4E7ED;
  1018. color: #C0C4CC;
  1019. }
  1020. .step-title {
  1021. color: #C0C4CC;
  1022. }
  1023. }
  1024. &.finish {
  1025. .step-circle {
  1026. background-color: #67C23A;
  1027. color: white;
  1028. }
  1029. .step-title {
  1030. color: #67C23A;
  1031. }
  1032. }
  1033. }
  1034. .step-line {
  1035. width: 2px;
  1036. height: 40px;
  1037. background-color: #E4E7ED;
  1038. &.active {
  1039. background-color: #409EFF;
  1040. }
  1041. }
  1042. }
  1043. /* 步骤内容 */
  1044. .step-content {
  1045. background-color: white;
  1046. border-radius: 8px;
  1047. padding: 20px;
  1048. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  1049. }
  1050. /* 对话类型标签 */
  1051. .dialogue-type-tag {
  1052. position: absolute;
  1053. top: -10px;
  1054. left: 10px;
  1055. padding: 2px 8px;
  1056. border-radius: 10px;
  1057. font-size: 12px;
  1058. font-weight: 500;
  1059. color: white;
  1060. }
  1061. .dialogue-type-tag.digital {
  1062. background-color: #409EFF;
  1063. }
  1064. .dialogue-type-tag.user {
  1065. background-color: #67C23A;
  1066. }
  1067. /* 对话项样式 */
  1068. .dialogue-item {
  1069. position: relative;
  1070. background-color: #f9f9f9;
  1071. border-radius: 8px;
  1072. padding: 20px;
  1073. margin-bottom: 15px;
  1074. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  1075. transition: all 0.3s ease;
  1076. }
  1077. .dialogue-item:hover {
  1078. box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  1079. }
  1080. .dialogue-item.digital {
  1081. border-left: 4px solid #409EFF;
  1082. }
  1083. .dialogue-item.user {
  1084. border-left: 4px solid #67C23A;
  1085. }
  1086. /* 对话头部 */
  1087. .dialogue-header {
  1088. margin-bottom: 10px;
  1089. }
  1090. /* 对话行 */
  1091. .dialogue-row {
  1092. display: flex;
  1093. gap: 15px;
  1094. align-items: flex-start;
  1095. }
  1096. /* 角色选择 */
  1097. .dialogue-role-select {
  1098. flex-shrink: 0;
  1099. }
  1100. /* 回复角色选择 */
  1101. .dialogue-reply-select {
  1102. flex-shrink: 0;
  1103. }
  1104. /* 内容容器 */
  1105. .dialogue-content-container {
  1106. flex: 1;
  1107. min-width: 0;
  1108. }
  1109. /* 添加对话按钮容器 */
  1110. .add-dialogue-buttons {
  1111. display: flex;
  1112. gap: 10px;
  1113. margin-top: 15px;
  1114. }
  1115. /* 添加对话按钮 */
  1116. .add-dialogue-btn {
  1117. padding: 8px 16px;
  1118. border: none;
  1119. border-radius: 4px;
  1120. font-size: 14px;
  1121. font-weight: 500;
  1122. cursor: pointer;
  1123. transition: all 0.3s ease;
  1124. display: flex;
  1125. align-items: center;
  1126. justify-content: center;
  1127. gap: 5px;
  1128. min-width: 120px;
  1129. }
  1130. .add-dialogue-btn.digital {
  1131. background-color: #83c2ff;
  1132. color: white;
  1133. }
  1134. .add-dialogue-btn.digital:hover {
  1135. background-color: #409EFF;
  1136. border-color: #4aa2fd;
  1137. color: white;
  1138. }
  1139. .add-dialogue-btn.user {
  1140. background-color: #85ce61;
  1141. color: white;
  1142. }
  1143. .add-dialogue-btn.user:hover {
  1144. background-color: #67C23A;
  1145. border-color: #67C23A;
  1146. color: white;
  1147. }
  1148. /* 预览对话样式 */
  1149. .preview-dialogue {
  1150. position: relative;
  1151. margin-bottom: 20px;
  1152. padding: 15px;
  1153. border-radius: 8px;
  1154. background-color: #f9f9f9;
  1155. }
  1156. .preview-dialogue.digital {
  1157. border-left: 4px solid #409EFF;
  1158. }
  1159. .preview-dialogue.user {
  1160. border-left: 4px solid #67C23A;
  1161. }
  1162. .preview-dialogue .dialogue-header {
  1163. display: flex;
  1164. align-items: center;
  1165. justify-content: space-between;
  1166. gap: 0;
  1167. margin-bottom: 10px;
  1168. }
  1169. .preview-dialogue .dialogue-header-left {
  1170. display: flex;
  1171. align-items: center;
  1172. gap: 2px;
  1173. }
  1174. .preview-dialogue .dialogue-type-tag {
  1175. position: static;
  1176. margin-right: 2px;
  1177. }
  1178. /* 回复信息 */
  1179. .reply-info {
  1180. margin-top: 10px;
  1181. padding-top: 10px;
  1182. border-top: 1px solid #e8e8e8;
  1183. font-size: 14px;
  1184. color: #666;
  1185. font-style: italic;
  1186. }
  1187. /* AI输入容器 */
  1188. .ai-input-container {
  1189. max-width: 800px;
  1190. margin: 0 auto;
  1191. padding: 30px;
  1192. background: white;
  1193. border-radius: 16px;
  1194. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  1195. display: flex;
  1196. flex-direction: column;
  1197. min-height: 500px;
  1198. }
  1199. .selection-group {
  1200. margin-bottom: 30px;
  1201. }
  1202. .ai-input-wrapper {
  1203. margin-bottom: 30px;
  1204. }
  1205. .ai-input-container button.generate-btn.primary {
  1206. margin-top: 30px;
  1207. align-self: center;
  1208. }
  1209. .ai-input-wrapper {
  1210. position: relative;
  1211. margin-bottom: 30px;
  1212. }
  1213. .ai-icon {
  1214. position: absolute;
  1215. top: 20px;
  1216. left: 20px;
  1217. font-size: 28px;
  1218. color: #409EFF;
  1219. background: rgba(64, 158, 255, 0.1);
  1220. width: 48px;
  1221. height: 48px;
  1222. border-radius: 12px;
  1223. display: flex;
  1224. align-items: center;
  1225. justify-content: center;
  1226. animation: pulse 2s infinite;
  1227. }
  1228. @keyframes pulse {
  1229. 0% {
  1230. box-shadow: 0 0 0 0 rgba(64, 158, 255, 0.4);
  1231. }
  1232. 70% {
  1233. box-shadow: 0 0 0 10px rgba(64, 158, 255, 0);
  1234. }
  1235. 100% {
  1236. box-shadow: 0 0 0 0 rgba(64, 158, 255, 0);
  1237. }
  1238. }
  1239. .ai-textarea {
  1240. width: 100%;
  1241. min-height: 140px;
  1242. padding: 24px 24px 24px 84px;
  1243. border: 2px solid #e8e8e8;
  1244. border-radius: 16px;
  1245. font-size: 16px;
  1246. resize: vertical;
  1247. transition: all 0.3s ease;
  1248. background: #fafafa;
  1249. line-height: 1.6;
  1250. }
  1251. .ai-textarea:focus {
  1252. outline: none;
  1253. border-color: #409EFF;
  1254. background: white;
  1255. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1256. }
  1257. .selection-group {
  1258. display: grid;
  1259. grid-template-columns: 1fr 1fr;
  1260. gap: 24px;
  1261. margin-bottom: 30px;
  1262. }
  1263. .selection-item {
  1264. display: flex;
  1265. flex-direction: column;
  1266. gap: 10px;
  1267. }
  1268. .selection-item label {
  1269. font-weight: 600;
  1270. color: #333;
  1271. font-size: 14px;
  1272. text-transform: uppercase;
  1273. letter-spacing: 0.5px;
  1274. color: #666;
  1275. }
  1276. .selection-item select {
  1277. padding: 14px 16px;
  1278. border: 2px solid #e8e8e8;
  1279. border-radius: 10px;
  1280. font-size: 14px;
  1281. transition: all 0.3s ease;
  1282. background: white;
  1283. }
  1284. .selection-item select:focus {
  1285. outline: none;
  1286. border-color: #409EFF;
  1287. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1288. }
  1289. .multi-select {
  1290. display: flex;
  1291. flex-wrap: wrap;
  1292. gap: 10px;
  1293. padding: 12px;
  1294. border: 2px solid #e8e8e8;
  1295. border-radius: 10px;
  1296. background: white;
  1297. transition: all 0.3s ease;
  1298. }
  1299. .multi-select:focus-within {
  1300. border-color: #409EFF;
  1301. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1302. }
  1303. .select-option {
  1304. padding: 8px 16px;
  1305. background: #f5f5f5;
  1306. border-radius: 20px;
  1307. cursor: pointer;
  1308. transition: all 0.2s ease;
  1309. font-size: 14px;
  1310. font-weight: 500;
  1311. border: 1px solid transparent;
  1312. }
  1313. .select-option:hover {
  1314. background: #e6f7ff;
  1315. border-color: #91d5ff;
  1316. }
  1317. .select-option.selected {
  1318. background: #409EFF;
  1319. color: white;
  1320. border-color: #409EFF;
  1321. box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
  1322. }
  1323. /* 加载遮挡层样式 */
  1324. .loading-overlay {
  1325. position: fixed;
  1326. top: 0;
  1327. left: 0;
  1328. width: 100%;
  1329. height: 100%;
  1330. background-color: rgba(0, 0, 0, 0.1);
  1331. display: flex;
  1332. align-items: center;
  1333. justify-content: center;
  1334. z-index: 9999;
  1335. pointer-events: auto;
  1336. }
  1337. .loading-content {
  1338. display: flex;
  1339. flex-direction: column;
  1340. align-items: center;
  1341. gap: 16px;
  1342. background: white;
  1343. padding: 32px;
  1344. border-radius: 12px;
  1345. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  1346. pointer-events: auto;
  1347. }
  1348. .loading-spinner {
  1349. width: 48px;
  1350. height: 48px;
  1351. border: 4px solid #f3f3f3;
  1352. border-top: 4px solid #409EFF;
  1353. border-radius: 50%;
  1354. animation: spin 1s linear infinite;
  1355. }
  1356. @keyframes spin {
  1357. 0% { transform: rotate(0deg); }
  1358. 100% { transform: rotate(360deg); }
  1359. }
  1360. .loading-text {
  1361. font-size: 16px;
  1362. font-weight: 500;
  1363. color: #333;
  1364. }
  1365. /* 按钮样式 */
  1366. .generate-btn {
  1367. padding: 14px 8px;
  1368. border: none;
  1369. border-radius: 8px;
  1370. font-size: 14px;
  1371. font-weight: 400;
  1372. cursor: pointer;
  1373. transition: all 0.3s ease;
  1374. position: relative;
  1375. overflow: hidden;
  1376. }
  1377. .generate-btn.primary {
  1378. background: linear-gradient(135deg, #409EFF, #1890ff);
  1379. color: white;
  1380. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  1381. }
  1382. .generate-btn.primary:hover {
  1383. transform: translateY(-2px);
  1384. box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
  1385. }
  1386. .generate-btn.primary:disabled {
  1387. background: #91c5f7;
  1388. cursor: not-allowed;
  1389. transform: none;
  1390. box-shadow: none;
  1391. }
  1392. .generate-btn.small {
  1393. padding: 8px 16px;
  1394. font-size: 14px;
  1395. border-radius: 8px;
  1396. }
  1397. .generate-btn.small:hover {
  1398. transform: translateY(-1px);
  1399. box-shadow: 0 3px 8px rgba(64, 158, 255, 0.3);
  1400. }
  1401. .generate-btn.small:disabled {
  1402. background: #91c5f7;
  1403. color: white;
  1404. cursor: not-allowed;
  1405. transform: none;
  1406. box-shadow: none;
  1407. }
  1408. .toolbar-btn:disabled {
  1409. background: #f0f0f0;
  1410. color: #c0c0c0;
  1411. border-color: #e0e0e0;
  1412. cursor: not-allowed;
  1413. transform: none;
  1414. box-shadow: none;
  1415. }
  1416. .toolbar-btn:disabled:hover {
  1417. background: #f0f0f0;
  1418. color: #c0c0c0;
  1419. border-color: #e0e0e0;
  1420. transform: none;
  1421. box-shadow: none;
  1422. }
  1423. /* 编辑器工具栏 */
  1424. .editor-toolbar {
  1425. position: sticky;
  1426. top: 20px;
  1427. z-index: 100;
  1428. margin-bottom: 30px;
  1429. padding: 16px 20px;
  1430. background: rgba(250, 250, 250, 0.95);
  1431. backdrop-filter: blur(10px);
  1432. border-radius: 12px;
  1433. border: 1px solid #e8e8e8;
  1434. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  1435. overflow-x: auto;
  1436. overflow-y: hidden;
  1437. white-space: nowrap;
  1438. }
  1439. .editor-toolbar::-webkit-scrollbar {
  1440. height: 4px;
  1441. }
  1442. .editor-toolbar::-webkit-scrollbar-track {
  1443. background: #f1f1f1;
  1444. border-radius: 2px;
  1445. }
  1446. .editor-toolbar::-webkit-scrollbar-thumb {
  1447. background: #c1c1c1;
  1448. border-radius: 2px;
  1449. }
  1450. .editor-toolbar::-webkit-scrollbar-thumb:hover {
  1451. background: #a1a1a1;
  1452. }
  1453. .toolbar-btn {
  1454. padding: 12px 24px;
  1455. margin: 0 12px;
  1456. background: white;
  1457. border: 2px solid #e8e8e8;
  1458. border-radius: 10px;
  1459. cursor: pointer;
  1460. transition: all 0.3s ease;
  1461. font-weight: 500;
  1462. color: #333;
  1463. }
  1464. .toolbar-btn:hover {
  1465. background: #409EFF;
  1466. color: white;
  1467. border-color: #409EFF;
  1468. transform: translateY(-1px);
  1469. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  1470. }
  1471. /* 脚本编辑器 */
  1472. .script-section {
  1473. margin-top: 40px;
  1474. margin-bottom: 40px;
  1475. padding: 5px 24px 24px;
  1476. background: white;
  1477. border-radius: 16px;
  1478. position: relative;
  1479. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  1480. border: 1px solid #f0f0f0;
  1481. }
  1482. .section-header {
  1483. margin-bottom: 24px;
  1484. display: flex;
  1485. align-items: center;
  1486. gap: 16px;
  1487. }
  1488. .section-name-container {
  1489. display: flex;
  1490. align-items: center;
  1491. flex: 1;
  1492. gap: 12px;
  1493. margin-top: 16px;
  1494. }
  1495. .remove-section-btn {
  1496. background: #ff4d4f;
  1497. border: none;
  1498. color: white;
  1499. font-size: 16px;
  1500. cursor: pointer;
  1501. padding: 0;
  1502. width: 28px;
  1503. height: 28px;
  1504. display: flex;
  1505. align-items: center;
  1506. justify-content: center;
  1507. border-radius: 6px;
  1508. transition: all 0.3s ease;
  1509. flex-shrink: 0;
  1510. }
  1511. .remove-section-btn:hover {
  1512. background: #ff7875;
  1513. transform: scale(1.1);
  1514. box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
  1515. }
  1516. .section-name-label {
  1517. padding: 2px 15px;
  1518. border-radius: 10px;
  1519. font-size: 18px;
  1520. font-weight: 500;
  1521. color: white;
  1522. background-color: #c18484;
  1523. white-space: nowrap;
  1524. display: flex;
  1525. align-items: center;
  1526. height: 44px;
  1527. box-sizing: border-box;
  1528. }
  1529. .section-title {
  1530. flex: 1;
  1531. padding: 14px 16px;
  1532. border: 2px solid #e8e8e8;
  1533. border-radius: 10px;
  1534. font-size: 16px;
  1535. font-weight: 500;
  1536. transition: all 0.3s ease;
  1537. }
  1538. .section-title:focus {
  1539. outline: none;
  1540. border-color: #409EFF;
  1541. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1542. }
  1543. .media-controls {
  1544. display: flex;
  1545. background: linear-gradient(135deg, #f8f9fa, #ffffff);
  1546. padding: 16px 20px;
  1547. border-radius: 10px;
  1548. border: 1px solid #e8e8e8;
  1549. align-items: center;
  1550. justify-content: space-between;
  1551. }
  1552. .media-item {
  1553. display: flex;
  1554. align-items: center;
  1555. gap: 10px;
  1556. margin-right: 50px;
  1557. }
  1558. .media-input-group {
  1559. display: flex;
  1560. align-items: center;
  1561. gap: 10px;
  1562. }
  1563. .media-label {
  1564. font-size: 14px;
  1565. font-weight: 600;
  1566. white-space: nowrap;
  1567. color: #666;
  1568. }
  1569. .media-prompt {
  1570. font-size: 14px;
  1571. transition: all 0.3s ease;
  1572. width: 300px;
  1573. }
  1574. .media-prompt .el-textarea {
  1575. width: 100%;
  1576. min-height: 60px;
  1577. }
  1578. .media-prompt .el-textarea__inner {
  1579. padding: 8px 12px;
  1580. border: 2px solid #e8e8e8;
  1581. border-radius: 8px;
  1582. font-size: 14px;
  1583. transition: all 0.3s ease;
  1584. min-height: 60px;
  1585. resize: none;
  1586. }
  1587. .media-prompt .el-textarea__inner:focus {
  1588. outline: none;
  1589. border-color: #409EFF;
  1590. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1591. }
  1592. .media-preview {
  1593. margin-top: 12px;
  1594. margin-left: 20px;
  1595. }
  1596. .media-preview img {
  1597. max-width: 180px;
  1598. border-radius: 8px;
  1599. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  1600. transition: transform 0.3s ease;
  1601. }
  1602. .media-preview img:hover {
  1603. transform: scale(1.05);
  1604. }
  1605. .dialogues-container {
  1606. margin-top: 48px;
  1607. }
  1608. .dialogue-item {
  1609. margin-bottom: 20px;
  1610. padding: 20px;
  1611. background: #fafafa;
  1612. border-radius: 12px;
  1613. border: 1px solid #e8e8e8;
  1614. transition: all 0.3s ease;
  1615. }
  1616. .dialogue-item:hover {
  1617. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  1618. transform: translateY(-2px);
  1619. }
  1620. .dialogue-row {
  1621. display: flex;
  1622. align-items: flex-start;
  1623. gap: 16px;
  1624. }
  1625. .dialogue-role-select {
  1626. min-width: 140px;
  1627. }
  1628. .dialogue-role-select select {
  1629. width: 100%;
  1630. padding: 10px 12px;
  1631. border: 2px solid #e8e8e8;
  1632. border-radius: 8px;
  1633. font-size: 14px;
  1634. transition: all 0.3s ease;
  1635. }
  1636. .dialogue-role-select select:focus {
  1637. outline: none;
  1638. border-color: #409EFF;
  1639. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1640. }
  1641. .dialogue-content-container {
  1642. flex: 1;
  1643. }
  1644. .dialogue-content:focus {
  1645. outline: none;
  1646. border-color: #409EFF;
  1647. box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
  1648. }
  1649. .remove-btn {
  1650. background: #ff4d4f;
  1651. border: none;
  1652. color: white;
  1653. font-size: 16px;
  1654. cursor: pointer;
  1655. padding: 0;
  1656. width: 28px;
  1657. height: 28px;
  1658. display: flex;
  1659. align-items: center;
  1660. justify-content: center;
  1661. border-radius: 6px;
  1662. transition: all 0.3s ease;
  1663. flex-shrink: 0;
  1664. }
  1665. .remove-btn:hover {
  1666. background: #ff7875;
  1667. transform: scale(1.1);
  1668. box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
  1669. }
  1670. .dialogue-header {
  1671. display: flex;
  1672. justify-content: space-between;
  1673. align-items: center;
  1674. margin-bottom: 8px;
  1675. }
  1676. .dialogue-text {
  1677. flex: 1;
  1678. width: 100%;
  1679. font-size: 16px;
  1680. line-height: 1.6;
  1681. }
  1682. .generate-btn.small {
  1683. padding: 8px;
  1684. background: linear-gradient(135deg, #409EFF, #1890ff);
  1685. color: white;
  1686. border: none;
  1687. border-radius: 6px;
  1688. cursor: pointer;
  1689. transition: all 0.3s ease;
  1690. display: flex;
  1691. align-items: center;
  1692. justify-content: center;
  1693. height: 28px;
  1694. font-size: 14px;
  1695. }
  1696. .generate-btn.small:hover {
  1697. transform: scale(1.1);
  1698. box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
  1699. }
  1700. .play-btn {
  1701. padding: 8px;
  1702. background: #52c41a;
  1703. color: white;
  1704. border: none;
  1705. border-radius: 6px;
  1706. cursor: pointer;
  1707. transition: all 0.3s ease;
  1708. display: flex;
  1709. align-items: center;
  1710. justify-content: center;
  1711. width: 28px;
  1712. height: 28px;
  1713. font-size: 14px;
  1714. }
  1715. .play-btn:hover {
  1716. background: #73d13d;
  1717. transform: scale(1.1);
  1718. box-shadow: 0 2px 8px rgba(82, 196, 26, 0.3);
  1719. }
  1720. .play-btn.small {
  1721. padding: 8px;
  1722. width: 28px;
  1723. height: 28px;
  1724. font-size: 14px;
  1725. }
  1726. .voice-icon {
  1727. font-size: 14px;
  1728. line-height: 1;
  1729. }
  1730. .play-icon {
  1731. font-size: 14px;
  1732. line-height: 1;
  1733. }
  1734. .action-buttons {
  1735. display: flex;
  1736. flex-direction: column;
  1737. gap: 8px;
  1738. margin-left: 8px;
  1739. }
  1740. .action-buttons-row {
  1741. display: flex;
  1742. gap: 8px;
  1743. align-items: center;
  1744. justify-content: flex-end;
  1745. }
  1746. .add-dialogue-btn,
  1747. .add-section-btn {
  1748. padding: 12px 24px;
  1749. background: white;
  1750. border: 2px dashed #d9d9d9;
  1751. border-radius: 10px;
  1752. cursor: pointer;
  1753. transition: all 0.3s ease;
  1754. font-weight: 500;
  1755. color: #666;
  1756. margin-top: 16px;
  1757. width: 100%;
  1758. text-align: center;
  1759. }
  1760. .add-dialogue-btn:hover,
  1761. .add-section-btn:hover {
  1762. border-color: #c18484;
  1763. color: white;
  1764. background: rgba(193, 132, 132, 0.6);
  1765. transform: translateY(-1px);
  1766. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
  1767. }
  1768. /* 预览页面 */
  1769. .preview-container {
  1770. width: 100%;
  1771. height: 100%;
  1772. background: white;
  1773. border-radius: 16px;
  1774. padding: 30px;
  1775. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  1776. display: flex;
  1777. flex-direction: column;
  1778. }
  1779. .preview-content {
  1780. flex: 1;
  1781. overflow-y: auto;
  1782. margin-top: 20px;
  1783. margin-bottom: 30px;
  1784. padding-right: 10px;
  1785. }
  1786. .preview-content::-webkit-scrollbar {
  1787. width: 6px;
  1788. }
  1789. .preview-content::-webkit-scrollbar-track {
  1790. background: #f1f1f1;
  1791. border-radius: 3px;
  1792. }
  1793. .preview-content::-webkit-scrollbar-thumb {
  1794. background: #c1c1c1;
  1795. border-radius: 3px;
  1796. }
  1797. .preview-content::-webkit-scrollbar-thumb:hover {
  1798. background: #a1a1a1;
  1799. }
  1800. .preview-actions {
  1801. margin-top: auto;
  1802. display: flex;
  1803. justify-content: flex-end;
  1804. gap: 12px;
  1805. }
  1806. .validation-result {
  1807. padding: 16px 20px;
  1808. border-radius: 10px;
  1809. font-weight: 500;
  1810. font-size: 14px;
  1811. }
  1812. .validation-result.valid {
  1813. background: #f6ffed;
  1814. border: 2px solid #b7eb8f;
  1815. color: #52c41a;
  1816. box-shadow: 0 2px 8px rgba(82, 196, 26, 0.1);
  1817. }
  1818. .validation-result.invalid {
  1819. background: #fff2f0;
  1820. border: 2px solid #ffccc7;
  1821. color: #ff4d4f;
  1822. box-shadow: 0 2px 8px rgba(255, 77, 79, 0.1);
  1823. }
  1824. .preview-section {
  1825. margin-bottom: 40px;
  1826. padding: 40px;
  1827. border-radius: 12px;
  1828. border: 1px solid #e8e8e8;
  1829. min-height: 300px;
  1830. display: flex;
  1831. align-items: center;
  1832. justify-content: center;
  1833. }
  1834. .preview-section h4 {
  1835. margin-top: 0;
  1836. color: #333;
  1837. font-size: 18px;
  1838. font-weight: 600;
  1839. margin-bottom: 20px;
  1840. }
  1841. .preview-section-content {
  1842. background: rgba(255, 255, 255, 0.2);
  1843. padding: 20px;
  1844. border-radius: 12px;
  1845. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  1846. backdrop-filter: blur(5px);
  1847. width: 80% ;
  1848. }
  1849. .preview-media {
  1850. margin: 20px 0;
  1851. padding: 16px;
  1852. background: rgba(255, 255, 255, 0.8);
  1853. border-radius: 10px;
  1854. border: 1px solid #e8e8e8;
  1855. display: flex;
  1856. align-items: center;
  1857. justify-content: space-between;
  1858. flex-wrap: wrap;
  1859. }
  1860. .preview-media-left {
  1861. display: flex;
  1862. align-items: center;
  1863. gap: 12px;
  1864. }
  1865. .preview-media-right {
  1866. display: flex;
  1867. align-items: center;
  1868. gap: 12px;
  1869. }
  1870. .preview-image img {
  1871. max-width: 250px;
  1872. border-radius: 8px;
  1873. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  1874. transition: transform 0.3s ease;
  1875. }
  1876. .preview-image img:hover {
  1877. transform: scale(1.05);
  1878. }
  1879. .preview-audio{
  1880. float: right;
  1881. margin-right: 20px;
  1882. display: flex;
  1883. align-items: center;
  1884. gap: 8px;
  1885. }
  1886. .preview-dialogue {
  1887. margin-bottom: 20px;
  1888. padding: 16px;
  1889. background: white;
  1890. border-radius: 10px;
  1891. border: 1px solid #e8e8e8;
  1892. transition: all 0.3s ease;
  1893. }
  1894. .dialogue-header {
  1895. display: flex;
  1896. justify-content: space-between;
  1897. align-items: center;
  1898. margin-bottom: 8px;
  1899. }
  1900. .preview-dialogue:hover {
  1901. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  1902. }
  1903. .dialogue-role {
  1904. font-weight: 600;
  1905. color: #409EFF;
  1906. font-size: 14px;
  1907. }
  1908. .dialogue-text {
  1909. line-height: 1.6;
  1910. font-size: 14px;
  1911. color: #333;
  1912. }
  1913. /* Markdown 样式 */
  1914. .dialogue-text h1,
  1915. .dialogue-text h2,
  1916. .dialogue-text h3,
  1917. .dialogue-text h4,
  1918. .dialogue-text h5,
  1919. .dialogue-text h6 {
  1920. margin: 16px 0 8px 0;
  1921. font-weight: 600;
  1922. line-height: 1.2;
  1923. }
  1924. .dialogue-text h1 { font-size: 24px; }
  1925. .dialogue-text h2 { font-size: 20px; }
  1926. .dialogue-text h3 { font-size: 18px; }
  1927. .dialogue-text h4 { font-size: 16px; }
  1928. .dialogue-text h5 { font-size: 14px; }
  1929. .dialogue-text h6 { font-size: 12px; }
  1930. .dialogue-text p {
  1931. margin: 8px 0;
  1932. }
  1933. .dialogue-text ul,
  1934. .dialogue-text ol {
  1935. margin: 8px 0;
  1936. padding-left: 24px;
  1937. }
  1938. .dialogue-text li {
  1939. margin: 4px 0;
  1940. }
  1941. .dialogue-text strong {
  1942. font-weight: 600;
  1943. }
  1944. .dialogue-text em {
  1945. font-style: italic;
  1946. }
  1947. .dialogue-text a {
  1948. color: #409EFF;
  1949. text-decoration: none;
  1950. }
  1951. .dialogue-text a:hover {
  1952. text-decoration: underline;
  1953. }
  1954. .dialogue-text code {
  1955. background: #f5f5f5;
  1956. padding: 2px 4px;
  1957. border-radius: 4px;
  1958. font-family: 'Courier New', Courier, monospace;
  1959. font-size: 14px;
  1960. }
  1961. .dialogue-text pre {
  1962. background: #f5f5f5;
  1963. padding: 12px;
  1964. border-radius: 8px;
  1965. overflow-x: auto;
  1966. margin: 12px 0;
  1967. }
  1968. .dialogue-text pre code {
  1969. background: none;
  1970. padding: 0;
  1971. }
  1972. .voiceover-preview {
  1973. margin-top: 12px;
  1974. padding-top: 12px;
  1975. border-top: 1px solid #f0f0f0;
  1976. }
  1977. .preview-actions {
  1978. display: flex;
  1979. justify-content: center;
  1980. gap: 20px;
  1981. padding-top: 24px;
  1982. border-top: 1px solid #e8e8e8;
  1983. }
  1984. .primary-btn,
  1985. .secondary-btn {
  1986. padding: 14px 32px;
  1987. border: none;
  1988. border-radius: 12px;
  1989. font-size: 16px;
  1990. font-weight: 600;
  1991. cursor: pointer;
  1992. transition: all 0.3s ease;
  1993. position: relative;
  1994. overflow: hidden;
  1995. }
  1996. .primary-btn {
  1997. background: linear-gradient(135deg, #409EFF, #1890ff);
  1998. color: white;
  1999. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  2000. }
  2001. .primary-btn:hover {
  2002. transform: translateY(-2px);
  2003. box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
  2004. }
  2005. .primary-btn:disabled {
  2006. background: #91c5f7;
  2007. cursor: not-allowed;
  2008. transform: none;
  2009. box-shadow: none;
  2010. }
  2011. .secondary-btn {
  2012. background: white;
  2013. color: #333;
  2014. border: 2px solid #e8e8e8;
  2015. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  2016. }
  2017. .secondary-btn:hover {
  2018. background: #fafafa;
  2019. border-color: #409EFF;
  2020. color: #409EFF;
  2021. transform: translateY(-2px);
  2022. box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  2023. }
  2024. </style>