| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397 |
- <template>
- <Dialog
- :title="'AI生成课程'"
- v-model="dialogVisible"
- width="90%"
- :fullscreen="true"
- @update:fullscreen="(value) => (fullscreen = value)"
- >
- <div class="course-script-editor">
- <!-- 全屏遮挡层 -->
- <div v-if="isGenerating" class="loading-overlay">
- <div class="loading-content">
- <div class="loading-spinner"></div>
- <div class="loading-text">生成中...</div>
- </div>
- </div>
- <div class="main-container">
- <!-- 左侧步骤指示器 -->
- <div class="steps-sidebar">
- <div class="steps-container">
- <template v-for="(step, index) in steps" :key="step.id">
- <div
- :class="[
- 'step-item',
- {
- process: currentStep === step.id,
- finish: step.id < currentStep,
- wait: step.id > currentStep
- }
- ]"
- >
- <div class="step-circle">{{ step.id }}</div>
- <div class="step-title">{{ step.label }}</div>
- </div>
- <div
- v-if="index < steps.length - 1"
- class="step-line"
- :class="{ active: currentStep > step.id }"
- ></div>
- </template>
- </div>
- </div>
- <!-- 右侧内容区域 -->
- <div class="content-area">
- <!-- 步骤1:AI一句话生成 -->
- <div v-if="currentStep === 1" class="step-content">
- <div class="ai-input-container">
- <div class="ai-input-wrapper">
- <div class="ai-icon">🤖</div>
- <textarea
- v-model="scriptPrompt"
- placeholder="AI一句话生成课程脚本,例如:生成一节关于牛顿万有引力的小学科学课脚本..."
- class="ai-textarea"
- ></textarea>
- </div>
- <div class="selection-group">
- <div class="selection-item">
- <label>主讲老师</label>
- <el-select
- v-model="selectedMainTeacher"
- filterable
- size="large"
- placeholder="请选择主讲老师"
- style="width: 300px"
- clearable
- >
- <el-option
- v-for="teacher in digitalHumans"
- :key="teacher.name"
- :label="teacher.name"
- :value="teacher.name"
- />
- </el-select>
- </div>
- <div class="selection-item">
- <label>助讲老师</label>
- <el-select
- v-model="selectedAssistants"
- filterable
- size="large"
- placeholder="请选择助讲老师"
- style="width: 300px"
- clearable
- multiple
- >
- <el-option
- v-for="teacher in digitalHumans"
- :key="teacher.name"
- :label="teacher.name"
- :value="teacher.name"
- />
- </el-select>
- </div>
- <div class="selection-item">
- <label>主题类型</label>
- <el-select
- v-model="selectedThemeType"
- size="large"
- placeholder="请选择主题类型"
- style="width: 300px"
- >
- <el-option label="课程通用" value="13" />
- <el-option label="诗词课" value="256" />
- <el-option label="诗词课(英才小学生)" value="262" />
- </el-select>
- </div>
- <div v-if="selectedThemeType === '262'" class="selection-item">
- <label>课程小节</label>
- <el-select
- v-model="selectedLessonSection"
- size="large"
- placeholder="请选择课程小节"
- style="width: 300px"
- >
- <el-option
- v-for="section in poetryLessonSections"
- :key="section.value"
- :label="section.label"
- :value="section.value"
- >
- <span>({{ section.value }}){{ section.label }}</span>
- </el-option>
- </el-select>
- </div>
- </div>
- <div class="button-group">
- <button
- class="generate-btn primary"
- :disabled="
- !scriptPrompt || !selectedMainTeacher || !selectedThemeType || isGenerating
- "
- @click="generateScript"
- >
- {{ isGenerating ? '生成中...' : '生成课程脚本' }}
- </button>
- <button
- v-if="hasDraftCache"
- class="generate-btn secondary"
- @click="loadDraftAndGotoStep2"
- >
- 查看草稿
- </button>
- </div>
- </div>
- </div>
- <!-- 步骤2:脚本编辑(含背景图/音生成) -->
- <div v-else-if="currentStep === 2" class="step-content">
- <!-- 固定顶部的一键操作栏 -->
- <div class="editor-toolbar sticky-top">
- <button
- class="toolbar-btn"
- @click="generateAllImages"
- :disabled="isGeneratingImages || isAnyImageGenerating"
- >
- {{ isGeneratingImages ? '生成中...' : '一键生成所有背景图' }}
- </button>
- <button
- class="toolbar-btn"
- @click="generateAllVideos"
- :disabled="isGeneratingVideos || isAnyVideoGenerating"
- >
- {{ isGeneratingVideos ? '生成中...' : '一键生成所有视频' }}
- </button>
- <button
- class="toolbar-btn"
- @click="generateAllVoiceovers"
- :disabled="isGeneratingVoiceovers || isAnyVoiceoverGenerating"
- >
- {{ isGeneratingVoiceovers ? '生成中...' : '一键配音' }}
- </button>
- </div>
- <!-- 可滚动的内容区域 -->
- <div class="script-editor">
- <div
- v-for="(section, sectionIndex) in scriptData.sections"
- :key="sectionIndex"
- class="script-section"
- >
- <div class="section-header">
- <div class="section-name-container">
- <label class="section-name-label">环节 {{ sectionIndex + 1 }}</label>
- <input
- v-model="section.name"
- class="section-title"
- placeholder="如:环节一(引入)"
- />
- </div>
- <button class="remove-section-btn" @click="removeSection(sectionIndex)">×</button>
- </div>
- <div class="media-controls">
- <!-- 背景类型切换 -->
- <el-radio-group v-model="section.backgroundType" class="background-type-switch">
- <el-radio-button label="imageAudio">图音背景</el-radio-button>
- <el-radio-button label="video">视频背景</el-radio-button>
- </el-radio-group>
- <!-- 图音背景 -->
- <template v-if="section.backgroundType === 'imageAudio'">
- <div class="media-item">
- <div class="media-input-group">
- <span class="media-label">背景图</span>
- <el-input
- v-model="section.backgroundImage.prompt"
- type="textarea"
- :autosize="{ minRows: 2, maxRows: 4 }"
- placeholder="描述词"
- class="media-prompt"
- />
- <el-button
- type="primary"
- size="small"
- :loading="section.backgroundImage.generating"
- :disabled="
- !section.backgroundImage.prompt || section.backgroundImage.generating
- "
- @click="generateMedia(sectionIndex)"
- class="generate-btn"
- >
- {{
- section.backgroundImage.generating
- ? '生成中...'
- : section.backgroundImage.url
- ? '重新生成'
- : '生成'
- }}
- </el-button>
- </div>
- <div class="upload-container">
- <UploadImg v-model="section.backgroundImage.url" />
- </div>
- </div>
- <div class="media-item">
- <div class="media-input-group">
- <span class="media-label">背景音</span>
- <el-select
- v-model="section.backgroundAudio.type"
- placeholder="选择背景音"
- :style="{ width: fullscreen ? '240px' : '130px' }"
- clearable
- size="large"
- @change="(value) => handleBackgroundAudioChange(value, section)"
- >
- <el-option
- v-for="musicType in backgroundMusicTypes"
- :key="musicType.id"
- :label="musicType.name"
- :value="musicType.id"
- />
- </el-select>
- <button
- v-if="section.backgroundAudio.type"
- class="play-btn small"
- @click="playBackgroundAudio(section.backgroundAudio.type)"
- >
- <span class="play-icon">{{
- audioState.isPlaying &&
- audioState.currentType === 'background' &&
- audioState.currentUrl === section.backgroundAudio.url
- ? '⏸'
- : '▶'
- }}</span>
- </button>
- </div>
- </div>
- </template>
- <!-- 视频背景 -->
- <template v-else-if="section.backgroundType === 'video'">
- <div class="media-item">
- <div class="media-input-group">
- <span class="media-label">视频提示词</span>
- <el-input
- v-model="section.backgroundVideo.prompt"
- type="textarea"
- :autosize="{ minRows: 2, maxRows: 4 }"
- placeholder="描述词"
- class="media-prompt-video"
- />
- <el-button
- type="primary"
- size="small"
- :loading="section.backgroundVideo.generating"
- :disabled="
- !section.backgroundVideo.prompt || section.backgroundVideo.generating
- "
- @click="generateVideo(sectionIndex)"
- class="generate-btn"
- >
- {{
- section.backgroundVideo.generating
- ? '生成中...'
- : section.backgroundVideo.url
- ? '重新生成'
- : '生成'
- }}
- </el-button>
- </div>
- <div class="upload-container">
- <UploadVideo2 v-model="section.backgroundVideo.url" />
- </div>
- </div>
- </template>
- </div>
- <div class="dialogues-container">
- <div
- v-for="(dialogue, dialogueIndex) in section.dialogues"
- :key="dialogueIndex"
- class="dialogue-item"
- :class="[dialogue.type, { hidden: dialogue.type === 'user' }]"
- >
- <div class="dialogue-header">
- <div class="dialogue-type-tag" :class="dialogue.type">
- {{
- dialogue.type === 'digital'
- ? '数字人'
- : dialogue.type === 'user'
- ? '用户'
- : dialogue.type === 'quest'
- ? '提问'
- : dialogue.type === 'poem'
- ? '诗词'
- : dialogue.type === 'poem_reading'
- ? '朗诵评价'
- : dialogue.type === 'write_reading'
- ? '写诗评价'
- : dialogue.type === 'recite_reading'
- ? '背诵诗词评价'
- : '视频'
- }}
- </div>
- </div>
- <div class="dialogue-row">
- <!-- 数字人对话 -->
- <template v-if="dialogue.type === 'digital'">
- <div class="dialogue-role-select">
- <el-select
- v-model="dialogue.roleName"
- placeholder="选择角色"
- style="width: 140px"
- clearable
- >
- <el-option
- v-for="role in digitalHumans"
- :key="role.id"
- :label="role.name"
- :value="role.name"
- />
- </el-select>
- </div>
- <div class="dialogue-content-container">
- <el-input
- v-model="dialogue.content"
- type="textarea"
- class="dialogue-content"
- placeholder="对话内容..."
- :autosize="{ minRows: 2, maxRows: 4 }"
- />
- </div>
- <div class="action-buttons">
- <div class="action-buttons-row">
- <button
- v-if="dialogue.voiceoverUrl"
- class="play-btn"
- @click="playVoiceover(dialogue.voiceoverUrl)"
- >
- <span class="play-icon">{{
- audioState.isPlaying &&
- audioState.currentType === 'voice' &&
- audioState.currentUrl === dialogue.voiceoverUrl
- ? '⏸'
- : '▶'
- }}</span>
- </button>
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button
- >
- </div>
- <div class="action-buttons-row">
- <button
- v-if="!dialogue.voiceoverUrl"
- class="generate-btn small"
- :disabled="
- !dialogue.content ||
- !dialogue.roleName ||
- dialogue.generatingVoiceover
- "
- @click="generateVoiceover(sectionIndex, dialogueIndex)"
- >
- <span class="voice-icon">{{
- dialogue.generatingVoiceover ? '生成中...' : '生成语音'
- }}</span>
- </button>
- <button
- v-if="dialogue.voiceoverUrl"
- class="generate-btn small"
- :disabled="
- !dialogue.content ||
- !dialogue.roleName ||
- dialogue.generatingVoiceover
- "
- @click="generateVoiceover(sectionIndex, dialogueIndex)"
- >
- <span class="voice-icon">{{
- dialogue.generatingVoiceover ? '生成中...' : '重新生成'
- }}</span>
- </button>
- </div>
- </div>
- </template>
- <!-- 用户 -->
- <template v-else-if="dialogue.type === 'user'">
- <div class="dialogue-content-container full-width">
- <el-input
- v-model="dialogue.content"
- type="textarea"
- class="dialogue-content"
- placeholder="用户回复内容参考语..."
- :autosize="{ minRows: 2, maxRows: 4 }"
- />
- </div>
- <div class="dialogue-reply-select">
- <el-select
- v-model="dialogue.roleName"
- placeholder="选择数字人回复"
- style="width: 140px"
- clearable
- >
- <el-option
- v-for="role in digitalHumans"
- :key="role.id"
- :label="role.name"
- :value="role.name"
- />
- </el-select>
- </div>
- <div class="action-buttons">
- <div class="action-buttons-row">
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button
- >
- </div>
- </div>
- </template>
- <!-- 提问 -->
- <template v-else-if="dialogue.type === 'quest'">
- <div class="dialogue-role-select">
- <el-select
- v-model="dialogue.roleName"
- placeholder="选择角色"
- style="width: 140px"
- clearable
- >
- <el-option
- v-for="role in digitalHumans"
- :key="role.id"
- :label="role.name"
- :value="role.name"
- />
- </el-select>
- </div>
- <div class="dialogue-content-container">
- <div class="question-type-select">
- <span class="question-type-label">提问类型:</span>
- <el-select
- v-model="dialogue.questionType"
- placeholder="请选择提问类型"
- style="width: 140px"
- >
- <el-option label="AI问答" value="AI Q&A" />
- <el-option label="单选题" value="singleChoice" />
- </el-select>
- </div>
- <el-input
- v-model="dialogue.content"
- type="textarea"
- class="dialogue-content"
- placeholder="提问内容..."
- :autosize="{ minRows: 2, maxRows: 4 }"
- />
- <!-- 单选题选项 -->
- <div v-if="dialogue.questionType === 'singleChoice'" class="single-choice-options">
- <div class="options-header">
- <span class="options-label">选项列表:</span>
- <button class="add-option-btn" @click="addOption(sectionIndex, dialogueIndex)">+ 添加选项</button>
- </div>
- <div
- v-for="(option, optionIndex) in (dialogue.options || [])"
- :key="optionIndex"
- class="option-item"
- >
- <span class="option-label">{{ String.fromCharCode(65 + optionIndex) }}.</span>
- <el-input
- v-model="option.content"
- placeholder="选项内容"
- style="flex: 1; margin-right: 10px;"
- />
- <div class="answer-radio-wrapper">
- <el-radio
- v-model="dialogue.answer"
- :label="String.fromCharCode(65 + optionIndex)"
- />
- <span v-if="dialogue.answer === String.fromCharCode(65 + optionIndex)" class="correct-mark">✓</span>
- </div>
- <button
- v-if="(dialogue.options || []).length > 2"
- class="remove-option-btn"
- @click="removeOption(sectionIndex, dialogueIndex, optionIndex)"
- >×</button>
- </div>
- </div>
- </div>
- <div class="action-buttons">
- <div class="action-buttons-row">
- <button
- v-if="dialogue.voiceoverUrl"
- class="play-btn"
- @click="playVoiceover(dialogue.voiceoverUrl)"
- >
- <span class="play-icon">{{
- audioState.isPlaying &&
- audioState.currentType === 'voice' &&
- audioState.currentUrl === dialogue.voiceoverUrl
- ? '⏸'
- : '▶'
- }}</span>
- </button>
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button
- >
- </div>
- <div class="action-buttons-row">
- <button
- v-if="!dialogue.voiceoverUrl"
- class="generate-btn small"
- :disabled="
- !dialogue.content ||
- !dialogue.roleName ||
- dialogue.generatingVoiceover
- "
- @click="generateVoiceover(sectionIndex, dialogueIndex)"
- >
- <span class="voice-icon">{{
- dialogue.generatingVoiceover ? '生成中...' : '生成语音'
- }}</span>
- </button>
- <button
- v-if="dialogue.voiceoverUrl"
- class="generate-btn small"
- :disabled="
- !dialogue.content ||
- !dialogue.roleName ||
- dialogue.generatingVoiceover
- "
- @click="generateVoiceover(sectionIndex, dialogueIndex)"
- >
- <span class="voice-icon">{{
- dialogue.generatingVoiceover ? '生成中...' : '重新生成'
- }}</span>
- </button>
- </div>
- </div>
- </template>
- <!-- 诗词 -->
- <template v-else-if="dialogue.type === 'poem'">
- <div class="dialogue-role-select">
- <el-select
- v-model="dialogue.roleName"
- placeholder="选择角色"
- style="width: 140px"
- clearable
- >
- <el-option
- v-for="role in digitalHumans"
- :key="role.id"
- :label="role.name"
- :value="role.name"
- />
- </el-select>
- </div>
- <div class="dialogue-content-container">
- <el-input
- v-model="dialogue.content"
- type="textarea"
- class="dialogue-content"
- placeholder="诗词内容..."
- :autosize="{ minRows: 2, maxRows: 4 }"
- />
- </div>
- <div class="action-buttons">
- <div class="action-buttons-row">
- <button
- v-if="dialogue.voiceoverUrl"
- class="play-btn"
- @click="playVoiceover(dialogue.voiceoverUrl)"
- >
- <span class="play-icon">{{
- audioState.isPlaying &&
- audioState.currentType === 'voice' &&
- audioState.currentUrl === dialogue.voiceoverUrl
- ? '⏸'
- : '▶'
- }}</span>
- </button>
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button
- >
- </div>
- <div class="action-buttons-row">
- <button
- v-if="!dialogue.voiceoverUrl"
- class="generate-btn small"
- :disabled="
- !dialogue.content ||
- !dialogue.roleName ||
- dialogue.generatingVoiceover
- "
- @click="generateVoiceover(sectionIndex, dialogueIndex)"
- >
- <span class="voice-icon">{{
- dialogue.generatingVoiceover ? '生成中...' : '生成语音'
- }}</span>
- </button>
- <button
- v-if="dialogue.voiceoverUrl"
- class="generate-btn small"
- :disabled="
- !dialogue.content ||
- !dialogue.roleName ||
- dialogue.generatingVoiceover
- "
- @click="generateVoiceover(sectionIndex, dialogueIndex)"
- >
- <span class="voice-icon">{{
- dialogue.generatingVoiceover ? '生成中...' : '重新生成'
- }}</span>
- </button>
- </div>
- </div>
- </template>
- <!-- 视频 -->
- <template v-else-if="dialogue.type === 'video'">
- <div class="media-input-group" style="display: flex; align-items: center; justify-content: center;">
- <span class="media-label" style="margin-right: 10px;">视频提示词</span>
- <el-input
- v-model="dialogue.videoPrompt"
- type="textarea"
- :autosize="{ minRows: 2, maxRows: 4 }"
- placeholder="描述词"
- class="media-prompt-video"
- style="flex: 1; margin-right: 10px;"
- />
- <el-button
- type="primary"
- size="small"
- :loading="dialogue.generatingVideo"
- :disabled="
- !dialogue.videoPrompt || dialogue.generatingVideo
- "
- @click="generateDialogueVideo(sectionIndex, dialogueIndex)"
- class="generate-btn"
- style="margin-right: 10px;"
- >
- {{
- dialogue.generatingVideo
- ? '生成中...'
- : dialogue.videoUrl
- ? '重新生成'
- : '生成'
- }}
- </el-button>
- <div class="upload-container" style="margin: 0 10px;">
- <UploadVideo2 v-model="dialogue.videoUrl" />
- </div>
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button>
- </div>
- </template>
- <!-- 朗诵评价 -->
- <template v-else-if="dialogue.type === 'poem_reading'">
- <div class="dialogue-role-select">
- <el-select
- v-model="dialogue.roleName"
- placeholder="选择角色"
- style="width: 140px"
- clearable
- >
- <el-option
- v-for="role in digitalHumans"
- :key="role.id"
- :label="role.name"
- :value="role.name"
- />
- </el-select>
- </div>
- <div class="dialogue-content-container">
- <el-input
- v-model="dialogue.content"
- type="textarea"
- class="dialogue-content"
- placeholder="朗诵评价内容..."
- :autosize="{ minRows: 2, maxRows: 4 }"
- />
- </div>
- <div class="action-buttons">
- <div class="action-buttons-row">
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button
- >
- </div>
- </div>
- </template>
- <!-- 写诗评价 -->
- <template v-else-if="dialogue.type === 'write_reading'">
- <div class="dialogue-role-select">
- <el-select
- v-model="dialogue.roleName"
- placeholder="选择角色"
- style="width: 140px"
- clearable
- >
- <el-option
- v-for="role in digitalHumans"
- :key="role.id"
- :label="role.name"
- :value="role.name"
- />
- </el-select>
- </div>
- <div class="dialogue-content-container">
- <el-input
- v-model="dialogue.content"
- type="textarea"
- class="dialogue-content"
- placeholder="写诗评价内容..."
- :autosize="{ minRows: 2, maxRows: 4 }"
- />
- </div>
- <div class="action-buttons">
- <div class="action-buttons-row">
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button
- >
- </div>
- </div>
- </template>
- <!-- 背诵诗词评价 -->
- <template v-else-if="dialogue.type === 'recite_reading'">
- <div class="dialogue-role-select">
- <el-select
- v-model="dialogue.roleName"
- placeholder="选择角色"
- style="width: 140px"
- clearable
- >
- <el-option
- v-for="role in digitalHumans"
- :key="role.id"
- :label="role.name"
- :value="role.name"
- />
- </el-select>
- </div>
- <div class="dialogue-content-container">
- <el-input
- v-model="dialogue.content"
- type="textarea"
- class="dialogue-content"
- placeholder="背诵诗词评价内容..."
- :autosize="{ minRows: 2, maxRows: 4 }"
- />
- </div>
- <div class="action-buttons">
- <div class="action-buttons-row">
- <button
- class="remove-btn"
- @click="removeDialogue(sectionIndex, dialogueIndex)"
- >×</button
- >
- </div>
- </div>
- </template>
- </div>
- </div>
- <div class="add-dialogue-buttons">
- <button class="add-dialogue-btn digital" @click="addDialogue(sectionIndex)"
- >+ 添加对话</button
- >
- <button
- class="add-dialogue-btn quest-user"
- @click="addQuestWithUserReply(sectionIndex)"
- >+ 添加提问与回复</button
- >
- <button class="add-dialogue-btn video" @click="addVideoDialogue(sectionIndex)"
- >+ 添加视频</button
- >
- <div class="more-dropdown-wrapper">
- <button
- class="add-dialogue-btn more-btn"
- @click.stop="toggleMoreMenu(sectionIndex)"
- >+ 更多 ▾</button>
- <div
- v-if="activeMoreMenu === sectionIndex"
- class="more-dropdown-menu"
- @click.stop
- >
- <button class="more-item-btn poem" @click="addPoemDialogue(sectionIndex); activeMoreMenu = null"
- >+ 添加诗词</button
- >
- <button class="more-item-btn poem_reading" @click="addPoemReadingDialogue(sectionIndex); activeMoreMenu = null"
- >+ 添加朗诵评价</button
- >
- <button class="more-item-btn write_reading" @click="addWriteReadingDialogue(sectionIndex); activeMoreMenu = null"
- >+ 添加写诗评价</button
- >
- <button class="more-item-btn recite_reading" @click="addReciteReadingDialogue(sectionIndex); activeMoreMenu = null"
- >+ 添加背诵诗词评价</button
- >
- </div>
- </div>
- </div>
- </div>
- </div>
- <button class="add-section-btn" @click="addSection">+ 添加环节</button>
- </div>
- <div class="preview-actions">
- <button v-if="currentStep > 1" class="secondary-btn" @click="currentStep--">
- 重新生成
- </button>
- <button class="primary-btn" @click="nextStep"> 预览完整脚本 </button>
- </div>
- </div>
- <!-- 步骤3:预览与保存 -->
- <div v-else-if="currentStep === 3" class="step-content">
- <div class="preview-container">
- <h3>课程脚本预览</h3>
- <div class="scrollable-content">
- <br />
- <div v-if="isValidationPassed" class="validation-result valid">
- {{ validationMessage }}
- </div>
- <div v-else>
- <div
- v-for="(error, index) in errorMessages"
- :key="index"
- class="validation-result invalid"
- >
- {{ error }}
- </div>
- </div>
- <div class="preview-content">
- <div
- v-for="(section, sectionIndex) in scriptData.sections"
- :key="sectionIndex"
- class="preview-section"
- :style="{
- backgroundImage: section.backgroundType === 'imageAudio' && section.backgroundImage.url
- ? `url(${section.backgroundImage.url})`
- : 'none',
- backgroundSize: 'cover',
- backgroundPosition: 'center',
- backgroundRepeat: 'no-repeat'
- }"
- >
- <div v-if="section.backgroundType === 'video' && section.backgroundVideo.url" class="preview-video">
- <video :src="section.backgroundVideo.url" alt="视频背景" autoplay loop muted ></video>
- </div>
- <div class="preview-section-content">
- <div class="preview-media">
- <div class="preview-media-left">
- <label class="section-name-label">环节 {{ sectionIndex + 1 }}</label>
- <strong>{{ section.name }}</strong>
- </div>
- <div class="preview-media-right">
- <span v-if="section.backgroundType === 'imageAudio' && section.backgroundAudio.type" class="preview-audio">
- 背景音:{{ section.backgroundAudio.type }}
- <button
- class="play-btn small"
- @click="playBackgroundAudio(section.backgroundAudio.type)"
- >
- <span class="play-icon">{{
- audioState.isPlaying &&
- audioState.currentType === 'background' &&
- audioState.currentUrl === section.backgroundAudio.url
- ? '⏸'
- : '▶'
- }}</span>
- </button>
- </span>
- </div>
- </div>
- <div class="preview-dialogues">
- <div
- v-for="(dialogue, dialogueIndex) in section.dialogues.filter(
- (d) => d.type !== 'user'
- )"
- :key="dialogueIndex"
- class="preview-dialogue"
- :class="dialogue.type"
- >
- <div class="dialogue-header">
- <div class="dialogue-header-left">
- <div class="dialogue-type-tag" :class="dialogue.type">
- {{
- dialogue.type === 'digital'
- ? '数字人'
- : dialogue.type === 'user'
- ? '用户'
- : dialogue.type === 'quest'
- ? '提问'
- : dialogue.type === 'poem'
- ? '诗词'
- : dialogue.type === 'poem_reading'
- ? '朗诵评价'
- : dialogue.type === 'write_reading'
- ? '写诗评价'
- : dialogue.type === 'recite_reading'
- ? '背诵诗词评价'
- : '视频'
- }}
- </div>
- <div class="dialogue-role">
- {{
- dialogue.type !== 'user' && dialogue.type !== 'video'
- ? getRoleName(dialogue.roleName)
- : dialogue.type === 'video' ? '视频' : '用户'
- }}:
- </div>
- </div>
- <button
- v-if="dialogue.voiceoverUrl"
- class="play-btn small"
- @click="playVoiceover(dialogue.voiceoverUrl)"
- >
- <span class="play-icon">{{
- audioState.isPlaying &&
- audioState.currentType === 'voice' &&
- audioState.currentUrl === dialogue.voiceoverUrl
- ? '⏸'
- : '▶'
- }}</span>
- </button>
- </div>
- <template v-if="dialogue.type === 'video'">
- <div class="dialogue-text">{{ dialogue.videoPrompt }}</div>
- <div v-if="dialogue.videoUrl" class="media-preview">
- <video :src="dialogue.videoUrl" alt="视频预览" controls></video>
- </div>
- </template>
- <template v-else>
- <div class="dialogue-text" v-html="parseMarkdown(dialogue.content)"></div>
- </template>
- <div
- v-if="dialogue.type === 'user' && dialogue.roleName"
- class="reply-info"
- >
- 回复角色:{{ getRoleName(dialogue.roleName) }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="preview-actions">
- <button class="secondary-btn" @click="currentStep = 2">返回修改</button>
- <!-- <button
- class="primary-btn"
- :disabled="!isValidationPassed"
- @click="showVideoPreview"
- >
- 预览视频
- </button>-->
- <button class="primary-btn" :disabled="!isValidationPassed" @click="saveScript">
- 保存课程脚本
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 视频预览模态框 -->
- <VideoPreview
- :visible="showVideoPreviewModal"
- :script-data="scriptData"
- :script-roles="digitalHumans"
- @close="closeVideoPreview"
- />
- </div>
- </Dialog>
- </template>
- <script setup>
- import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
- import { Dialog } from '@/components/Dialog'
- import { ElMessage } from 'element-plus'
- import UploadImg from '@/components/UploadFile/src/UploadImg.vue'
- import UploadVideo2 from '@/components/UploadFile/src/UploadVideo2.vue'
- import { ChatMessageApi } from '@/api/ai/chat/message'
- import { ChatConversationApi } from '@/api/ai/chat/conversation'
- import { ChatRoleApi } from '@/api/ai/model/chatRole'
- import { ImageApi } from '@/api/ai/image'
- import { TtsApi } from '@/api/ai/tts'
- import { VideoApi} from '@/api/ai/video'
- import VideoPreview from '@/views/bjdx/course/aiGenerate/VideoPreview.vue'
- import { AiImageStatusEnum, AiPlatformEnum, AiVideoStatusEnum } from '@/views/ai/utils/constants'
- import { marked } from 'marked'
- import { useUserStore } from '@/store/modules/user'
- // 步骤配置
- const steps = [
- { id: 1, label: 'AI生成脚本' },
- { id: 2, label: '编辑脚本与媒体' },
- { id: 3, label: '预览与保存' }
- ]
- // 当前步骤
- const currentStep = ref(1)
- // 步骤1数据
- const scriptPrompt = ref('')
- const selectedMainTeacher = ref('')
- const selectedAssistants = ref([])
- const selectedThemeType = ref()
- const isGenerating = ref(false)
- // 对话框可见性
- const props = defineProps({
- visible: {
- type: Boolean,
- default: false
- },
- initialStep: {
- type: Number,
- default: 1
- },
- initialScriptData: {
- type: String,
- default: ''
- }
- })
- const dialogVisible = computed({
- get: () => props.visible,
- set: (value) => emit('update:visible', value)
- })
- // 获取用户信息
- const userStore = useUserStore()
- const userId = computed(() => userStore.getUser.id)
- // 检查是否存在草稿缓存
- const hasDraftCache = ref(false)
- // 步骤2生成状态
- const isGeneratingImages = ref(false)
- const isGeneratingVoiceovers = ref(false)
- const isGeneratingVideos = ref(false)
- // 数字人列表
- const digitalHumans = ref([])
- // 背景音类型
- const backgroundMusicTypes = ref([
- {
- id: '轻松欢快',
- name: '轻松欢快',
- url: 'https://learn-ai.com.cn/admin-api/infra/file/29/get/20260310/AI_1773106630966.MP3'
- }
- ])
- // 诗词课(英才小学生)课程小节选项
- const poetryLessonSections = ref([
- {
- value: '1',
- label: '读·共读辨情,初识诗境',
- constraint: ['digital', 'poem_reading', 'poem'],
- description: '引导学生朗读诗词,通过共读辨情,本节课只需要带着学生一起朗读,不需要其他对话类型。(对话类型参考:digital对话引导,poem诗句,poem_reading学生朗读,digital对话引导...)'
- },
- {
- value: '2',
- label: '悟·深究共情,解码精神',
- constraint: ['digital', 'video', 'quest', 'user'],
- description: '保证第一个环节的第一个对话类型是(video)AIGC视频类型,填充视频生成提示词(根据诗词情感生成提示词),' +
- '后续再以作者和学生对话的方式进行沉浸式课堂教学,先逐句拆解每一首诗的含义,讲解重点字词。' +
- '然后展开讲解诗人的生平背景,' +
- '最后讲解整句诗的思想,中间穿插互动提问(问题方向为:抓住诗词特色画面,理解环境描写如何烘托人物心境,情感这几点来提问)'
- },
- {
- value: '3',
- label: '用·印证文脉,联结现实',
- constraint: ['digital', 'poem', 'recite_reading'],
- description: '本节小课是先跟着诗词跟读,都读完后给出引导进行背诵,注意:逐句背诵,每一句诗词引导背诵和用户背诵都要单独一个环节,方便环节背景图应景(背景图上不要出现诗词语句)' +
- '注意对话流程:digital对话引导跟读,poem诗句,digital对话背诵引导(不要出现诗词语句),recite_reading学生背诵...'
- },
- {
- value: '4',
- label: '创·汲智明志,创意表达',
- constraint: ['digital', 'quest', 'user', 'write_reading'],
- description: '将诗词内容,结合新的时代进行思考,给同学们进行提问,引出创作动机,并引导学生根据其中经典诗句进行仿写,可以先给出例子,然后引导学生进行仿写。' +
- '注意每条仿写对话前面都要有引导对话和示例,引导学生根据示例进行仿写。' +
- '仿写结束后以作者和学生对话的方式进行沉浸式课堂教学,中间穿插互动提问'
- },
- {
- value: '5',
- label: '评价',
- constraint: ['digital', 'poem', 'poem_reading', 'write_reading'],
- description: '本节课需要先进行诗词朗读,引导学生根据诗词内容进行评价(注意对话流程:digital对话引导,poem诗句,poem_reading学生朗读...)' +
- '然后引导学生仿写诗词进行评价。(后续对话流程:digital对话引导先给出示例,write_reading学生仿写)'
- }
- ])
- // 当前选中的课程小节
- const selectedLessonSection = ref('')
- // 从localStorage加载脚本数据
- const loadScriptDataFromCache = () => {
- try {
- const key = `courseScriptData_${userId.value}`
- const cachedData = localStorage.getItem(key)
- if (cachedData) {
- try {
- return JSON.parse(cachedData)
- } catch (error) {
- console.error('解析缓存数据失败:', error)
- }
- }
- } catch (error) {
- console.error('获取用户信息失败:', error)
- }
- return null
- }
- // 是否为编辑模式
- const isEditMode = ref(false)
- // 脚本数据结构
- const scriptData = reactive(
- loadScriptDataFromCache() || {
- title: '',
- sections: [
- {
- name: '环节一',
- backgroundType: 'imageAudio', // imageAudio: 图音背景, video: 视频背景
- backgroundImage: {
- prompt: '',
- url: '',
- generating: false
- },
- backgroundAudio: {
- type: '',
- url: ''
- },
- backgroundVideo: {
- prompt: '',
- url: '',
- generating: false
- },
- dialogues: [
- {
- type: 'digital',
- roleName: '',
- content: '',
- voiceoverUrl: '',
- generatingVoiceover: false
- },
- {
- type: 'user',
- roleName: '',
- content: ''
- }
- ]
- }
- ]
- }
- )
- // 兼容旧数据,为旧数据添加背景类型字段和提问类型字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为旧数据的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- // 保存脚本数据到localStorage
- const saveScriptDataToCache = () => {
- try {
- const key = `courseScriptData_${userId.value}`
- localStorage.setItem(key, JSON.stringify(scriptData))
- hasDraftCache.value = true
- console.log('保存脚本数据到缓存', key)
- } catch (error) {
- console.error('保存缓存数据失败:', error)
- }
- }
- // 清空脚本数据缓存
- const clearScriptDataCache = () => {
- const key = `courseScriptData_${userId.value}`
- localStorage.removeItem(key)
- hasDraftCache.value = false
- console.log('清除脚本数据缓存', key)
- }
- // 加载草稿并跳转到步骤2
- const loadDraftAndGotoStep2 = () => {
- const cachedData = loadScriptDataFromCache()
- if (cachedData) {
- Object.assign(scriptData, cachedData)
- // 为加载的草稿数据添加背景类型和视频背景字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为旧数据的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- currentStep.value = 2
- }
- }
- // 监听脚本数据变化,自动保存到缓存
- watch(
- () => scriptData,
- () => {
- saveScriptDataToCache()
- },
- { deep: true }
- )
- // 监听对话框可见性变化
- watch(
- () => props.visible,
- (newVisible, oldVisible) => {
- if (newVisible) {
- // 对话框打开时,设置初始步骤
- currentStep.value = props.initialStep
- // 清空被替换的URL集合
- replacedUrls.value.clear()
- // 处理脚本数据
- if (props.initialScriptData) {
- // 标记为编辑模式
- isEditMode.value = true
- try {
- const parsedData = JSON.parse(props.initialScriptData)
- Object.assign(scriptData, parsedData)
- // 为加载的脚本数据添加背景类型和视频背景字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为旧数据的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- } catch (error) {
- console.error('解析脚本数据失败:', error)
- // 解析失败,尝试加载草稿
- const cachedData = loadScriptDataFromCache()
- if (cachedData) {
- Object.assign(scriptData, cachedData)
- // 为加载的草稿数据添加背景类型和视频背景字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为旧数据的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- }
- }
- } else {
- // 标记为新建模式
- isEditMode.value = false
- // 没有脚本数据,尝试加载草稿
- const cachedData = loadScriptDataFromCache()
- if (cachedData) {
- Object.assign(scriptData, cachedData)
- // 为加载的草稿数据添加背景类型和视频背景字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为旧数据的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- }
- }
- } else if (oldVisible) {
- // 对话框关闭时
- if (props.initialScriptData) {
- // 编辑进来的,清空缓存
- clearScriptDataCache()
- }
- // 重置编辑模式标记
- isEditMode.value = false
- // 新增进来的,保留缓存
- }
- }
- )
- // 音频播放状态
- const audioState = reactive({
- currentAudio: null,
- isPlaying: false,
- currentType: '',
- currentUrl: ''
- })
- // 存储所有音频实例
- const audioInstances = new Map()
- // 计算属性:判断是否可以进入下一步
- const canProceed = computed(() => {
- switch (currentStep.value) {
- case 1:
- return !!scriptPrompt.value && !!selectedMainTeacher.value && !!selectedThemeType.value
- case 2:
- case 3:
- return scriptData.sections.every(
- (section) =>
- section.backgroundImage.url &&
- section.dialogues.every(
- (dialogue) =>
- (dialogue.type === 'digital' ||
- dialogue.type === 'quest' ||
- dialogue.type === 'poem' ||
- dialogue.type === 'poem_reading' ||
- dialogue.type === 'write_reading' ||
- dialogue.type === 'recite_reading') &&
- dialogue.roleName &&
- dialogue.content.trim() &&
- (dialogue.type === 'poem_reading' ||
- dialogue.type === 'write_reading' ||
- dialogue.type === 'recite_reading' ||
- dialogue.voiceoverUrl)
- )
- )
- default:
- return false
- }
- })
- // 计算属性:检查是否有任何背景图正在生成
- const isAnyImageGenerating = computed(() => {
- return scriptData.sections.some((section) => section.backgroundImage.generating)
- })
- // 计算属性:检查是否有任何配音正在生成
- const isAnyVoiceoverGenerating = computed(() => {
- return scriptData.sections.some((section) =>
- section.dialogues.some((dialogue) => dialogue.generatingVoiceover)
- )
- })
- // 计算属性:检查是否有任何视频正在生成
- const isAnyVideoGenerating = computed(() => {
- return scriptData.sections.some((section) => {
- // 检查背景视频是否正在生成
- if (section.backgroundVideo.generating) {
- return true
- }
- // 检查对话视频是否正在生成
- return section.dialogues.some((dialogue) => dialogue.generatingVideo)
- })
- })
- // 校验结果
- const isValidationPassed = ref(false)
- const validationMessage = ref('')
- const errorMessages = ref([])
- // 视频预览状态
- const showVideoPreviewModal = ref(false)
- // 全屏状态
- const fullscreen = ref(false)
- // 存储被替换的URL链接集合
- const replacedUrls = ref(new Set())
- const activeConversationId = ref(null) // 选中的对话编号
- const conversationInAbortController = ref() // 对话进行中 abort 控制器(控制 stream 对话)
- const conversationInProgress = ref(false) // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true,避免切换对话、删除对话等操作
- const enableContext = ref(false) // 是否开启上下文
- // 接收 Stream 消息
- const receiveMessageFullText = ref('')
- const scriptDataTemp = ref(null)
- // 步骤1:生成脚本
- const generateScript = async () => {
- isGenerating.value = true
- try {
- clearScriptDataCache()
- scriptData.title = ''
- scriptData.sections = []
- receiveMessageFullText.value = ''
- scriptDataTemp.value = null
- const role = digitalHumans.value.find((r) => r.name === selectedMainTeacher.value)
- let content =
- scriptPrompt.value +
- '(主讲人:' +
- role.name +
- ',主讲人角色定位:' +
- role.description +
- ';助讲有:'
- let zhujiang = []
- selectedAssistants.value.forEach((rName) => {
- const role = digitalHumans.value.find((r) => r.name === rName)
- zhujiang.push(role.name + '[' + role.description + ']')
- })
- content += zhujiang.join(',') + ')'
- // 如果选择了诗词课(英才小学生)并且选中了课程小节,将其信息追加到内容中
- if (selectedThemeType.value === '262' && selectedLessonSection.value) {
- const lessonSection = poetryLessonSections.value.find(
- (s) => s.value === selectedLessonSection.value
- )
- if (lessonSection) {
- content +=
- '【课程小节:' +
- lessonSection.label +
- ';本节课只能出现下面的对话类型:' +
- lessonSection.constraint.join(',') +
- '禁止出现对话类型之外的对话类型;小节描述:' +
- lessonSection.description +
- '】'
- }
- }
- await createAiRoleIdConversation(Number(selectedThemeType.value))
- currentStep.value = 2
- await doSendMessageStream(activeConversationId.value, content)
- } catch (error) {
- console.error('生成脚本失败:', error)
- } finally {
- isGenerating.value = false
- }
- }
- /** 选择 card 角色:新建聊天对话 */
- const createAiRoleIdConversation = async (roleId) => {
- activeConversationId.value = await ChatConversationApi.createChatConversationMy({
- roleId: roleId
- })
- }
- /** 真正执行【发送】消息操作 */
- const doSendMessageStream = async (conversationId, content) => {
- conversationInAbortController.value = new AbortController()
- conversationInProgress.value = true
- scriptPrompt.value = ''
- try {
- let isFirstChunk = true
- await ChatMessageApi.sendChatMessageStream(
- conversationId,
- content,
- conversationInAbortController.value,
- enableContext.value,
- async (res) => {
- const { code, data, msg } = JSON.parse(res.data)
- if (code !== 0) {
- console.error(`对话异常! ${msg}`)
- return
- }
- if (data.eventType === 'TEXT') {
- if (data.receive?.content === '') {
- return
- }
- if (isFirstChunk) {
- isFirstChunk = false
- }
- receiveMessageFullText.value += data.receive.content
- console.log('数据加载中..')
- try {
- const parsedData = JSON.parse(receiveMessageFullText.value)
- scriptDataTemp.value = parsedData
- Object.assign(scriptData, parsedData)
- // 为新生成的脚本数据添加背景类型和视频背景字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为新生成的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- } catch (e) {
- // 解析失败,说明数据还不完整,继续等待
- }
- }
- },
- (error) => {
- console.error(`对话异常! ${error}`)
- throw error
- },
- () => {
- try {
- if (receiveMessageFullText.value) {
- console.log('最终数据:', receiveMessageFullText.value)
- const parsedData = JSON.parse(receiveMessageFullText.value)
- console.log('最终数据json:', parsedData)
- scriptDataTemp.value = parsedData
- Object.assign(scriptData, parsedData)
- // 为新生成的脚本数据添加背景类型和视频背景字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为新生成的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- }
- } catch (e) {
- console.error('最终数据解析失败:', e)
- // 清洗规则:移除```json、```、** 等非JSON标记,只保留中间的JSON内容
- try {
- let cleanJsonStr = receiveMessageFullText.value
- const parsedData = JSON.parse(
- cleanJsonStr
- .replace(/^```json\s*/, '')
- .replace(/\s*```$/, '')
- .replace(/\*\*/g, '')
- .trim()
- )
- console.log('最终清洗后数据json:', parsedData)
- scriptDataTemp.value = parsedData
- Object.assign(scriptData, parsedData)
- // 为新生成的脚本数据添加背景类型和视频背景字段
- if (scriptData.sections) {
- scriptData.sections.forEach(section => {
- if (!section.backgroundType) {
- section.backgroundType = 'imageAudio';
- }
- if (!section.backgroundVideo) {
- section.backgroundVideo = {
- prompt: '',
- url: '',
- generating: false
- };
- }
- // 为新生成的提问类型对话添加默认的questionType
- if (section.dialogues) {
- section.dialogues.forEach(dialogue => {
- if (dialogue.type === 'quest' && !dialogue.questionType) {
- dialogue.questionType = 'AI Q&A';
- dialogue.options = [{ content: '' }, { content: '' }];
- dialogue.answer = '';
- }
- });
- }
- });
- }
- } catch (cleanError) {
- console.error('清洗后数据解析失败:', cleanError)
- }
- }
- }
- )
- } catch (error) {
- console.error('发送消息流失败:', error)
- } finally {
- conversationInProgress.value = false
- }
- }
- // 步骤2:添加环节
- const addSection = () => {
- scriptData.sections.push({
- name: `环节${scriptData.sections.length + 1}`,
- backgroundType: 'imageAudio', // imageAudio: 图音背景, video: 视频背景
- backgroundImage: { prompt: '', url: '', generating: false },
- backgroundAudio: { type: '', url: '' },
- backgroundVideo: { prompt: '', url: '', generating: false },
- dialogues: []
- })
- }
- // 步骤2:添加对话(数字人)
- const addDialogue = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'digital',
- roleName: '',
- content: '',
- voiceoverUrl: '',
- generatingVoiceover: false
- })
- }
- // 步骤2:添加视频对话
- const addVideoDialogue = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'video',
- videoUrl: '',
- videoPrompt: '',
- generatingVideo: false
- })
- }
- // 步骤2:添加用户回复
- const addUserReply = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'user',
- content: '',
- roleName: '',
- voiceoverUrl: '',
- generatingVoiceover: false
- })
- }
- // 步骤2:添加提问
- const addQuestDialogue = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'quest',
- content: '',
- roleName: '',
- voiceoverUrl: '',
- generatingVoiceover: false,
- questionType: 'AI Q&A',
- options: [{ content: '' }, { content: '' }],
- answer: ''
- })
- }
- // 步骤2:添加诗词
- const addPoemDialogue = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'poem',
- content: '',
- roleName: '',
- voiceoverUrl: '',
- generatingVoiceover: false
- })
- }
- // 步骤2:添加朗诵评价
- const addPoemReadingDialogue = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'poem_reading',
- content: '',
- roleName: '',
- })
- }
- // 步骤2:添加写诗评价
- const addWriteReadingDialogue = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'write_reading',
- content: '',
- roleName: '',
- })
- }
- // 步骤2:添加背诵诗词评价
- const addReciteReadingDialogue = (sectionIndex) => {
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'recite_reading',
- content: '',
- roleName: '',
- })
- }
- // 步骤2:切换更多按钮菜单
- const activeMoreMenu = ref(null)
- const toggleMoreMenu = (sectionIndex) => {
- activeMoreMenu.value = activeMoreMenu.value === sectionIndex ? null : sectionIndex
- }
- // 点击其他区域关闭更多菜单
- const closeMoreMenu = () => {
- activeMoreMenu.value = null
- }
- // 步骤2:添加提问与用户回复
- const addQuestWithUserReply = (sectionIndex) => {
- // 添加提问类型对话
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'quest',
- content: '',
- roleName: '',
- voiceoverUrl: '',
- generatingVoiceover: false,
- questionType: 'AI Q&A',
- options: [{ content: '' }, { content: '' }],
- answer: ''
- })
- // 添加用户回复类型对话
- scriptData.sections[sectionIndex].dialogues.push({
- type: 'user',
- content: '',
- roleName: '',
- voiceoverUrl: '',
- generatingVoiceover: false
- })
- }
- // 步骤2:添加单选题选项
- const addOption = (sectionIndex, dialogueIndex) => {
- const dialogue = scriptData.sections[sectionIndex].dialogues[dialogueIndex]
- if (!dialogue.options) {
- dialogue.options = []
- }
- if (dialogue.options.length < 6) {
- dialogue.options.push({ content: '' })
- }
- }
- // 步骤2:删除单选题选项
- const removeOption = (sectionIndex, dialogueIndex, optionIndex) => {
- const dialogue = scriptData.sections[sectionIndex].dialogues[dialogueIndex]
- if (dialogue.options && dialogue.options.length > 2) {
- dialogue.options.splice(optionIndex, 1)
- // 如果删除的是当前选中的答案,需要重新设置答案
- if (dialogue.answer && dialogue.answer.charCodeAt(0) - 65 >= dialogue.options.length) {
- dialogue.answer = ''
- }
- }
- }
- // 步骤2:删除对话
- const removeDialogue = (sectionIndex, dialogueIndex) => {
- const dialogues = scriptData.sections[sectionIndex].dialogues
- const dialogue = dialogues[dialogueIndex]
- // 如果是提问类型,同时删除后面的用户回复
- if (
- dialogue.type === 'quest' &&
- dialogueIndex < dialogues.length - 1 &&
- dialogues[dialogueIndex + 1].type === 'user'
- ) {
- dialogues.splice(dialogueIndex, 2)
- } else {
- dialogues.splice(dialogueIndex, 1)
- }
- }
- // 步骤2:删除环节
- const removeSection = (sectionIndex) => {
- if (scriptData.sections.length > 1) {
- scriptData.sections.splice(sectionIndex, 1)
- } else {
- alert('至少需要保留一个环节')
- }
- }
- // 图片生成相关状态
- const inProgressImageMap = ref({}) // 监听的图片映射,key 为 image 编号,value 为 { sectionIndex, type: 'image'|'audio' }
- const inProgressTimer = ref(null) // 生成中的图片定时器,轮询生成进展
- // 视频生成相关状态
- const inProgressVideoMap = ref({}) // 监听的视频映射,key 为 video 编号,value 为 { sectionIndex, dialogueIndex, type: 'background'|'dialogue' }
- const inProgressVideoTimer = ref(null) // 生成中的视频定时器,轮询生成进展
- // 步骤2:生成单个媒体(仅背景图)
- const generateMedia = async (sectionIndex) => {
- const section = scriptData.sections[sectionIndex]
- const media = section.backgroundImage
- // 记录旧的URL
- let oldUrl = null
- if (media.url) {
- oldUrl = media.url
- replacedUrls.value.add(oldUrl)
- }
- media.generating = true
- try {
- const form = {
- platform: AiPlatformEnum.DOU_BAO,
- modelId: 56,
- prompt: media.prompt,
- width: 1024,
- height: 768
- }
- const response = await ImageApi.drawImage(form)
- inProgressImageMap.value[response] = {
- sectionIndex
- }
- } catch (error) {
- console.error(`生成图片失败:`, error)
- media.generating = false
- // 生成失败,从replacedUrls中移除旧URL
- if (oldUrl) {
- replacedUrls.value.delete(oldUrl)
- }
- }
- }
- // 步骤2:生成视频背景
- const generateVideo = async (sectionIndex) => {
- const section = scriptData.sections[sectionIndex]
- const media = section.backgroundVideo
- // 记录旧的URL
- let oldUrl = null
- if (media.url) {
- oldUrl = media.url
- replacedUrls.value.add(oldUrl)
- }
- media.generating = true
- try {
- const form = {
- platform: AiPlatformEnum.DOU_BAO,
- modelId: 60,
- prompt: media.prompt,
- width: 1024,
- height: 768,
- resolution: '1080P',
- duration: 4,
- options: {}
- }
- const response = await VideoApi.drawVideo(form)
- inProgressVideoMap.value[response] = {
- sectionIndex,
- type: 'background'
- }
- } catch (error) {
- console.error(`生成视频失败:`, error)
- media.generating = false
- // 生成失败,从replacedUrls中移除旧URL
- if (oldUrl) {
- replacedUrls.value.delete(oldUrl)
- }
- }
- }
- // 步骤2:生成对话视频
- const generateDialogueVideo = async (sectionIndex, dialogueIndex) => {
- const dialogue = scriptData.sections[sectionIndex].dialogues[dialogueIndex]
- // 记录旧的URL
- let oldUrl = null
- if (dialogue.videoUrl) {
- oldUrl = dialogue.videoUrl
- replacedUrls.value.add(oldUrl)
- }
- dialogue.generatingVideo = true
- try {
- const form = {
- platform: AiPlatformEnum.DOU_BAO,
- modelId: 64,
- prompt: dialogue.videoPrompt,
- width: 1024,
- height: 768,
- resolution: '1080P',
- duration: 4,
- options: {}
- }
- const response = await VideoApi.drawVideo(form)
- inProgressVideoMap.value[response] = {
- sectionIndex,
- dialogueIndex,
- type: 'dialogue'
- }
- } catch (error) {
- console.error(`生成对话视频失败:`, error)
- dialogue.generatingVideo = false
- // 生成失败,从replacedUrls中移除旧URL
- if (oldUrl) {
- replacedUrls.value.delete(oldUrl)
- }
- }
- }
- // 步骤2:一键生成所有背景图
- const generateAllImages = async () => {
- isGeneratingImages.value = true
- try {
- for (let i = 0; i < scriptData.sections.length; i++) {
- const section = scriptData.sections[i]
- // 只处理没有背景图URL的环节
- if (!section.backgroundImage.url) {
- await generateMedia(i)
- }
- }
- // 检查是否有图片正在生成
- const checkImagesComplete = setInterval(() => {
- if (Object.keys(inProgressImageMap.value).length === 0) {
- isGeneratingImages.value = false
- clearInterval(checkImagesComplete)
- }
- }, 1000)
- } catch (error) {
- console.error('生成所有背景图失败:', error)
- isGeneratingImages.value = false
- }
- }
- // 步骤2:一键生成所有视频
- const generateAllVideos = async () => {
- isGeneratingVideos.value = true
- try {
- for (let i = 0; i < scriptData.sections.length; i++) {
- const section = scriptData.sections[i]
- // 处理视频背景
- if (section.backgroundType === 'video' && !section.backgroundVideo.url) {
- await generateVideo(i)
- }
- // 处理对话视频
- for (let j = 0; j < section.dialogues.length; j++) {
- const dialogue = section.dialogues[j]
- if (dialogue.type === 'video' && !dialogue.videoUrl) {
- await generateDialogueVideo(i, j)
- }
- }
- }
- // 检查是否有视频正在生成
- const checkVideosComplete = setInterval(() => {
- if (Object.keys(inProgressVideoMap.value).length === 0) {
- isGeneratingVideos.value = false
- clearInterval(checkVideosComplete)
- }
- }, 1000)
- } catch (error) {
- console.error('生成所有视频失败:', error)
- isGeneratingVideos.value = false
- }
- }
- // 轮询生成中的图片列表
- const refreshWatchImages = async () => {
- const imageIds = Object.keys(inProgressImageMap.value).map(Number)
- if (imageIds.length === 0) {
- return
- }
- try {
- const list = await ImageApi.getImageListMyByIds(imageIds)
- const newWatchImages = {}
- list.forEach((image) => {
- const info = inProgressImageMap.value[image.id]
- if (info) {
- if (image.status === AiImageStatusEnum.IN_PROGRESS) {
- newWatchImages[image.id] = info
- } else if (image.status === AiImageStatusEnum.SUCCESS && image.picUrl) {
- const section = scriptData.sections[info.sectionIndex]
- section.backgroundImage.url = image.picUrl
- section.backgroundImage.generating = false
- } else if (image.status === AiImageStatusEnum.FAIL) {
- const section = scriptData.sections[info.sectionIndex]
- section.backgroundImage.generating = false
- // 生成失败,从replacedUrls中移除旧URL
- if (section.backgroundImage.url) {
- replacedUrls.value.delete(section.backgroundImage.url)
- }
- }
- }
- })
- inProgressImageMap.value = newWatchImages
- } catch (error) {
- console.error('轮询图片状态失败:', error)
- }
- }
- // 轮询生成中的视频列表
- const refreshWatchVideos = async () => {
- const videoIds = Object.keys(inProgressVideoMap.value).map(Number)
- if (videoIds.length === 0) {
- return
- }
- try {
- const list = await VideoApi.getVideoListMyByIds(videoIds)
- const newWatchVideos = {}
- list.forEach((video) => {
- const info = inProgressVideoMap.value[video.id]
- if (info) {
- if (video.status === AiVideoStatusEnum.IN_PROGRESS) {
- newWatchVideos[video.id] = info
- } else if (video.status === AiVideoStatusEnum.SUCCESS && video.videoUrl) {
- if (info.type === 'background') {
- const section = scriptData.sections[info.sectionIndex]
- section.backgroundVideo.url = video.videoUrl
- section.backgroundVideo.generating = false
- } else if (info.type === 'dialogue') {
- const dialogue = scriptData.sections[info.sectionIndex].dialogues[info.dialogueIndex]
- dialogue.videoUrl = video.videoUrl
- dialogue.generatingVideo = false
- }
- } else if (video.status === AiVideoStatusEnum.FAIL) {
- if (info.type === 'background') {
- const section = scriptData.sections[info.sectionIndex]
- section.backgroundVideo.generating = false
- // 生成失败,从replacedUrls中移除旧URL
- if (section.backgroundVideo.url) {
- replacedUrls.value.delete(section.backgroundVideo.url)
- }
- } else if (info.type === 'dialogue') {
- const dialogue = scriptData.sections[info.sectionIndex].dialogues[info.dialogueIndex]
- dialogue.generatingVideo = false
- // 生成失败,从replacedUrls中移除旧URL
- if (dialogue.videoUrl) {
- replacedUrls.value.delete(dialogue.videoUrl)
- }
- }
- }
- }
- })
- inProgressVideoMap.value = newWatchVideos
- } catch (error) {
- console.error('轮询视频状态失败:', error)
- }
- }
- // 播放音频通用函数
- const playAudio = (url, type) => {
- if (audioState.currentAudio) {
- audioState.currentAudio.pause()
- audioState.currentAudio.currentTime = 0
- }
- if (audioState.isPlaying && audioState.currentUrl === url && audioState.currentType === type) {
- if (audioState.currentAudio) {
- audioState.currentAudio.pause()
- }
- audioState.isPlaying = false
- return
- }
- let audio = audioInstances.get(`${type}_${url}`)
- if (!audio) {
- audio = new Audio(url)
- audio.autoplay = false
- audioInstances.set(`${type}_${url}`, audio)
- audio.onended = () => {
- audioState.isPlaying = false
- audioState.currentAudio = null
- audioState.currentUrl = ''
- audioState.currentType = ''
- }
- }
- audio.play().catch((error) => {
- console.error('播放失败:', error)
- audioState.isPlaying = false
- })
- audioState.currentAudio = audio
- audioState.isPlaying = true
- audioState.currentUrl = url
- audioState.currentType = type
- }
- // 播放语音
- const playVoiceover = (voiceoverUrl) => {
- playAudio(voiceoverUrl, 'voice')
- }
- // 处理背景音选择变化
- const handleBackgroundAudioChange = (value, section) => {
- if (value) {
- const selectedMusic = backgroundMusicTypes.value.find((music) => music.id === value)
- if (selectedMusic) {
- section.backgroundAudio.url = selectedMusic.url
- }
- } else {
- section.backgroundAudio.url = ''
- }
- }
- // 播放背景音
- const playBackgroundAudio = (musicType) => {
- const selectedMusic = backgroundMusicTypes.value.find((music) => music.id === musicType)
- const audioUrl = selectedMusic ? selectedMusic.url : `https://example.com/${musicType}.mp3`
- playAudio(audioUrl, 'background')
- }
- // 生成单个语音
- const generateVoiceover = async (sectionIndex, dialogueIndex) => {
- const dialogue = scriptData.sections[sectionIndex].dialogues[dialogueIndex]
- // 只处理数字人、提问和诗词类型的对话
- if (dialogue.type !== 'digital' && dialogue.type !== 'quest' && dialogue.type !== 'poem') {
- return
- }
- // 记录旧的URL
- let oldUrl = null
- if (dialogue.voiceoverUrl) {
- oldUrl = dialogue.voiceoverUrl
- replacedUrls.value.add(oldUrl)
- }
- dialogue.generatingVoiceover = true
- let role = digitalHumans.value.find((r) => r.name === dialogue.roleName)
- try {
- // 根据对话类型设置不同的command
- const command =
- dialogue.type === 'poem' ? '要有感情的朗读诗词语句,要符合诗词的节奏和韵律。' : null
- // 调用后端API将文本转成语音
- // 将返回的URL赋值给对话
- dialogue.voiceoverUrl = await TtsApi.convert({
- roleId: Number(role.id),
- content: dialogue.content,
- command: command
- })
- } catch (error) {
- console.error('生成语音失败:', error)
- // 生成失败,从replacedUrls中移除旧URL
- if (oldUrl) {
- replacedUrls.value.delete(oldUrl)
- }
- } finally {
- dialogue.generatingVoiceover = false
- }
- }
- // 步骤3:一键生成所有语音
- const generateAllVoiceovers = async () => {
- isGeneratingVoiceovers.value = true
- try {
- for (let i = 0; i < scriptData.sections.length; i++) {
- for (let j = 0; j < scriptData.sections[i].dialogues.length; j++) {
- const dialogue = scriptData.sections[i].dialogues[j]
- // 只处理没有语音URL的对话
- if (!dialogue.voiceoverUrl) {
- await generateVoiceover(i, j)
- }
- }
- }
- } catch (error) {
- console.error('生成所有语音失败:', error)
- } finally {
- isGeneratingVoiceovers.value = false
- }
- }
- // 获取角色名称
- const getRoleName = (roleName) => {
- const role = digitalHumans.value.find((r) => r.name === roleName)
- return role ? role.name : '未知角色'
- }
- // 解析 Markdown 文本
- const parseMarkdown = (text) => {
- if (!text) return ''
- return marked(text)
- }
- // 步骤4:校验脚本
- const validateScript = () => {
- let isValid = true
- errorMessages.value = []
- // 检查环节名称、背景图或视频
- scriptData.sections.forEach((section, sectionIndex) => {
- if (!section.name.trim()) {
- errorMessages.value.push(`环节${sectionIndex + 1}:名称未配置!`)
- isValid = false
- }
- // 根据背景类型检查对应的媒体URL
- if (section.backgroundType === 'video') {
- // 视频背景需要检查视频URL
- if (!section.backgroundVideo.url) {
- errorMessages.value.push(`环节${sectionIndex + 1}:视频背景URL未配置!`)
- isValid = false
- }
- } else if (section.backgroundType === 'imageAudio') {
- // 图音背景需要检查背景图URL
- if (!section.backgroundImage.url) {
- errorMessages.value.push(`环节${sectionIndex + 1}:背景图URL未配置!`)
- isValid = false
- }
- }
- // 检查对话
- section.dialogues.forEach((dialogue, dialogueIndex) => {
- // 检查数字人、提问、诗词、朗诵评价、写诗评价、背诵诗词评价类型的对话
- if (dialogue.type === 'digital' || dialogue.type === 'quest' || dialogue.type === 'poem' || dialogue.type === 'poem_reading' || dialogue.type === 'write_reading' || dialogue.type === 'recite_reading') {
- if (
- !dialogue.roleName ||
- !dialogue.content.trim() ||
- (dialogue.type !== 'poem' && dialogue.type !== 'poem_reading' && dialogue.type !== 'write_reading' && dialogue.type !== 'recite_reading' && !dialogue.voiceoverUrl)
- ) {
- errorMessages.value.push(
- `环节${sectionIndex + 1}:对话${dialogueIndex + 1}:存在完成内容!`
- )
- isValid = false
- }
- } else if (dialogue.type === 'video') {
- // 检查视频类型的对话
- if (
- !dialogue.videoUrl
- ) {
- errorMessages.value.push(
- `环节${sectionIndex + 1}:对话${dialogueIndex + 1}:视频内容未配置完整!`
- )
- isValid = false
- }
- }
- })
- })
- isValidationPassed.value = isValid
- validationMessage.value = errorMessages.value.length > 0 ? '校验失败' : '校验通过'
- }
- // 图片上传前验证
- const beforeImageUpload = (file) => {
- const isJPG = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif' || file.type === 'image/webp'
- const isLt2M = file.size / 1024 / 1024 < 2
- if (!isJPG) {
- ElMessage.error('只能上传 JPG、PNG、GIF、WebP 格式的图片!')
- return false
- }
- if (!isLt2M) {
- ElMessage.error('图片大小不能超过 2MB!')
- return false
- }
- return true
- }
- // 处理图片上传成功
- const handleImageUpload = (response, file, sectionIndex) => {
- // 这里假设上传成功后返回的response包含图片的URL
- // 实际项目中需要根据后端API的返回格式进行调整
- const imageUrl = response.url || URL.createObjectURL(file)
- scriptData.sections[sectionIndex].backgroundImage.url = imageUrl
- scriptData.sections[sectionIndex].backgroundImage.generating = false
- ElMessage.success('图片上传成功!')
- }
- // 编辑图片
- const editImage = (sectionIndex) => {
- // 这里可以添加编辑图片的逻辑,比如打开图片编辑器
- ElMessage.info('编辑图片功能待实现')
- }
- // 删除图片
- const deleteImage = (sectionIndex) => {
- scriptData.sections[sectionIndex].backgroundImage.url = ''
- ElMessage.success('图片删除成功!')
- }
- // 步骤4:保存脚本
- const saveScript = async () => {
- validateScript()
- if (!isValidationPassed.value) {
- return
- }
- // 保存脚本后清除缓存
- clearScriptDataCache()
- emit('save', scriptData, [...replacedUrls.value])
- emit('update:visible', false)
- }
- // 下一步操作
- const nextStep = () => {
- if (currentStep.value === 2) {
- validateScript()
- }
- currentStep.value++
- }
- // 显示视频预览
- const showVideoPreview = () => {
- showVideoPreviewModal.value = true
- }
- // 关闭视频预览
- const closeVideoPreview = () => {
- showVideoPreviewModal.value = false
- }
- // 组件挂载时
- onMounted(async () => {
- // 设置初始步骤
- currentStep.value = props.initialStep
- // 监听文档点击关闭更多菜单
- document.addEventListener('click', closeMoreMenu)
- try {
- const params = {
- pageOn: 1,
- pageSize: 100,
- category: '小学低年级',
- publicStatus: true
- }
- const { list } = await ChatRoleApi.getMyPage(params)
- params.category += 'AI'
- const { list: listAi } = await ChatRoleApi.getMyPage(params)
- params.category = '全部'
- const { list: listAll } = await ChatRoleApi.getMyPage(params)
- params.category = '全部-Poet'
- const { list: listAllPoet } = await ChatRoleApi.getMyPage(params)
- listAi.push(...list)
- listAi.push(...listAll)
- listAi.push(...listAllPoet)
- digitalHumans.value = listAi
- } catch (error) {
- console.error('获取角色数据失败:', error)
- }
- inProgressTimer.value = setInterval(async () => {
- await refreshWatchImages()
- }, 3000)
- inProgressVideoTimer.value = setInterval(async () => {
- await refreshWatchVideos()
- }, 3000)
- })
- // 关闭事件
- const emit = defineEmits(['update:visible', 'save'])
- const handleClose = () => {
- emit('update:visible', false)
- }
- // 组件卸载时
- onUnmounted(() => {
- if (inProgressTimer.value) {
- clearInterval(inProgressTimer.value)
- }
- if (inProgressVideoTimer.value) {
- clearInterval(inProgressVideoTimer.value)
- }
- document.removeEventListener('click', closeMoreMenu)
- })
- </script>
- <style scoped>
- .course-script-editor {
- width: 100%;
- height: 90vh;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- background-color: #f8f9fa;
- }
- /* 主容器样式 */
- .main-container {
- flex: 1;
- display: flex;
- overflow: hidden;
- }
- /* 左侧步骤指示器样式 */
- .steps-sidebar {
- width: 200px;
- background-color: #f5f7fa;
- border-right: 1px solid #ebeef5;
- padding: 30px 0;
- display: flex;
- align-items: center;
- }
- /* 右侧内容区域样式 */
- .content-area {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- }
- /* 步骤内容样式 */
- .step-content {
- flex: 1;
- padding: 20px;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- background-color: white;
- border-radius: 0;
- box-shadow: none;
- }
- /* 步骤1垂直居中 */
- .step-content:has(.ai-input-container) {
- justify-content: center;
- align-items: center;
- }
- /* 编辑器工具栏样式 - 固定顶部 */
- .editor-toolbar.sticky-top {
- position: sticky;
- top: 0;
- z-index: 100;
- margin-top: -20px;
- margin-left: -20px;
- margin-right: -20px;
- border-radius: 0;
- border-bottom: 1px solid #ebeef5;
- background: rgba(250, 250, 250, 0.95);
- backdrop-filter: blur(10px);
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
- }
- /* 脚本编辑器样式 - 可滚动 */
- .script-editor {
- flex: 1;
- overflow-y: auto;
- margin-top: 20px;
- padding-right: 10px;
- background-color: white;
- border-radius: 8px;
- padding: 20px;
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
- }
- .script-editor::-webkit-scrollbar {
- width: 6px;
- }
- .script-editor::-webkit-scrollbar-track {
- background: #f1f1f1;
- border-radius: 3px;
- }
- .script-editor::-webkit-scrollbar-thumb {
- background: #c1c1c1;
- border-radius: 3px;
- }
- /* 背景类型切换样式 */
- .background-type-switch {
- position: absolute;
- top: -15px;
- left: 10px;
- z-index: 10;
- }
- /* 媒体控制区域样式调整 */
- .media-controls {
- position: relative;
- margin-top: 30px;
- padding-top: 40px; /* 为背景类型切换留出空间 */
- height: 165px;
- }
- /* 视频预览样式 */
- .media-preview video {
- width: 100%;
- max-height: 300px;
- object-fit: cover;
- border-radius: 4px;
- }
- /* 预览视频背景样式 */
- .preview-section {
- position: relative;
- min-height: 400px;
- margin-bottom: 20px;
- border-radius: 8px;
- overflow: hidden;
- }
- .preview-video {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 0;
- }
- .preview-video video {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- .preview-section-content {
- position: relative;
- z-index: 1;
- padding: 20px;
- background: rgba(255, 255, 255, 0.8);
- height: 100%;
- display: flex;
- flex-direction: column;
- }
- .script-editor::-webkit-scrollbar-thumb:hover {
- background: #a1a1a1;
- }
- /* 步骤导航 */
- .steps-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 20px;
- width: 100%;
- .step-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 100%;
- .step-circle {
- width: 32px;
- height: 32px;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: bold;
- margin-bottom: 8px;
- }
- .step-title {
- font-size: 14px;
- text-align: center;
- padding: 0 20px;
- }
- &.process {
- .step-circle {
- background-color: #409eff;
- color: white;
- }
- .step-title {
- color: #409eff;
- }
- }
- &.wait {
- .step-circle {
- background-color: #e4e7ed;
- color: #c0c4cc;
- }
- .step-title {
- color: #c0c4cc;
- }
- }
- &.finish {
- .step-circle {
- background-color: #67c23a;
- color: white;
- }
- .step-title {
- color: #67c23a;
- }
- }
- }
- .step-line {
- width: 2px;
- height: 40px;
- background-color: #e4e7ed;
- &.active {
- background-color: #409eff;
- }
- }
- }
- /* 步骤内容 */
- .step-content {
- background-color: white;
- border-radius: 8px;
- padding: 20px;
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
- }
- /* 按钮组样式 */
- .button-group {
- display: flex;
- gap: 10px;
- margin-top: 20px;
- justify-content: center;
- }
- /* 次要按钮样式 */
- .generate-btn.secondary {
- background-color: #606266;
- color: white;
- }
- .generate-btn.secondary:hover {
- background-color: #ffaa72;
- color: white;
- }
- /* 对话类型标签 */
- .dialogue-type-tag {
- position: absolute;
- top: -10px;
- left: 10px;
- padding: 2px 8px;
- border-radius: 10px;
- font-size: 12px;
- font-weight: 500;
- color: white;
- }
- /* 隐藏用户回复卡片 */
- .dialogue-item.hidden {
- display: none;
- }
- /* 错误信息项样式 */
- .error-item {
- margin-bottom: 8px;
- line-height: 1.4;
- }
- .dialogue-type-tag.digital {
- background-color: #409eff;
- }
- .dialogue-type-tag.user {
- background-color: #67c23a;
- }
- .dialogue-type-tag.quest {
- background-color: #e6a23c;
- }
- .dialogue-type-tag.poem {
- background-color: #909399;
- }
- .dialogue-type-tag.poem_reading {
- background-color: #7d60a4;
- }
- .dialogue-type-tag.write_reading {
- background-color: #c23a70;
- }
- .dialogue-type-tag.recite_reading {
- background-color: #2aa898;
- }
- .dialogue-type-tag.video {
- background-color: #8b4513;
- }
- /* 对话项样式 */
- .dialogue-item {
- position: relative;
- background-color: #f9f9f9;
- border-radius: 8px;
- padding: 20px;
- margin-bottom: 15px;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
- transition: all 0.3s ease;
- }
- .dialogue-item:hover {
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
- }
- .dialogue-item.digital {
- border-left: 4px solid #409eff;
- }
- .dialogue-item.user {
- border-left: 4px solid #67c23a;
- }
- .dialogue-item.quest {
- border-left: 4px solid #e6a23c;
- }
- .dialogue-item.video {
- border-left: 4px solid #8b4513;
- }
- .dialogue-item.poem_reading {
- border-left: 4px solid #7d60a4;
- }
- .dialogue-item.write_reading {
- border-left: 4px solid #c23a70;
- }
- .dialogue-item.recite_reading {
- border-left: 4px solid #2aa898;
- }
- /* 对话头部 */
- .dialogue-header {
- margin-bottom: 10px;
- }
- /* 对话行 */
- .dialogue-row {
- display: flex;
- gap: 15px;
- align-items: flex-start;
- }
- /* 角色选择 */
- .dialogue-role-select {
- flex-shrink: 0;
- }
- /* 回复角色选择 */
- .dialogue-reply-select {
- flex-shrink: 0;
- }
- /* 内容容器 */
- .dialogue-content-container {
- flex: 1;
- min-width: 0;
- }
- /* 添加对话按钮容器 */
- .add-dialogue-buttons {
- display: flex;
- gap: 10px;
- margin-top: 15px;
- }
- /* 添加对话按钮 */
- .add-dialogue-btn {
- padding: 8px 16px;
- border: none;
- border-radius: 4px;
- font-size: 14px;
- font-weight: 500;
- cursor: pointer;
- transition: all 0.3s ease;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 5px;
- min-width: 120px;
- }
- .add-dialogue-btn.digital {
- background-color: #83c2ff;
- color: white;
- }
- .add-dialogue-btn.digital:hover {
- background-color: #409eff;
- border-color: #4aa2fd;
- color: white;
- }
- .add-dialogue-btn.user {
- background-color: #85ce61;
- color: white;
- }
- .add-dialogue-btn.quest {
- background-color: #e6a23c;
- color: white;
- }
- .add-dialogue-btn.poem {
- background-color: #909399;
- color: white;
- }
- .add-dialogue-btn.poem_reading {
- background-color: #7d60a4;
- color: white;
- }
- .add-dialogue-btn.write_reading {
- background-color: #c23a70;
- color: white;
- }
- .add-dialogue-btn.recite_reading {
- background-color: #2aa898;
- color: white;
- }
- .add-dialogue-btn.quest-user {
- background-color: #e6a23c;
- color: white;
- }
- .add-dialogue-btn.more-btn {
- background-color: #4a5568;
- color: white;
- }
- .add-dialogue-btn.user:hover {
- background-color: #67c23a;
- border-color: #67c23a;
- color: white;
- }
- .add-dialogue-btn.quest:hover {
- background-color: #cf9236;
- border-color: #cf9236;
- color: white;
- }
- .add-dialogue-btn.quest-user:hover {
- background-color: #cf9236;
- border-color: #cf9236;
- color: white;
- }
- .add-dialogue-btn.poem:hover {
- background-color: #73767a;
- border-color: #73767a;
- }
- .add-dialogue-btn.poem_reading:hover {
- background-color: #624a83;
- border-color: #624a83;
- color: white;
- }
- .add-dialogue-btn.write_reading:hover {
- background-color: #9e2a56;
- border-color: #9e2a56;
- color: white;
- }
- .add-dialogue-btn.recite_reading:hover {
- background-color: #208174;
- border-color: #208174;
- color: white;
- }
- .add-dialogue-btn.more-btn:hover {
- background-color: #2d3748;
- border-color: #2d3748;
- color: white;
- }
- /* 更多下拉菜单容器 */
- .more-dropdown-wrapper {
- position: relative;
- display: inline-block;
- }
- /* 更多下拉菜单 */
- .more-dropdown-menu {
- position: absolute;
- top: 100%;
- right: 0;
- margin-top: 5px;
- background-color: white;
- border: 1px solid #d9d9d9;
- border-radius: 6px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
- padding: 6px;
- display: flex;
- flex-direction: column;
- gap: 6px;
- min-width: 170px;
- z-index: 100;
- }
- /* 下拉菜单中按钮 */
- .more-item-btn {
- padding: 8px 12px;
- border: none;
- border-radius: 4px;
- font-size: 14px;
- font-weight: 500;
- cursor: pointer;
- transition: all 0.3s ease;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- gap: 5px;
- text-align: left;
- width: 100%;
- color: white;
- }
- .more-item-btn.poem {
- background-color: #909399;
- }
- .more-item-btn.poem:hover {
- background-color: #73767a;
- }
- .more-item-btn.poem_reading {
- background-color: #7d60a4;
- }
- .more-item-btn.poem_reading:hover {
- background-color: #624a83;
- }
- .more-item-btn.write_reading {
- background-color: #c23a70;
- }
- .more-item-btn.write_reading:hover {
- background-color: #9e2a56;
- }
- .more-item-btn.recite_reading {
- background-color: #2aa898;
- }
- .more-item-btn.recite_reading:hover {
- background-color: #208174;
- }
- /* 上传相关样式 */
- .upload-container {
- margin-top: 10px;
- display: inline-block;
- }
- .media-upload-placeholder {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 40px 20px;
- border: 2px dashed #d9d9d9;
- border-radius: 8px;
- margin-top: 10px;
- background-color: #fafafa;
- }
- .upload-icon {
- font-size: 48px;
- margin-bottom: 16px;
- }
- .upload-text {
- margin-bottom: 16px;
- color: #999;
- }
- .upload-btn {
- margin-left: 10px;
- }
- .upload-btn-full {
- width: 100%;
- }
- .media-preview {
- position: relative;
- margin-top: 10px;
- border-radius: 8px;
- overflow: hidden;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
- }
- .media-preview img,
- .media-preview video {
- width: 100%;
- max-height: 300px;
- object-fit: cover;
- }
- .media-preview .preview-actions {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- background: rgba(0, 0, 0, 0.6);
- padding: 10px;
- display: flex;
- justify-content: flex-end;
- margin-top: 0;
- }
- .media-preview .preview-actions button {
- color: white;
- margin-left: 10px;
- }
- .media-preview .preview-actions button:hover {
- color: #409eff;
- }
- .add-dialogue-btn.video {
- background-color: #8b4513;
- color: white;
- }
- .add-dialogue-btn.video:hover {
- background-color: #a0522d;
- border-color: #a0522d;
- color: white;
- }
- /* 预览对话样式 */
- .preview-dialogue {
- position: relative;
- margin-bottom: 20px;
- padding: 15px;
- border-radius: 8px;
- background-color: #f9f9f9;
- }
- .preview-dialogue.digital {
- border-left: 4px solid #409eff;
- }
- .preview-dialogue.user {
- border-left: 4px solid #67c23a;
- }
- .preview-dialogue.quest {
- border-left: 4px solid #e6a23c;
- }
- .preview-dialogue.poem {
- border-left: 4px solid #909399;
- }
- .preview-dialogue.video {
- border-left: 4px solid #8b4513;
- }
- .preview-dialogue .dialogue-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 0;
- margin-bottom: 10px;
- }
- .preview-dialogue .dialogue-header-left {
- display: flex;
- align-items: center;
- gap: 2px;
- }
- .preview-dialogue .dialogue-type-tag {
- position: static;
- margin-right: 2px;
- }
- /* 回复信息 */
- .reply-info {
- margin-top: 10px;
- padding-top: 10px;
- border-top: 1px solid #e8e8e8;
- font-size: 14px;
- color: #666;
- font-style: italic;
- }
- /* AI输入容器 */
- .ai-input-container {
- max-width: 800px;
- margin: 0 auto;
- padding: 30px;
- background: white;
- border-radius: 16px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
- display: flex;
- flex-direction: column;
- min-height: 500px;
- }
- .selection-group {
- margin-bottom: 30px;
- }
- .ai-input-wrapper {
- margin-bottom: 30px;
- }
- .ai-input-container .button-group {
- display: flex;
- gap: 10px;
- margin-top: 30px;
- justify-content: center;
- }
- .ai-input-container .button-group button {
- flex: 1;
- min-width: 200px;
- text-align: center;
- }
- .ai-input-wrapper {
- position: relative;
- margin-bottom: 30px;
- }
- .ai-icon {
- position: absolute;
- top: 20px;
- left: 20px;
- font-size: 28px;
- color: #409eff;
- background: rgba(64, 158, 255, 0.1);
- width: 48px;
- height: 48px;
- border-radius: 12px;
- display: flex;
- align-items: center;
- justify-content: center;
- animation: pulse 2s infinite;
- }
- @keyframes pulse {
- 0% {
- box-shadow: 0 0 0 0 rgba(64, 158, 255, 0.4);
- }
- 70% {
- box-shadow: 0 0 0 10px rgba(64, 158, 255, 0);
- }
- 100% {
- box-shadow: 0 0 0 0 rgba(64, 158, 255, 0);
- }
- }
- .ai-textarea {
- width: 100%;
- min-height: 140px;
- padding: 24px 24px 24px 84px;
- border: 2px solid #e8e8e8;
- border-radius: 16px;
- font-size: 16px;
- resize: vertical;
- transition: all 0.3s ease;
- background: #fafafa;
- line-height: 1.6;
- }
- .ai-textarea:focus {
- outline: none;
- border-color: #409eff;
- background: white;
- box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
- }
- .selection-group {
- display: grid;
- grid-template-columns: 1fr 1fr;
- gap: 24px;
- margin-bottom: 30px;
- }
- .selection-item {
- display: flex;
- flex-direction: column;
- gap: 10px;
- }
- .selection-item label {
- font-weight: 600;
- color: #333;
- font-size: 14px;
- text-transform: uppercase;
- letter-spacing: 0.5px;
- color: #666;
- }
- .selection-item select {
- padding: 14px 16px;
- border: 2px solid #e8e8e8;
- border-radius: 10px;
- font-size: 14px;
- transition: all 0.3s ease;
- background: white;
- }
- .selection-item select:focus {
- outline: none;
- border-color: #409eff;
- box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
- }
- .multi-select {
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
- padding: 12px;
- border: 2px solid #e8e8e8;
- border-radius: 10px;
- background: white;
- transition: all 0.3s ease;
- }
- .multi-select:focus-within {
- border-color: #409eff;
- box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
- }
- .select-option {
- padding: 8px 16px;
- background: #f5f5f5;
- border-radius: 20px;
- cursor: pointer;
- transition: all 0.2s ease;
- font-size: 14px;
- font-weight: 500;
- border: 1px solid transparent;
- }
- .select-option:hover {
- background: #e6f7ff;
- border-color: #91d5ff;
- }
- .select-option.selected {
- background: #409eff;
- color: white;
- border-color: #409eff;
- box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
- }
- /* 加载遮挡层样式 */
- .loading-overlay {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.1);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 9999;
- pointer-events: auto;
- }
- .loading-content {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 16px;
- background: white;
- padding: 32px;
- border-radius: 12px;
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
- pointer-events: auto;
- }
- .loading-spinner {
- width: 48px;
- height: 48px;
- border: 4px solid #f3f3f3;
- border-top: 4px solid #409eff;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- }
- @keyframes spin {
- 0% {
- transform: rotate(0deg);
- }
- 100% {
- transform: rotate(360deg);
- }
- }
- .loading-text {
- font-size: 16px;
- font-weight: 500;
- color: #333;
- }
- /* 按钮样式 */
- .generate-btn {
- padding: 14px 8px;
- border: none;
- border-radius: 8px;
- font-size: 14px;
- font-weight: 400;
- cursor: pointer;
- transition: all 0.3s ease;
- position: relative;
- overflow: hidden;
- }
- .generate-btn.primary {
- background: linear-gradient(135deg, #409eff, #1890ff);
- color: white;
- box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
- }
- .generate-btn.primary:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
- }
- .generate-btn.primary:disabled {
- background: #91c5f7;
- cursor: not-allowed;
- transform: none;
- box-shadow: none;
- }
- .generate-btn.small {
- padding: 8px 16px;
- font-size: 14px;
- border-radius: 8px;
- }
- .generate-btn.small:hover {
- transform: translateY(-1px);
- box-shadow: 0 3px 8px rgba(64, 158, 255, 0.3);
- }
- .generate-btn.small:disabled {
- background: #91c5f7;
- color: white;
- cursor: not-allowed;
- transform: none;
- box-shadow: none;
- }
- .toolbar-btn:disabled {
- background: #f0f0f0;
- color: #c0c0c0;
- border-color: #e0e0e0;
- cursor: not-allowed;
- transform: none;
- box-shadow: none;
- }
- .toolbar-btn:disabled:hover {
- background: #f0f0f0;
- color: #c0c0c0;
- border-color: #e0e0e0;
- transform: none;
- box-shadow: none;
- }
- /* 编辑器工具栏 */
- .editor-toolbar {
- position: sticky;
- top: 20px;
- z-index: 100;
- margin-bottom: 30px;
- padding: 16px 20px;
- background: rgba(250, 250, 250, 0.95);
- backdrop-filter: blur(10px);
- border-radius: 12px;
- border: 1px solid #e8e8e8;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
- overflow-x: auto;
- overflow-y: hidden;
- white-space: nowrap;
- }
- .editor-toolbar::-webkit-scrollbar {
- height: 4px;
- }
- .editor-toolbar::-webkit-scrollbar-track {
- background: #f1f1f1;
- border-radius: 2px;
- }
- .editor-toolbar::-webkit-scrollbar-thumb {
- background: #c1c1c1;
- border-radius: 2px;
- }
- .editor-toolbar::-webkit-scrollbar-thumb:hover {
- background: #a1a1a1;
- }
- .toolbar-btn {
- padding: 12px 24px;
- margin: 0 12px;
- background: white;
- border: 2px solid #e8e8e8;
- border-radius: 10px;
- cursor: pointer;
- transition: all 0.3s ease;
- font-weight: 500;
- color: #333;
- }
- .toolbar-btn:hover {
- background: #409eff;
- color: white;
- border-color: #409eff;
- transform: translateY(-1px);
- box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
- }
- /* 脚本编辑器 */
- .script-section {
- margin-top: 40px;
- margin-bottom: 40px;
- padding: 5px 24px 24px;
- background: white;
- border-radius: 16px;
- position: relative;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
- border: 1px solid #f0f0f0;
- }
- .section-header {
- margin-bottom: 24px;
- display: flex;
- align-items: center;
- gap: 16px;
- }
- .section-name-container {
- display: flex;
- align-items: center;
- flex: 1;
- gap: 12px;
- margin-top: 16px;
- }
- .remove-section-btn {
- background: #ff4d4f;
- border: none;
- color: white;
- font-size: 16px;
- cursor: pointer;
- padding: 0;
- width: 28px;
- height: 28px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 6px;
- transition: all 0.3s ease;
- flex-shrink: 0;
- }
- .remove-section-btn:hover {
- background: #ff7875;
- transform: scale(1.1);
- box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
- }
- .section-name-label {
- padding: 2px 15px;
- border-radius: 10px;
- font-size: 18px;
- font-weight: 500;
- color: white;
- background-color: #c18484;
- white-space: nowrap;
- display: flex;
- align-items: center;
- height: 44px;
- box-sizing: border-box;
- }
- .section-title {
- flex: 1;
- padding: 14px 16px;
- border: 2px solid #e8e8e8;
- border-radius: 10px;
- font-size: 16px;
- font-weight: 500;
- transition: all 0.3s ease;
- }
- .section-title:focus {
- outline: none;
- border-color: #409eff;
- box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
- }
- .media-controls {
- display: flex;
- background: linear-gradient(135deg, #f8f9fa, #ffffff);
- padding: 16px 20px;
- border-radius: 10px;
- border: 1px solid #e8e8e8;
- align-items: center;
- justify-content: space-between;
- }
- .media-item {
- display: flex;
- align-items: center;
- gap: 10px;
- min-height: 50px;
- }
- .media-input-group {
- display: flex;
- align-items: center;
- gap: 10px;
- }
- .media-label {
- font-size: 14px;
- font-weight: 600;
- white-space: nowrap;
- color: #666;
- }
- .media-prompt {
- font-size: 14px;
- transition: all 0.3s ease;
- width: 300px;
- }
- .media-prompt-video{
- font-size: 14px;
- transition: all 0.3s ease;
- width: 500px;
- }
- /* 视频对话样式 */
- .dialogue-item.video .dialogue-row {
- justify-content: center;
- }
- .dialogue-item.video .media-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 100%;
- max-width: 900px;
- }
- .dialogue-item.video .media-input-group {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- gap: 15px;
- }
- .dialogue-item.video .media-label {
- white-space: nowrap;
- margin-bottom: 0;
- }
- .dialogue-item.video .media-prompt-video {
- flex: 1;
- min-width: 300px;
- max-width: 600px;
- }
- .dialogue-item.video .media-prompt-video .el-textarea {
- min-height: 40px;
- }
- .dialogue-item.video .media-prompt-video .el-textarea__inner {
- min-height: 40px;
- padding: 6px 12px;
- }
- .dialogue-item.video .media-preview {
- flex: 0 0 200px;
- margin: 5px 0;
- }
- .dialogue-item.video .media-preview video {
- width: 100%;
- max-height: 120px;
- object-fit: cover;
- border-radius: 4px;
- }
- .dialogue-item.video .generate-btn {
- min-width: 80px;
- white-space: nowrap;
- }
- .dialogue-item.video .remove-btn {
- margin-left: 10px;
- }
- .media-prompt .el-textarea {
- width: 100%;
- min-height: 60px;
- }
- .media-prompt .el-textarea__inner {
- padding: 8px 12px;
- border: 2px solid #e8e8e8;
- border-radius: 8px;
- font-size: 14px;
- transition: all 0.3s ease;
- min-height: 60px;
- resize: none;
- }
- .media-prompt .el-textarea__inner:focus {
- outline: none;
- border-color: #409eff;
- box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
- }
- .media-preview {
- margin-left: 20px;
- }
- .media-preview img {
- max-width: 180px;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
- transition: transform 0.3s ease;
- }
- .media-preview img:hover {
- transform: scale(1.05);
- }
- .dialogues-container {
- margin-top: 48px;
- }
- .dialogue-item {
- margin-bottom: 20px;
- padding: 20px;
- background: #fafafa;
- border-radius: 12px;
- border: 1px solid #e8e8e8;
- transition: all 0.3s ease;
- }
- .dialogue-item:hover {
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
- transform: translateY(-2px);
- }
- .dialogue-row {
- display: flex;
- align-items: flex-start;
- gap: 16px;
- }
- .dialogue-role-select {
- min-width: 140px;
- }
- .dialogue-role-select select {
- width: 100%;
- padding: 10px 12px;
- border: 2px solid #e8e8e8;
- border-radius: 8px;
- font-size: 14px;
- transition: all 0.3s ease;
- }
- .dialogue-role-select select:focus {
- outline: none;
- border-color: #409eff;
- box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
- }
- .dialogue-content-container {
- flex: 1;
- }
- .dialogue-content:focus {
- outline: none;
- border-color: #409eff;
- box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1);
- }
- /* 提问类型选择 */
- .question-type-select {
- display: flex;
- align-items: center;
- gap: 10px;
- margin-bottom: 12px;
- }
- .question-type-label {
- font-size: 14px;
- font-weight: 600;
- color: #666;
- }
- /* 单选题选项 */
- .single-choice-options {
- margin-top: 16px;
- padding: 16px;
- background: #f8f9fa;
- border-radius: 8px;
- border: 1px solid #e8e8e8;
- }
- .options-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 12px;
- }
- .options-label {
- font-size: 14px;
- font-weight: 600;
- color: #666;
- }
- .add-option-btn {
- padding: 6px 12px;
- background: #409eff;
- color: white;
- border: none;
- border-radius: 4px;
- font-size: 12px;
- cursor: pointer;
- transition: all 0.2s ease;
- }
- .add-option-btn:hover {
- background: #66b1ff;
- }
- .option-item {
- display: flex;
- align-items: center;
- gap: 10px;
- margin-bottom: 10px;
- }
- .option-item:last-child {
- margin-bottom: 0;
- }
- .option-label {
- font-weight: 600;
- color: #409eff;
- width: 20px;
- text-align: center;
- flex-shrink: 0;
- }
- .answer-radio-wrapper {
- width: 60px;
- flex-shrink: 0;
- display: flex;
- align-items: center;
- gap: 4px;
- }
- .remove-option-btn {
- flex-shrink: 0;
- background: #ff4d4f;
- border: none;
- color: white;
- font-size: 14px;
- cursor: pointer;
- padding: 0;
- width: 24px;
- height: 24px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- transition: all 0.2s ease;
- }
- .remove-option-btn:hover {
- background: #ff7875;
- }
- /* 答案单选框包装器 */
- .answer-radio-wrapper {
- display: flex;
- align-items: center;
- gap: 4px;
- }
- /* 正确答案标记 */
- .correct-mark {
- color: #52c41a;
- font-size: 18px;
- font-weight: bold;
- animation: fadeIn 0.2s ease;
- }
- /* 调整单选框右外边距 */
- :deep(.el-radio) {
- margin-right: 10px;
- }
- @keyframes fadeIn {
- from {
- opacity: 0;
- transform: scale(0.5);
- }
- to {
- opacity: 1;
- transform: scale(1);
- }
- }
- .remove-btn {
- background: #ff4d4f;
- border: none;
- color: white;
- font-size: 16px;
- cursor: pointer;
- padding: 0;
- width: 28px;
- height: 28px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 6px;
- transition: all 0.3s ease;
- flex-shrink: 0;
- }
- .remove-btn:hover {
- background: #ff7875;
- transform: scale(1.1);
- box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
- }
- .dialogue-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 8px;
- }
- .dialogue-text {
- flex: 1;
- width: 100%;
- font-size: 16px;
- line-height: 1.6;
- }
- .generate-btn.small {
- padding: 8px;
- background: linear-gradient(135deg, #409eff, #1890ff);
- color: white;
- border: none;
- border-radius: 6px;
- cursor: pointer;
- transition: all 0.3s ease;
- display: flex;
- align-items: center;
- justify-content: center;
- height: 28px;
- font-size: 14px;
- }
- .generate-btn.small:hover {
- transform: scale(1.1);
- box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
- }
- .play-btn {
- padding: 8px;
- background: #52c41a;
- color: white;
- border: none;
- border-radius: 6px;
- cursor: pointer;
- transition: all 0.3s ease;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 28px;
- height: 28px;
- font-size: 14px;
- }
- .play-btn:hover {
- background: #73d13d;
- transform: scale(1.1);
- box-shadow: 0 2px 8px rgba(82, 196, 26, 0.3);
- }
- .play-btn.small {
- padding: 8px;
- width: 28px;
- height: 28px;
- font-size: 14px;
- }
- .voice-icon {
- font-size: 14px;
- line-height: 1;
- }
- .play-icon {
- font-size: 14px;
- line-height: 1;
- }
- .action-buttons {
- display: flex;
- flex-direction: column;
- gap: 8px;
- margin-left: 8px;
- }
- .action-buttons-row {
- display: flex;
- gap: 8px;
- align-items: center;
- justify-content: flex-end;
- }
- .add-dialogue-btn,
- .add-section-btn {
- padding: 12px 24px;
- background: white;
- border: 2px dashed #d9d9d9;
- border-radius: 10px;
- cursor: pointer;
- transition: all 0.3s ease;
- font-weight: 500;
- color: #666;
- margin-top: 16px;
- width: 100%;
- text-align: center;
- }
- .add-dialogue-btn:hover,
- .add-section-btn:hover {
- border-color: #c18484;
- color: white;
- background: rgba(193, 132, 132, 0.6);
- transform: translateY(-1px);
- box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
- }
- /* 预览页面 */
- .preview-container {
- width: 100%;
- height: 100%;
- background: white;
- border-radius: 16px;
- padding: 30px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
- display: flex;
- flex-direction: column;
- }
- .scrollable-content {
- flex: 1;
- overflow-y: auto;
- margin-bottom: 20px;
- padding-right: 10px;
- }
- .scrollable-content::-webkit-scrollbar {
- width: 6px;
- }
- .scrollable-content::-webkit-scrollbar-track {
- background: #f1f1f1;
- border-radius: 3px;
- }
- .scrollable-content::-webkit-scrollbar-thumb {
- background: #c1c1c1;
- border-radius: 3px;
- }
- .scrollable-content::-webkit-scrollbar-thumb:hover {
- background: #a1a1a1;
- }
- .preview-content {
- margin-top: 20px;
- margin-bottom: 30px;
- }
- .preview-actions {
- margin-top: auto;
- display: flex;
- justify-content: flex-end;
- gap: 12px;
- }
- .validation-result {
- padding: 16px 20px;
- border-radius: 10px;
- font-weight: 500;
- font-size: 14px;
- }
- .validation-result.valid {
- background: #f6ffed;
- border: 2px solid #b7eb8f;
- color: #52c41a;
- box-shadow: 0 2px 8px rgba(82, 196, 26, 0.1);
- }
- .validation-result.invalid {
- background: #fff2f0;
- border: 2px solid #ffccc7;
- color: #ff4d4f;
- box-shadow: 0 2px 8px rgba(255, 77, 79, 0.1);
- }
- .preview-section {
- margin-bottom: 40px;
- padding: 40px;
- border-radius: 12px;
- border: 1px solid #e8e8e8;
- min-height: 300px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .preview-section h4 {
- margin-top: 0;
- color: #333;
- font-size: 18px;
- font-weight: 600;
- margin-bottom: 20px;
- }
- .preview-section-content {
- background: rgba(255, 255, 255, 0.2);
- padding: 20px;
- border-radius: 12px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
- backdrop-filter: blur(5px);
- width: 80%;
- }
- .preview-media {
- margin: 20px 0;
- padding: 16px;
- background: rgba(255, 255, 255, 0.8);
- border-radius: 10px;
- border: 1px solid #e8e8e8;
- display: flex;
- align-items: center;
- justify-content: space-between;
- flex-wrap: wrap;
- }
- .preview-media-left {
- display: flex;
- align-items: center;
- gap: 12px;
- }
- .preview-media-right {
- display: flex;
- align-items: center;
- gap: 12px;
- }
- .preview-image img {
- max-width: 250px;
- border-radius: 8px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
- transition: transform 0.3s ease;
- }
- .preview-image img:hover {
- transform: scale(1.05);
- }
- .preview-audio {
- float: right;
- margin-right: 20px;
- display: flex;
- align-items: center;
- gap: 8px;
- }
- .preview-dialogue {
- margin-bottom: 20px;
- padding: 16px;
- background: white;
- border-radius: 10px;
- border: 1px solid #e8e8e8;
- transition: all 0.3s ease;
- }
- .dialogue-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 8px;
- }
- .preview-dialogue:hover {
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
- }
- .dialogue-role {
- font-weight: 600;
- color: #409eff;
- font-size: 14px;
- }
- .dialogue-text {
- line-height: 1.6;
- font-size: 14px;
- color: #333;
- }
- /* Markdown 样式 */
- .dialogue-text h1,
- .dialogue-text h2,
- .dialogue-text h3,
- .dialogue-text h4,
- .dialogue-text h5,
- .dialogue-text h6 {
- margin: 16px 0 8px 0;
- font-weight: 600;
- line-height: 1.2;
- }
- .dialogue-text h1 {
- font-size: 24px;
- }
- .dialogue-text h2 {
- font-size: 20px;
- }
- .dialogue-text h3 {
- font-size: 18px;
- }
- .dialogue-text h4 {
- font-size: 16px;
- }
- .dialogue-text h5 {
- font-size: 14px;
- }
- .dialogue-text h6 {
- font-size: 12px;
- }
- .dialogue-text p {
- margin: 8px 0;
- }
- .dialogue-text ul,
- .dialogue-text ol {
- margin: 8px 0;
- padding-left: 24px;
- }
- .dialogue-text li {
- margin: 4px 0;
- }
- .dialogue-text strong {
- font-weight: 600;
- }
- .dialogue-text em {
- font-style: italic;
- }
- .dialogue-text a {
- color: #409eff;
- text-decoration: none;
- }
- .dialogue-text a:hover {
- text-decoration: underline;
- }
- .dialogue-text code {
- background: #f5f5f5;
- padding: 2px 4px;
- border-radius: 4px;
- font-family: 'Courier New', Courier, monospace;
- font-size: 14px;
- }
- .dialogue-text pre {
- background: #f5f5f5;
- padding: 12px;
- border-radius: 8px;
- overflow-x: auto;
- margin: 12px 0;
- }
- .dialogue-text pre code {
- background: none;
- padding: 0;
- }
- .voiceover-preview {
- margin-top: 12px;
- padding-top: 12px;
- border-top: 1px solid #f0f0f0;
- }
- .preview-actions {
- display: flex;
- justify-content: center;
- gap: 20px;
- padding-top: 24px;
- border-top: 1px solid #e8e8e8;
- }
- .primary-btn,
- .secondary-btn {
- padding: 14px 32px;
- border: none;
- border-radius: 12px;
- font-size: 16px;
- font-weight: 600;
- cursor: pointer;
- transition: all 0.3s ease;
- position: relative;
- overflow: hidden;
- }
- .primary-btn {
- background: linear-gradient(135deg, #409eff, #1890ff);
- color: white;
- box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
- }
- .primary-btn:hover {
- transform: translateY(-2px);
- box-shadow: 0 6px 16px rgba(64, 158, 255, 0.4);
- }
- .primary-btn:disabled {
- background: #91c5f7;
- cursor: not-allowed;
- transform: none;
- box-shadow: none;
- }
- .secondary-btn {
- background: white;
- color: #333;
- border: 2px solid #e8e8e8;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
- }
- .secondary-btn:hover {
- background: #fafafa;
- border-color: #409eff;
- color: #409eff;
- transform: translateY(-2px);
- box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
- }
- </style>
|