detail.vue 100 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725
  1. <template>
  2. <BlueHeaderBar />
  3. <svg width="0" height="0" class="aigc-sprite" aria-hidden="true">
  4. <defs>
  5. <symbol id="i-check" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5" fill="none" stroke="#fff" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"/></symbol>
  6. <symbol id="i-info" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 10.6v5" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><circle cx="12" cy="7.6" r="1.15" fill="currentColor"/></symbol>
  7. <symbol id="i-scene" viewBox="0 0 24 24"><rect x="3" y="4.5" width="18" height="15" rx="3" fill="none" stroke="currentColor" stroke-width="1.9"/><circle cx="8.6" cy="9.6" r="1.7" fill="currentColor"/><path d="M5 17.5l4.6-4.6 3.2 3.2 3.4-3.9 3.8 4.4" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"/></symbol>
  8. <symbol id="i-person" viewBox="0 0 24 24"><circle cx="12" cy="8.4" r="3.6" fill="none" stroke="currentColor" stroke-width="1.9"/><path d="M4.8 19.6c1.3-3.6 4-5.3 7.2-5.3s5.9 1.7 7.2 5.3" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></symbol>
  9. <symbol id="i-doc" viewBox="0 0 24 24"><rect x="4.5" y="3" width="15" height="18" rx="3" fill="none" stroke="currentColor" stroke-width="1.9"/><path d="M8.4 8h7.2M8.4 12h7.2M8.4 16h4.6" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></symbol>
  10. <symbol id="i-plus" viewBox="0 0 24 24"><rect x="3.5" y="3.5" width="17" height="17" rx="4" fill="none" stroke="currentColor" stroke-width="1.9"/><path d="M12 8.4v7.2M8.4 12h7.2" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></symbol>
  11. <symbol id="i-export" viewBox="0 0 24 24"><path d="M9.5 4H6a2.5 2.5 0 0 0-2.5 2.5v11A2.5 2.5 0 0 0 6 20h11a2.5 2.5 0 0 0 2.5-2.5V14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><path d="M14 4h6v6M20 4l-8.5 8.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/></symbol>
  12. <symbol id="i-book" viewBox="0 0 24 24"><path d="M12 6.2C10.5 4.9 8.3 4.2 5.5 4.2c-.8 0-1.5.06-2 .16V18.6c.5-.1 1.2-.16 2-.16 2.8 0 5 .7 6.5 2 1.5-1.3 3.7-2 6.5-2 .8 0 1.5.06 2 .16V4.36c-.5-.1-1.2-.16-2-.16-2.8 0-5 .7-6.5 2z" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"/><path d="M12 6.2v14" stroke="currentColor" stroke-width="1.9"/></symbol>
  13. <symbol id="i-img" viewBox="0 0 24 24"><rect x="3" y="3.5" width="18" height="17" rx="3.5" fill="none" stroke="currentColor" stroke-width="1.9"/><circle cx="9" cy="9.4" r="1.8" fill="currentColor"/><path d="M4.5 18l5-5 3.4 3.4 3-3.4 3.6 4" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"/></symbol>
  14. <symbol id="i-sheet" viewBox="0 0 24 24"><rect x="3.5" y="3.5" width="17" height="17" rx="3" fill="none" stroke="currentColor" stroke-width="1.9"/><path d="M3.5 9.2h17M9.2 9.2v11.3M3.5 14.8h17" stroke="currentColor" stroke-width="1.9"/></symbol>
  15. <symbol id="i-right" viewBox="0 0 24 24"><path d="M9 5.5l7 6.5-7 6.5" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></symbol>
  16. <symbol id="i-left" viewBox="0 0 24 24"><path d="M15 5.5L8 12l7 6.5" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></symbol>
  17. <symbol id="i-arrow" viewBox="0 0 24 24"><path d="M4 12h15M13.5 5.5L20 12l-6.5 6.5" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></symbol>
  18. <symbol id="i-upl" viewBox="0 0 24 24"><path d="M12 15.5V5M7.5 9L12 4.6 16.5 9" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M4.5 15.5v2.4A2.6 2.6 0 0 0 7.1 20.5h9.8a2.6 2.6 0 0 0 2.6-2.6v-2.4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></symbol>
  19. </defs>
  20. </svg>
  21. <div class="bg-F5F6F7 detail-page">
  22. <div class="aigc-wrap">
  23. <div class="aigc-board">
  24. <!-- 场景图 -->
  25. <section class="fcard" :class="{ off: !isSceneOn }">
  26. <header class="fhead">
  27. <div class="fh-row">
  28. <span class="fico"><svg><use href="#i-scene"/></svg></span>
  29. <div class="fh-text">
  30. <div class="fh-t">场景图生成</div>
  31. <div class="fh-s">自定义场景,文字描述生成</div>
  32. </div>
  33. <span class="toggle">
  34. <span class="swl">{{ isSceneOn ? '生成' : '不生成' }}</span>
  35. <label class="sw">
  36. <input type="checkbox" :checked="isSceneOn" @change="onSwChange('is_product_scene', $event)">
  37. <i></i>
  38. </label>
  39. </span>
  40. </div>
  41. </header>
  42. <div class="fbody">
  43. <SceneCard
  44. v-model="scenePrompt"
  45. v-model:bgPrompt="sceneBgPrompt"
  46. v-model:image="sceneImage"
  47. v-model:mode="sceneMode"
  48. />
  49. </div>
  50. <footer class="ffoot ffoot--tip">
  51. <el-tooltip effect="dark" placement="top" :show-after="200" popper-class="scene-ffoot-popper">
  52. <template #content>
  53. 未选择则不生成场景图。<br />
  54. 货号已经生成过场景图时,需要删除对应的「场景图.jpg」才能重新生成。
  55. </template>
  56. <span class="ffoot-inner">
  57. <svg class="ic"><use href="#i-info"/></svg>
  58. <span class="ffoot-copy">
  59. 未选择则不生成场景图,重出请先删除场景图.jpg
  60. </span>
  61. </span>
  62. </el-tooltip>
  63. </footer>
  64. </section>
  65. <!-- 模特图 -->
  66. <section class="fcard" :class="{ off: !isModelOn }">
  67. <header class="fhead">
  68. <div class="fh-row">
  69. <span class="fico"><svg><use href="#i-person"/></svg></span>
  70. <div class="fh-text">
  71. <div class="fh-t">模特图生成</div>
  72. <div class="fh-s">多模特可选,支持上传替换</div>
  73. </div>
  74. <span class="toggle">
  75. <span class="swl">{{ isModelOn ? '生成' : '不生成' }}</span>
  76. <label class="sw">
  77. <input type="checkbox" :checked="isModelOn" @change="onSwChange('is_upper_footer', $event)">
  78. <i></i>
  79. </label>
  80. </span>
  81. </div>
  82. </header>
  83. <div class="fbody">
  84. <ModelCard v-model="selectedModels" />
  85. </div>
  86. <footer class="ffoot"><svg class="ic"><use href="#i-info"/></svg>未选择则不生成模特图</footer>
  87. </section>
  88. <!-- 详情页 -->
  89. <section class="fcard fcard-wide" :class="{ off: !isDetailServiceSelected }">
  90. <header class="fhead">
  91. <div class="fh-row">
  92. <span class="fico"><svg><use href="#i-doc"/></svg></span>
  93. <div class="fh-text">
  94. <div class="fh-t">详情页生成</div>
  95. <div class="fh-s">选择详情模板后开始生成</div>
  96. </div>
  97. <span class="toggle">
  98. <span class="swl">{{ isDetailServiceSelected ? '生成' : '不生成' }}</span>
  99. <label class="sw">
  100. <input type="checkbox" :checked="isDetailServiceSelected" @change="onSwChange('is_detail', $event)">
  101. <i></i>
  102. </label>
  103. </span>
  104. </div>
  105. </header>
  106. <div class="fbody">
  107. <div class="tabs-row tabs-row-tools">
  108. <span class="hbtns">
  109. <button class="hbtn" type="button" title="向左" @click="scrollTemplates(-1)"><svg><use href="#i-left"/></svg></button>
  110. <button class="hbtn" type="button" title="向右" @click="scrollTemplates(1)"><svg><use href="#i-right"/></svg></button>
  111. </span>
  112. </div>
  113. <div class="hscroll tpl-hscroll" ref="tplScrollRef">
  114. <figure
  115. v-for="(template, index) in templates"
  116. :key="template.id || index"
  117. class="tpl"
  118. :class="{ sel: form.selectTemplate?.id == template.id }"
  119. @click="handleTemplateItemClick(template)"
  120. v-log="{ describe: { action: '点击选择详情模板', template_name: template.template_name } }"
  121. >
  122. <span class="ck" v-if="form.selectTemplate?.id == template.id">✓</span>
  123. <div
  124. class="template-download-btn"
  125. v-if="isDetailServiceSelected && template.template_type == 1"
  126. @click.stop="downloadTplExcel(template)"
  127. >
  128. 下载EXECL模版
  129. </div>
  130. <div class="tpl-head">
  131. <b>{{ template.template_name }}</b>
  132. </div>
  133. <div class="tpl-img-wrap">
  134. <el-image :src="getTemplateThumbImage(template)" class="tpl-img" />
  135. </div>
  136. <div class="tpl-mini" v-if="isDetailServiceSelected">
  137. <span class="lk" @click.stop="viewTemplate(template)">查看</span>
  138. <span class="lk" v-if="template.template_type == 1" @click.stop="editTemplate(template)">编辑</span>
  139. <span class="lk danger" v-if="template.template_type == 1" @click.stop="deleteTemplate(template)">删除</span>
  140. </div>
  141. </figure>
  142. </div>
  143. <div class="template-tips">
  144. <el-icon><Warning /></el-icon>
  145. <span v-if="!isDetailServiceSelected">请先打开详情页生成,再选择模板</span>
  146. <span v-else>该模版需提供{{ form.selectTemplate?.template_image_order?.split(',').length
  147. || 5}}张标准视角的商品图:{{ form.selectTemplate?.template_image_order ||
  148. '俯视,侧视,后跟,鞋底,内里'}}。请确保图片清晰度高,背景干净。</span>
  149. </div>
  150. </div>
  151. <footer class="ffoot"><svg class="ic"><use href="#i-info"/></svg>未选择则不生成详情页</footer>
  152. </section>
  153. <!-- 右侧栏 -->
  154. <aside class="side">
  155. <div class="scard">
  156. <div class="stitle">工具</div>
  157. <div
  158. v-if="useUserInfoStore.isHLM"
  159. class="trow"
  160. @click="addCustomTemplate"
  161. v-log="{ describe: { action: '点击新增自定义详情页模板', service: '新增自定义详情页模板' } }"
  162. >
  163. <span class="tic"><svg><use href="#i-plus"/></svg></span>
  164. <span>新增自定义详情页模板</span>
  165. <svg class="arr"><use href="#i-right"/></svg>
  166. </div>
  167. <div v-else class="trow disabled" title="功能开发中">
  168. <span class="tic"><svg><use href="#i-plus"/></svg></span>
  169. <span>详情页模板自定义</span>
  170. <svg class="arr"><use href="#i-right"/></svg>
  171. </div>
  172. <div
  173. v-if="useUserInfoStore.userInfo.brand_company_id == 44584"
  174. class="trow"
  175. @click="handleWhiteBgUploadClick"
  176. v-log="{ describe: { action: '点击白底图批量上传', service: '白底图批量上传' } }"
  177. >
  178. <span class="tic"><svg><use href="#i-export"/></svg></span>
  179. <span>白底图批量上传</span>
  180. <svg class="arr"><use href="#i-right"/></svg>
  181. </div>
  182. <div
  183. v-else
  184. class="trow"
  185. @click="handleWhiteBgExportClick"
  186. v-log="{ describe: { action: '点击白底图批量导出', service: '白底图批量导出' } }"
  187. >
  188. <span class="tic"><svg><use href="#i-export"/></svg></span>
  189. <span>白底图批量导出</span>
  190. <svg class="arr"><use href="#i-right"/></svg>
  191. </div>
  192. <div
  193. class="trow"
  194. @click="handleProductAlbumClick"
  195. v-log="{ describe: { action: '点击产品图册生成', service: '产品图册生成' } }"
  196. >
  197. <span class="tic"><svg><use href="#i-book"/></svg></span>
  198. <span>产品图册生成</span>
  199. <svg class="arr"><use href="#i-right"/></svg>
  200. </div>
  201. </div>
  202. <div class="scard">
  203. <div class="stitle">主图LOGO</div>
  204. <div class="logo-upload-area">
  205. <div v-if="!form.logo_path" class="up" :class="{ 'is-error': logoLoadError }"
  206. @click="openLogoUpload">
  207. <span class="uic"><svg><use href="#i-img"/></svg></span>
  208. <span class="t">点击或拖拽上传</span>
  209. <span class="s" v-if="logoLoadError">LOGO指向的文件不存在或加载失败,请重新上传</span>
  210. <span class="s" v-else>支持PNG、JPG格式</span>
  211. </div>
  212. <div v-else class="logo-upload-preview">
  213. <img :src="'file:///' + form.logo_path" alt="LOGO预览" class="logo-preview-image"
  214. @error="handleLogoLoadError" />
  215. <div class="logo-upload-actions">
  216. <span class="logo-action-btn" @click.stop="previewLogo">
  217. <el-icon><ZoomIn /></el-icon>
  218. </span>
  219. <span class="logo-action-btn" @click.stop="removeLogo">
  220. <el-icon><Delete /></el-icon>
  221. </span>
  222. </div>
  223. <div class="logo-upload-footer">
  224. <el-button type="primary" link @click.stop="openLogoUpload">重新上传</el-button>
  225. <el-button type="danger" link @click.stop="removeLogo">删除</el-button>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. <div class="scard right-section data-prep-section">
  231. <div class="stitle">商品资料对接</div>
  232. <div class="data-prep-content">
  233. <div class="data-mode">
  234. <button
  235. type="button"
  236. class="data-mode-btn"
  237. :class="{ on: form.dataType == '1' }"
  238. @click="setDataType('1')"
  239. >Excel导入</button>
  240. <button
  241. type="button"
  242. class="data-mode-btn"
  243. :class="{ on: form.dataType == '2' }"
  244. @click="setDataType('2')"
  245. >系统对接</button>
  246. </div>
  247. <template v-if="form.dataType == '1'">
  248. <button
  249. v-if="!form.excel_path"
  250. class="gbtn"
  251. type="button"
  252. @click="selectExcel"
  253. v-log="{ describe: { action: '点击选择Excel文件' } }"
  254. >
  255. <svg><use href="#i-sheet"/></svg>选择 Excel 文件
  256. </button>
  257. <div v-else class="excel-selected-info">
  258. <div class="excel-icon">
  259. <img src="@/assets/images/detail/file-excel.png" class="tab-icon" />
  260. </div>
  261. <div class="excel-file-text">
  262. <div class="excel-file-name" :title="excelFileName">{{ excelFileName }}</div>
  263. <div class="excel-file-actions">
  264. <el-button type="primary" link class="reupload-btn" @click="selectExcel"
  265. v-log="{ describe: { action: '重新上传Excel文件' } }">
  266. 重新上传
  267. </el-button>
  268. <el-button type="danger" link class="delete-excel-btn" @click="clearExcel"
  269. v-log="{ describe: { action: '删除Excel文件' } }">
  270. 删除
  271. </el-button>
  272. </div>
  273. </div>
  274. </div>
  275. <button class="lk data-prep-link" type="button" @click="downloadExcel"
  276. title="用于非自定义详情页的商品基础资料模版"
  277. v-log="{ describe: { action: '点击下载Excel模板' } }">
  278. 下载通用商品基础资料模版
  279. </button>
  280. </template>
  281. <div v-else class="sys-hint">
  282. 将从系统自动读取商品资料,无需上传 Excel
  283. </div>
  284. </div>
  285. </div>
  286. <div class="scard right-section publish-section" :class="{ 'publish-section--disabled': !canUsePublishSection }"
  287. v-if="onlineStoreTempList.length || onlineStoreTempListForeign.length">
  288. <div class="stitle">一键上架平台</div>
  289. <div class="frow2">
  290. <div v-if="onlineStoreTempList.length">
  291. <label>国内电商平台:</label>
  292. <el-select v-model="domesticPlatforms" multiple collapse-tags placeholder="请选择" class="publish-select"
  293. :disabled="!canUsePublishSection">
  294. <el-option v-for="store in onlineStoreTempList" :key="store.show_name" :label="store.show_name"
  295. :value="store.online_store_name" :disabled="!store.channel_status" />
  296. </el-select>
  297. </div>
  298. <div v-if="onlineStoreTempListForeign.length">
  299. <label>跨境电商平台:</label>
  300. <el-select v-model="foreignPlatforms" multiple collapse-tags placeholder="请选择" class="publish-select"
  301. :disabled="!canUsePublishSection">
  302. <el-option v-for="store in onlineStoreTempListForeign" :key="store.show_name"
  303. :label="store.show_name" :value="store.online_store_name" :disabled="!store.channel_status" />
  304. </el-select>
  305. </div>
  306. </div>
  307. </div>
  308. <button class="cta" type="button" :disabled="requesting" @click="generate" v-log="{ describe: { action: '点击开始生成详情页' } }">
  309. <b>开始生成<svg><use href="#i-arrow"/></svg></b>
  310. <small>将为本次批量选择的所有商品生成</small>
  311. </button>
  312. </aside>
  313. </div>
  314. <div class="ybar">
  315. <svg class="ic"><use href="#i-info"/></svg>
  316. <span>批量生成说明:本次设置将应用于您勾选的<b>所有商品</b>,<b>未打开的模块将不生成相关内容</b></span>
  317. </div>
  318. </div>
  319. <loading-dialog v-if="loadingDialogVisible" v-model="loadingDialogVisible" :requesting="requesting"
  320. :progress="progress" :message="message" :disabled-button="disabledButton" :use-new-progress="useNewProgress"
  321. :progress-steps="progressSteps" @button-click="handleComplete" :on-open-folder="openOutputDir">
  322. <template v-if="partErrList && partErrList.length > 0" #errList>
  323. <div v-for="(item, idx) in partErrList" :key="idx">
  324. <span v-if="item.goods_art_no">{{ item.goods_art_no }}:</span><span>{{ item.info }}</span>
  325. </div>
  326. </template>
  327. <template #progressMessages>
  328. <div class="progress-messages" v-if="progressMessages.length">
  329. <div class="message-header">
  330. <span>处理进度</span>
  331. <div class="flex right" style="gap:8px; align-items:center;">
  332. <el-button type="text" @click="openOutputDir" v-log="{ describe: { action: '点击打开输出目录' } }">打开目录</el-button>
  333. <el-button type="text" @click="showMessageHistory = !showMessageHistory"
  334. v-log="{ describe: { action: '点击查看进度详情' } }">
  335. {{ showMessageHistory ? '收起' : '查看详情' }}
  336. </el-button>
  337. </div>
  338. </div>
  339. <div class="message-list" v-if="showMessageHistory" ref="messageListRef">
  340. <div v-for="(msg, index) in progressMessages" :key="index" class="message-item flex left">
  341. <div class="message-time">{{ formatTime(msg.timestamp) }}</div>
  342. <div class="message-content mar-left-10" v-if="msg">
  343. <span class="goods-no" v-if="msg.goods_art_nos && msg.goods_art_nos.length > 0">货号{{
  344. msg.goods_art_nos.join(', ') }}:</span>
  345. <span class="message-text">{{ msg.msg }}</span>
  346. </div>
  347. </div>
  348. </div>
  349. </div>
  350. </template>
  351. </loading-dialog>
  352. <el-dialog v-model="dialogVisible">
  353. <img style="width: 100%;" :src="dialogImageUrl" alt="Preview Image" />
  354. </el-dialog>
  355. <!-- LOGO预览弹窗 -->
  356. <el-dialog v-model="logoPreviewVisible" title="LOGO预览">
  357. <img style="width: 100%;" :src="logoPreviewUrl" alt="LOGO Preview" />
  358. </el-dialog>
  359. <!-- 货号选择弹窗 -->
  360. <GoodsSelectDialog
  361. v-model:visible="goodsSelectDialogVisible"
  362. @confirm="handleGoodsSelectionConfirm"
  363. @cancel="handleGoodsSelectionCancel"
  364. />
  365. </div>
  366. </template>
  367. <script lang="ts" setup>
  368. import { getCompanyTemplatesApi } from '@/apis/other'
  369. import tokenInfo from '@/stores/modules/token';
  370. import { useRoute, useRouter } from 'vue-router'
  371. import { clickLog, setLogInfo } from '@/utils/log'
  372. import { ElMessage, ElMessageBox } from 'element-plus'
  373. import BlueHeaderBar from '@/components/header-bar/blue-header.vue'
  374. import { ref, computed, reactive, onMounted, onBeforeUnmount, nextTick, watch } from 'vue';
  375. import { Select, EditPen, ZoomIn, Delete, Picture, Document } from '@element-plus/icons-vue'
  376. // import upload from '@/components/upload' // 不再需要,改为单LOGO上传
  377. import client from "@/stores/modules/client";
  378. import icpList from '@/utils/ipc'
  379. import useUserInfo from "@/stores/modules/user";
  380. const clientStore = client();
  381. import { getRouterUrl } from '@/utils/appfun'
  382. import { useUuidStore } from '@/stores/modules/uuid'
  383. import socket from "@/stores/modules/socket";
  384. const socketStore = socket();
  385. const useUserInfoStore = useUserInfo();
  386. import GoodsSelectDialog from './components/GoodsSelectDialog.vue'
  387. import SceneCard from './components/SceneCard.vue'
  388. import ModelCard from './components/ModelCard.vue'
  389. import { Close, Warning } from '@element-plus/icons-vue'
  390. import LoadingDialog from '@/views/Photography/components/LoadingDialog.vue'
  391. import configInfo from "@/stores/modules/config";
  392. import { deleteCustomerTemplate , downlaodCustomerTemplate} from '@/apis/other'
  393. import { ossResize } from '@/utils/oss'
  394. const useConfigInfoStore = configInfo();
  395. const EXTERNAL_TOOL_EXECUTABLE = '智慧映拍照机辅助工具箱.exe'
  396. import usePhotography from './mixin/usePhotography'
  397. // 从 mixin 中导入必要的函数和状态(已不再使用,保留以防其他地方需要)
  398. const { } = usePhotography()
  399. const launchExternalTool = async (pagePath: string, successMessage: string) => {
  400. if (!clientStore?.ipc || !clientStore.isClient) {
  401. ElMessage.error('当前环境暂不支持外部工具');
  402. return;
  403. }
  404. if (!pagePath) return;
  405. const tokenStore = tokenInfo();
  406. const token = tokenStore?.getToken || '';
  407. const env = (useConfigInfoStore?.appConfig as any)?.env || 'prod';
  408. const argString = `token=${token}&page=${pagePath}&env=${env}`;
  409. try {
  410. const result = await clientStore.ipc.invoke(icpList.utils.runExternalTool, {
  411. exeName: EXTERNAL_TOOL_EXECUTABLE,
  412. args: [argString]
  413. });
  414. if (result?.code === 0) {
  415. ElMessage.success(successMessage);
  416. } else {
  417. throw new Error(result?.msg || '启动外部工具失败');
  418. }
  419. } catch (error: any) {
  420. console.error('launchExternalTool error:', error);
  421. ElMessage.error(error?.message || '打开外部工具失败');
  422. }
  423. }
  424. const handleWhiteBgExportClick = () => launchExternalTool('/copy_800_tool', '白底图批量导出工具已启动')
  425. const handleWhiteBgUploadClick = () => launchExternalTool('/upload_800_tool', '白底图批量上传工具已启动')
  426. const handleProductAlbumClick = () => launchExternalTool('/product_list', '产品图册生成工具已启动')
  427. // 货号选择弹窗相关状态
  428. const goodsSelectDialogVisible = ref(false)
  429. const addCustomTemplate = () => {
  430. goodsSelectDialogVisible.value = true
  431. }
  432. // 处理货号选择确认
  433. const handleGoodsSelectionConfirm = (selectedGoodsArtNo: string) => {
  434. console.log('选中的货号:', selectedGoodsArtNo)
  435. // 跳转到新增模板页(组件内部已经处理了数据存储到 sessionStorage)
  436. router.push({
  437. name: 'addTpl'
  438. })
  439. }
  440. // 处理货号选择取消
  441. const handleGoodsSelectionCancel = () => {
  442. // 取消选择,不做任何操作
  443. }
  444. import { useCheckInfo } from '@/composables/userCheck';
  445. useCheckInfo();
  446. const showTips = ref(true)
  447. const folderPath = ref('') //货号文件夹
  448. // const reportMode = ref('normal') // 抠图模式
  449. const imageOrder = ref('俯视、侧视、后跟、鞋底、内里、组合、组合2、组合3') // 图片顺序
  450. const checkSimilar = ref(false) // 同款检验
  451. const specificPage = ref('') // 可指定页面独修改
  452. // 路由和状态管理初始化
  453. const route = useRoute();
  454. const router = useRouter();
  455. const uuidStore = useUuidStore();
  456. // 完成目录
  457. const completeDirectory = ref('')
  458. const loadingDialogVisible = ref(false)
  459. const progress = ref(0)
  460. const message = ref('正在为您处理,请稍后')
  461. const disabledButton = ref(true)
  462. // 新的进度条相关数据
  463. const useNewProgress = ref(false)
  464. const progressSteps = ref<Array<{
  465. msg_type: string
  466. goods_art_no: string
  467. name: string
  468. status: '等待处理' | '正在处理' | '处理完成' | '处理失败'
  469. current: number
  470. total: number
  471. error: number
  472. }>>([])
  473. // 删除自定义模板
  474. const deleteTemplate = async (template: any) => {
  475. if (!template?.id) return
  476. try {
  477. await ElMessageBox.confirm(
  478. `确定要删除自定义模板「${template.template_name || ''}」吗?`,
  479. '提示',
  480. {
  481. confirmButtonText: '确定',
  482. cancelButtonText: '取消',
  483. type: 'warning',
  484. },
  485. )
  486. const res = await deleteCustomerTemplate({ id: template.id })
  487. const data = res
  488. if (data?.code === 0) {
  489. ElMessage.success('删除成功')
  490. // 从当前模板列表中移除
  491. const idx = templates.value.findIndex((item: any) => item.id === template.id)
  492. if (idx !== -1) {
  493. templates.value.splice(idx, 1)
  494. }
  495. } else {
  496. ElMessage.error(data?.msg || '删除失败')
  497. }
  498. } catch (e: any) {
  499. if (e !== 'cancel' && e !== 'close') {
  500. console.error('删除模板失败:', e)
  501. ElMessage.error(e?.message || '删除失败')
  502. }
  503. }
  504. }
  505. const downloadTplExcel = async (template: any) => {
  506. await downlaodCustomerTemplate({ id: template.id , filename: template.template_name})
  507. // console.log('downlaodCustomerTemplate', data)
  508. }
  509. // 更新进度步骤
  510. const updateProgressStep = (msgType: string, stepData: any) => {
  511. console.log('updateProgressStep called:', msgType, stepData)
  512. const stepIndex = progressSteps.value.findIndex(step => step.msg_type === msgType)
  513. if (stepIndex !== -1) {
  514. // 更新现有步骤 - 使用新数组来确保响应式更新
  515. const newSteps = [...progressSteps.value]
  516. newSteps[stepIndex] = {
  517. ...newSteps[stepIndex],
  518. name: stepData.name, // 保持原有名称或使用新名称
  519. goods_art_no: stepData.goods_art_no,
  520. status: stepData.status,
  521. current: stepData.current || 0,
  522. total: stepData.total || 0,
  523. error: stepData.error || 0,
  524. folder: newSteps[stepIndex].folder || stepData.folder // 保持已有的folder或使用新的
  525. }
  526. progressSteps.value = newSteps
  527. console.log('Updated step:', newSteps[stepIndex])
  528. } else {
  529. // 添加新步骤
  530. progressSteps.value = [...progressSteps.value, {
  531. msg_type: msgType,
  532. name: stepData.name,
  533. goods_art_no: stepData.goods_art_no,
  534. status: stepData.status,
  535. current: stepData.current || 0,
  536. total: stepData.total || 0,
  537. error: stepData.error || 0,
  538. folder: stepData.folder // 添加folder字段
  539. }]
  540. console.log('Added new step:', progressSteps.value[progressSteps.value.length - 1])
  541. }
  542. }
  543. // 获取步骤名称
  544. // 初始化进度步骤 - 从后端数据动态获取
  545. const initProgressSteps = (backendSteps?: any[]) => {
  546. if (backendSteps && backendSteps.length > 0) {
  547. // 使用后端返回的步骤数据
  548. progressSteps.value = backendSteps.map(step => ({
  549. msg_type: step.msg_type,
  550. goods_art_no: step.goods_art_no,
  551. name: step.name,
  552. status: '等待处理',
  553. current: 0,
  554. total: step.total || 0,
  555. error: 0
  556. }))
  557. } else {
  558. // 默认步骤(当后端没有返回步骤数据时使用)
  559. progressSteps.value = []
  560. }
  561. }
  562. // 进度消息队列
  563. const progressMessages = ref<Array<{
  564. goods_no: string
  565. temp_name: string
  566. status: string
  567. goods_art_nos: string[]
  568. msg: string
  569. timestamp: number
  570. }>>([])
  571. const showMessageHistory = ref(true)
  572. const messageListRef = ref<HTMLElement | null>(null)
  573. // 新消息时自动滚动到底部
  574. const scrollMessageListToBottom = () => {
  575. nextTick(() => {
  576. const el = messageListRef.value
  577. if (el) {
  578. el.scrollTop = el.scrollHeight
  579. }
  580. })
  581. }
  582. let templates = ref([])
  583. // let goods_art_nos = ref([])
  584. let partErrList = ref([])
  585. const excel_template_url = ref('')
  586. // 是否正在请求接口
  587. const requesting = ref(false)
  588. const goods_art_nos = computed(() => {
  589. const goods_art_data = route.query.goods_art_nos
  590. return Array.isArray(goods_art_data) ? goods_art_data : [goods_art_data]
  591. })
  592. // 定义一个定时器变量
  593. const INTERVAL = ref<number | NodeJS.Timeout | null>(null);
  594. // 状态变量
  595. const totalPage = ref(0);
  596. const itemsPerPage = 3; // 每页显示的模板数量
  597. const dialogVisible = ref(false);
  598. const dialogImageUrl = ref('');
  599. const queryParams = reactive({ // 分页查询参数
  600. size: 1,
  601. current: 1,
  602. })
  603. const form = reactive({
  604. selectTemplate: {}, //选中的模板
  605. dataType: '1', // 1: 选择excel文件 2: 系统对接
  606. logo_path: '', // 主图LOGO
  607. excel_path: '', // 商品基础资料EXCEL文件选择
  608. services: ['is_detail'], // 勾选服务内容(多选)默认包含详情页生成
  609. })
  610. const excelFileName = computed(() => {
  611. if (!form.excel_path) return ''
  612. const segments = form.excel_path.split(/[/\\]/)
  613. return segments[segments.length - 1] || ''
  614. })
  615. const templatesLoaded = ref(false)
  616. const lastSelectedTemplateId = ref<string | number | null>(null)
  617. const isDetailServiceSelected = computed(() => form.services.includes('is_detail'))
  618. const isSceneOn = computed(() => form.services.includes('is_product_scene'))
  619. const isModelOn = computed(() => form.services.includes('is_upper_footer'))
  620. const tplScrollRef = ref<HTMLElement | null>(null)
  621. function setService(key: string, on: boolean) {
  622. const idx = form.services.indexOf(key)
  623. if (on && idx === -1) form.services.push(key)
  624. if (!on && idx > -1) form.services.splice(idx, 1)
  625. saveServicesToCache(form.services)
  626. }
  627. function onSwChange(key: string, e: Event) {
  628. const target = e.target as HTMLInputElement
  629. setService(key, !!target?.checked)
  630. }
  631. function setDataType(type: string) {
  632. form.dataType = type
  633. saveDataTypeToCache(type)
  634. }
  635. function scrollTemplates(dir: number) {
  636. const el = tplScrollRef.value
  637. if (!el) return
  638. el.scrollBy({ left: el.clientWidth * 0.9 * dir, behavior: 'smooth' })
  639. }
  640. const hasTemplates = computed(() => templates.value.length > 0)
  641. const canUsePublishSection = computed(() => isDetailServiceSelected.value && hasTemplates.value)
  642. onMounted(() => {
  643. // 页面访问埋点
  644. const goods_art_data = route.query.goods_art_nos
  645. goods_art_nos.value = Array.isArray(goods_art_data) ? goods_art_data : [goods_art_data]
  646. getCompanyTemplates()
  647. getLogolist()
  648. loadDetailCache()
  649. // 初始化目录打开状态标记
  650. window.segmentFolderOpened = false;
  651. window.modelOrSceneFolderOpened = false;
  652. // 监听子组件发出的打开目录事件
  653. window.addEventListener('openFolder', handleOpenFolder);
  654. })
  655. // 页面卸载时清理监听器
  656. onBeforeUnmount(() => {
  657. clientStore.ipc.removeAllListeners(icpList.socket.message + '_detail_progress');
  658. clientStore.ipc.removeAllListeners(icpList.socket.message + '_segment_progress');
  659. clientStore.ipc.removeAllListeners(icpList.socket.message + '_upper_footer_progress');
  660. clientStore.ipc.removeAllListeners(icpList.socket.message + '_scene_progress');
  661. clientStore.ipc.removeAllListeners(icpList.socket.message + '_upload_goods_progress');
  662. clientStore.ipc.removeAllListeners(icpList.socket.message + '_detail_result_progress');
  663. clearInterval(INTERVAL.value);
  664. // 移除事件监听器
  665. window.removeEventListener('openFolder', handleOpenFolder);
  666. })
  667. // 计算属性,获取当前页可见的模板
  668. const visibleTemplates = computed(() => {
  669. const startIndex = (queryParams.current - 1) * itemsPerPage;
  670. const data = templates.value.slice(startIndex, startIndex + itemsPerPage);
  671. return data
  672. });
  673. const selectTemplate = (template: any, options: { saveCache?: boolean; ensureVisible?: boolean } = {}) => {
  674. if (!isDetailServiceSelected.value) return
  675. if (!template || !template.id) return
  676. form.selectTemplate = template
  677. lastSelectedTemplateId.value = template.id
  678. if (options.ensureVisible) {
  679. jumpToTemplatePageById(template.id)
  680. }
  681. const shouldSaveCache = options.saveCache !== undefined ? options.saveCache : true
  682. if (shouldSaveCache) {
  683. try {
  684. localStorage.setItem(DETAIL_TEMPLATE_CACHE_KEY, JSON.stringify(template))
  685. console.log('selectTemplate - saved to cache:', template);
  686. } catch { }
  687. }
  688. };
  689. const handleTemplateItemClick = (template: any) => {
  690. if (!isDetailServiceSelected.value) return
  691. selectTemplate(template)
  692. };
  693. const clearTemplateSelection = () => {
  694. form.selectTemplate = {}
  695. };
  696. const findTemplateById = (templateId: string | number | null) => {
  697. if (templateId === null || templateId === undefined) return null
  698. return templates.value.find(template => String(template.id) === String(templateId)) || null
  699. };
  700. const jumpToTemplatePageById = (templateId: string | number | null) => {
  701. if (templateId === null || templateId === undefined) return
  702. const index = templates.value.findIndex(template => String(template.id) === String(templateId))
  703. if (index === -1) return
  704. const targetPage = Math.floor(index / itemsPerPage) + 1
  705. if (queryParams.current !== targetPage) {
  706. queryParams.current = targetPage
  707. }
  708. };
  709. const ensureDefaultTemplateSelection = (options: { ensureVisible?: boolean } = {}) => {
  710. if (!templatesLoaded.value || !isDetailServiceSelected.value || !templates.value.length) {
  711. return
  712. }
  713. if (form.selectTemplate && (form.selectTemplate as any).id) {
  714. if (options.ensureVisible) {
  715. jumpToTemplatePageById((form.selectTemplate as any).id)
  716. }
  717. return
  718. }
  719. const cachedTemplate = findTemplateById(lastSelectedTemplateId.value)
  720. const templateToSelect = cachedTemplate || templates.value[0]
  721. if (templateToSelect) {
  722. selectTemplate(templateToSelect, {
  723. ensureVisible: options.ensureVisible,
  724. saveCache: !cachedTemplate
  725. })
  726. }
  727. };
  728. watch(isDetailServiceSelected, (selected) => {
  729. if (selected) {
  730. ensureDefaultTemplateSelection({ ensureVisible: true })
  731. } else {
  732. clearTemplateSelection()
  733. }
  734. });
  735. // 获取模板展示图(优先 template_preview_image,其次 template_cover_image)
  736. const getTemplateDisplayImage = (template: any) => {
  737. if (!template) return ''
  738. return template.template_preview_image || template.template_cover_image || ''
  739. }
  740. const getTemplateThumbImage = (template: any) => {
  741. const url = getTemplateDisplayImage(template)
  742. if (!url || /^(data:|blob:|file:)/i.test(url)) return url
  743. return ossResize(url, { m: 'lfit', w: 400 })
  744. }
  745. // 查看模板详情
  746. const viewTemplate = (template) => {
  747. // 展示大图,优先 template_preview_image,其次 template_cover_image
  748. dialogVisible.value = true
  749. dialogImageUrl.value = getTemplateDisplayImage(template)
  750. };
  751. // 编辑自定义模版
  752. const editTemplate = async (template: any) => {
  753. if (!template) return
  754. // 将画布 JSON、名称、商品图片等信息通过 sessionStorage 传给编辑页
  755. // const customerTemplateJson = template.template_local_classes|| []
  756. const resp = await fetch(template.template_local_classes)
  757. const json = await resp.json()
  758. const customerTemplateJson = json
  759. const customerTemplateImages = template.customer_template_images || []
  760. const templateImageOrder = template.template_image_order || ''
  761. const templateName = template.template_name || ''
  762. // 将商品文字的 keys 转换为完整的对象结构
  763. const templateExcelHeaders = template.customer_template_excel_headers || []
  764. const defaultGoodsTextFallback = []
  765. const fullTemplateExcelHeaders = template.template_excel_headers || ''
  766. // 使用sessionStorage传递数据,避免URL长度限制
  767. const templateData = {
  768. customer_template_json: customerTemplateJson,
  769. template_name: templateName,
  770. customer_template_images: customerTemplateImages,
  771. template_image_order: templateImageOrder,
  772. template_excel_headers: fullTemplateExcelHeaders, // 传递完整的商品文字数据
  773. timestamp: Date.now() // 添加时间戳用于标识数据
  774. }
  775. sessionStorage.setItem('editTpl_template_data', JSON.stringify(templateData))
  776. router.push({
  777. name: 'editTpl',
  778. params: { id: template.id }
  779. })
  780. };
  781. // 获取模版列表
  782. const getCompanyTemplates = async () => {
  783. const { data } = await getCompanyTemplatesApi()
  784. console.log('getCompanyTemplatesApi', data);
  785. templates.value = data.list || []
  786. // 获取电商平台列表 - 支持新的数据结构
  787. if (data.online_store_temp_list) {
  788. onlineStoreTempList.value = data.online_store_temp_list
  789. }
  790. if (data.online_store_temp_list_foreign) {
  791. onlineStoreTempListForeign.value = data.online_store_temp_list_foreign
  792. }
  793. templatesLoaded.value = true
  794. // 获取模板列表后,尝试从缓存恢复模板选择
  795. loadTemplateFromCache()
  796. excel_template_url.value = data.excel_template_url
  797. // 计算总页数
  798. totalPage.value = Math.ceil(templates.value.length / itemsPerPage);
  799. }
  800. const downloadExcel = () => {
  801. const a = document.createElement('a')
  802. a.href = excel_template_url.value,
  803. a.download = '商品基础资料模版'
  804. document.body.appendChild(a)
  805. a.click()
  806. setTimeout(() => {
  807. document.body.removeChild(a);
  808. }, 1000);
  809. }
  810. // 服务内容切换
  811. const toggleService = (key: string) => {
  812. const idx = form.services.indexOf(key)
  813. if (idx > -1) form.services.splice(idx, 1)
  814. else form.services.push(key)
  815. // 保存服务选择状态到缓存
  816. saveServicesToCache(form.services)
  817. }
  818. // 电商平台多选与一键上架
  819. const domesticPlatforms = ref<string[]>([])
  820. const foreignPlatforms = ref<string[]>([])
  821. const onlineStoreTempList = ref<any[]>([]) // 国内电商平台列表
  822. const onlineStoreTempListForeign = ref<any[]>([]) // 国外电商平台列表
  823. // 模特与场景弹窗
  824. const modelDialogVisible = ref(false)
  825. const modelDialogDefaultTab = ref<'female' | 'male'>('female')
  826. const scenePromptDialogVisible = ref(false)
  827. const selectedModels = ref<{ female: any; male: any; child?: any } | null>({ female: null, male: null, child: null })
  828. const scenePrompt = ref('')
  829. const sceneBgPrompt = ref('')
  830. const sceneImage = ref('')
  831. const sceneMode = ref<'text' | 'upload'>('text')
  832. const DEFAULT_BG_SCENE_PROMPT = '把鞋子融合到背景图中'
  833. // 本地缓存键(与弹窗组件保持一致)
  834. const DETAIL_MODEL_CACHE_KEY = 'model_selection_cache'
  835. const DETAIL_SCENE_PROMPT_CACHE_KEY = 'scene_prompt_cache'
  836. const DETAIL_SCENE_BG_PROMPT_CACHE_KEY = 'scene_bg_prompt_cache'
  837. const DETAIL_SCENE_IMAGE_CACHE_KEY = 'scene_image_cache'
  838. const detail_logo_cache_1_KEY = 'detail_logo_cache_1'
  839. const DETAIL_DATA_TYPE_CACHE_KEY = 'detail_data_type_cache'
  840. const DETAIL_SERVICES_CACHE_KEY = 'detail_services_cache'
  841. const DETAIL_TEMPLATE_CACHE_KEY = 'detail_template_cache'
  842. // 读取本地缓存
  843. const loadDetailCache = () => {
  844. console.log('loadDetailCache');
  845. try {
  846. const m = localStorage.getItem(DETAIL_MODEL_CACHE_KEY)
  847. if (m) {
  848. const parsed = JSON.parse(m)
  849. if (parsed && (parsed.female || parsed.male || parsed.child)) {
  850. selectedModels.value = parsed
  851. console.log('loadDetailCache');
  852. console.log(selectedModels.value);
  853. }
  854. }
  855. } catch { }
  856. try {
  857. const p = localStorage.getItem(DETAIL_SCENE_PROMPT_CACHE_KEY)
  858. if (p) {
  859. console.log('scenePrompt');
  860. scenePrompt.value = p
  861. console.log(scenePrompt.value);
  862. }
  863. } catch { }
  864. try {
  865. const img = localStorage.getItem(DETAIL_SCENE_IMAGE_CACHE_KEY)
  866. if (img) sceneImage.value = img
  867. } catch { }
  868. try {
  869. const bg = localStorage.getItem(DETAIL_SCENE_BG_PROMPT_CACHE_KEY)
  870. if (bg) sceneBgPrompt.value = bg
  871. } catch { }
  872. // 加载LOGO缓存
  873. try {
  874. const logo = localStorage.getItem(detail_logo_cache_1_KEY)
  875. if (logo) {
  876. form.logo_path = logo || ''
  877. console.log(form.logo_path);
  878. console.log('loadDetailCache - logo:', logo);
  879. }
  880. } catch { }
  881. // 加载数据类型缓存
  882. try {
  883. const dataType = localStorage.getItem(DETAIL_DATA_TYPE_CACHE_KEY)
  884. if (dataType) {
  885. form.dataType = dataType
  886. console.log('loadDetailCache - dataType:', dataType);
  887. }
  888. } catch { }
  889. // 模板缓存加载将在获取模板列表后执行
  890. // 加载服务选择状态缓存
  891. try {
  892. const services = localStorage.getItem(DETAIL_SERVICES_CACHE_KEY)
  893. if (services) {
  894. const parsed = JSON.parse(services)
  895. if (Array.isArray(parsed)) {
  896. form.services = parsed
  897. console.log('loadDetailCache - services:', parsed);
  898. }
  899. }
  900. } catch { }
  901. }
  902. // 保存到本地缓存(仅保存必要字段)
  903. const saveModelsToCache = (models: { female: any; male: any }) => {
  904. try {
  905. const payload = {
  906. female: models?.female ? {
  907. id: models.female.id,
  908. name: models.female.name,
  909. image_url: models.female.image_url,
  910. gender: models.female.gender,
  911. keywords: models.female.keywords,
  912. status: models.female.status
  913. } : null,
  914. male: models?.male ? {
  915. id: models.male.id,
  916. name: models.male.name,
  917. image_url: models.male.image_url,
  918. gender: models.male.gender,
  919. keywords: models.male.keywords,
  920. status: models.male.status
  921. } : null,
  922. child: models?.child ? {
  923. id: models.child.id,
  924. name: models.child.name,
  925. image_url: models.child.image_url,
  926. gender: models.child.gender,
  927. keywords: models.child.keywords,
  928. status: models.child.status
  929. } : null
  930. }
  931. localStorage.setItem(DETAIL_MODEL_CACHE_KEY, JSON.stringify(payload))
  932. } catch { }
  933. }
  934. const saveScenePromptToCache = (prompt: string) => {
  935. try {
  936. const v = (prompt || '').trim()
  937. if (v) localStorage.setItem(DETAIL_SCENE_PROMPT_CACHE_KEY, v)
  938. } catch { }
  939. }
  940. const saveSceneImageToCache = (url: string) => {
  941. try {
  942. if (url) localStorage.setItem(DETAIL_SCENE_IMAGE_CACHE_KEY, url)
  943. else localStorage.removeItem(DETAIL_SCENE_IMAGE_CACHE_KEY)
  944. } catch { }
  945. }
  946. const saveSceneBgPromptToCache = (prompt: string) => {
  947. try {
  948. localStorage.setItem(DETAIL_SCENE_BG_PROMPT_CACHE_KEY, prompt || '')
  949. } catch { }
  950. }
  951. // 保存LOGO到缓存
  952. const saveLogoToCache = (logoPath: string) => {
  953. try {
  954. localStorage.setItem(detail_logo_cache_1_KEY, logoPath)
  955. } catch { }
  956. }
  957. // 保存数据类型到缓存
  958. const saveDataTypeToCache = (dataType: string) => {
  959. try {
  960. if (dataType) {
  961. localStorage.setItem(DETAIL_DATA_TYPE_CACHE_KEY, dataType)
  962. console.log('saveDataTypeToCache:', dataType);
  963. }
  964. } catch { }
  965. }
  966. const saveServicesToCache = (services: string[]) => {
  967. try {
  968. localStorage.setItem(DETAIL_SERVICES_CACHE_KEY, JSON.stringify(services))
  969. console.log('saveServicesToCache:', services);
  970. } catch { }
  971. }
  972. watch(scenePrompt, (v) => {
  973. saveScenePromptToCache(v)
  974. })
  975. watch(sceneImage, (v) => {
  976. saveSceneImageToCache(v)
  977. })
  978. watch(sceneBgPrompt, (v) => {
  979. saveSceneBgPromptToCache(v)
  980. })
  981. watch(selectedModels, (v) => {
  982. if (v) saveModelsToCache(v)
  983. }, { deep: true })
  984. // 从缓存加载模板选择
  985. const loadTemplateFromCache = () => {
  986. lastSelectedTemplateId.value = null
  987. try {
  988. const template = localStorage.getItem(DETAIL_TEMPLATE_CACHE_KEY)
  989. if (template) {
  990. const parsed = JSON.parse(template)
  991. if (parsed && parsed.id) {
  992. lastSelectedTemplateId.value = parsed.id
  993. console.log('loadTemplateFromCache - template id:', parsed.id);
  994. }
  995. }
  996. } catch (error) {
  997. console.error('加载模板缓存失败:', error);
  998. }
  999. ensureDefaultTemplateSelection({ ensureVisible: true })
  1000. }
  1001. // HLM用户判断
  1002. const isHLM = computed(() => useUserInfoStore.isHLM)
  1003. const openModelDialog = (eventOrDefaultTab?: MouseEvent | 'female' | 'male') => {
  1004. modelDialogVisible.value = true
  1005. let defaultTab: 'female' | 'male' | undefined
  1006. if (typeof eventOrDefaultTab === 'string') {
  1007. defaultTab = eventOrDefaultTab
  1008. }
  1009. if (defaultTab) {
  1010. // 传递给子组件的默认标签页
  1011. modelDialogDefaultTab.value = defaultTab
  1012. } else {
  1013. // 重置为默认值
  1014. modelDialogDefaultTab.value = 'female'
  1015. }
  1016. }
  1017. const openScenePromptDialog = () => {
  1018. scenePromptDialogVisible.value = true
  1019. }
  1020. // 选择LOGO
  1021. // selectLogo 函数已移除,现在只支持单个LOGO上传
  1022. const handleModelSelection = (models: { female: any; male: any }) => {
  1023. selectedModels.value = models
  1024. saveModelsToCache(models)
  1025. modelDialogVisible.value = false
  1026. // ElMessage.success('模特选择完成!')
  1027. }
  1028. const handleScenePromptConfirm = (prompt: string) => {
  1029. scenePrompt.value = prompt
  1030. saveScenePromptToCache(prompt)
  1031. }
  1032. const onCurrentChange = (page) => {
  1033. queryParams.current = page;
  1034. };
  1035. const onSizeChange = (data) => {
  1036. };
  1037. // 格式化时间
  1038. const formatTime = (timestamp: number) => {
  1039. const date = new Date(timestamp)
  1040. return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`
  1041. }
  1042. // 处理进度消息
  1043. const handleProgressMessage = (data: any) => {
  1044. console.log("detail_progress", data);
  1045. if (data.code === 0 && data.msg_type === 'detail_progress') {
  1046. const messageData = {
  1047. goods_no: data.data.goods_no,
  1048. temp_name: data.data.temp_name,
  1049. status: data.data.status,
  1050. goods_art_nos: data.data.goods_art_nos,
  1051. msg: data.msg,
  1052. timestamp: Date.now()
  1053. }
  1054. progressMessages.value.push(messageData)
  1055. // 更新当前显示的消息
  1056. message.value = data.data.goods_art_nos ? `货号${data.data.goods_art_nos.join(', ')}:${data.msg}` : `${data.msg}`
  1057. scrollMessageListToBottom()
  1058. // 更新新的进度条
  1059. if (data.progress) {
  1060. updateProgressStep('detail_progress', data.progress)
  1061. }
  1062. }
  1063. }
  1064. // 处理抠图进度消息
  1065. const handleSegmentProgressMessage = (data: any) => {
  1066. console.log("segment_progress", data);
  1067. if (data.code === 0 && data.msg_type === 'segment_progress') {
  1068. const messageData = {
  1069. goods_no: '',
  1070. temp_name: '',
  1071. status: data.data?.status || '',
  1072. goods_art_nos: data.data?.goods_art_nos || [],
  1073. msg: data.msg,
  1074. timestamp: Date.now()
  1075. }
  1076. progressMessages.value.push(messageData)
  1077. // 更新当前显示的消息
  1078. message.value = data.data.goods_art_nos ? `货号${data.data.goods_art_nos.join(', ')}:${data.msg}` : `${data.msg}`
  1079. scrollMessageListToBottom()
  1080. // 更新新的进度条
  1081. if (data.progress) {
  1082. if (['处理完成', '处理失败'].includes(progressSteps.value[0]?.status)) {
  1083. return;
  1084. }
  1085. updateProgressStep('segment_progress', data.progress)
  1086. if (data.progress?.folder && !window.segmentFolderOpened) {
  1087. window.segmentFolderOpened = true;
  1088. openOutputDir(data.progress?.folder)
  1089. }
  1090. }
  1091. }
  1092. }
  1093. // 处理上脚图进度
  1094. const handleUpperFooterProgressMessage = (data: any) => {
  1095. console.log("upper_footer_progress", data);
  1096. if (data.code === 0 && data.msg_type === 'upper_footer_progress') {
  1097. const messageData = {
  1098. goods_no: '',
  1099. temp_name: '',
  1100. status: data.data?.status || '',
  1101. goods_art_nos: data.data?.goods_art_nos || [],
  1102. msg: data.msg,
  1103. timestamp: Date.now()
  1104. }
  1105. progressMessages.value.push(messageData)
  1106. message.value = data.data.goods_art_nos ? `货号${data.data.goods_art_nos.join(', ')}:${data.msg}` : `${data.msg}`
  1107. scrollMessageListToBottom()
  1108. // 更新新的进度条
  1109. if (data.progress) {
  1110. updateProgressStep('upper_footer_progress', data.progress)
  1111. // 如果是处理完成状态且目录还未打开,则打开目录
  1112. if (data.progress?.folder && !window.modelOrSceneFolderOpened) {
  1113. window.modelOrSceneFolderOpened = true;
  1114. openOutputDir(data.progress?.folder)
  1115. }
  1116. }
  1117. }
  1118. }
  1119. // 处理场景图进度
  1120. const handleSceneProgressMessage = (data: any) => {
  1121. console.log("scene_progress", data);
  1122. if (data.code === 0 && data.msg_type === 'scene_progress') {
  1123. const messageData = {
  1124. goods_no: '',
  1125. temp_name: '',
  1126. status: data.data?.status || '',
  1127. goods_art_nos: data.data?.goods_art_nos || [],
  1128. msg: data.msg,
  1129. timestamp: Date.now()
  1130. }
  1131. progressMessages.value.push(messageData)
  1132. message.value = data.data.goods_art_nos ? `货号${data.data.goods_art_nos.join(', ')}:${data.msg}` : `${data.msg}`
  1133. scrollMessageListToBottom()
  1134. // 更新新的进度条
  1135. if (data.progress) {
  1136. updateProgressStep('scene_progress', data.progress)
  1137. // 如果是处理完成状态且目录还未打开,则打开目录
  1138. if (data.progress?.folder && !window.modelOrSceneFolderOpened) {
  1139. window.modelOrSceneFolderOpened = true;
  1140. openOutputDir(data.progress?.folder)
  1141. }
  1142. }
  1143. }
  1144. }
  1145. // 处理商品上传进度
  1146. const handleUploadGoodsProgressMessage = (data: any) => {
  1147. console.log("upload_goods_progress", data);
  1148. if (data.code === 0 && data.msg_type === 'upload_goods_progress') {
  1149. const messageData = {
  1150. goods_no: '',
  1151. temp_name: '',
  1152. status: data.data?.status || '',
  1153. goods_art_nos: data.data?.goods_art_nos || [],
  1154. msg: data.msg,
  1155. timestamp: Date.now()
  1156. }
  1157. progressMessages.value.push(messageData)
  1158. message.value = data.data.goods_art_nos ? `货号${data.data.goods_art_nos.join(', ')}:${data.msg}` : `${data.msg}`
  1159. scrollMessageListToBottom()
  1160. // 更新新的进度条
  1161. if (data.progress) {
  1162. updateProgressStep('upload_goods_progress', data.progress)
  1163. }
  1164. }
  1165. }
  1166. // 打开输出目录:appConfig.appPath + '/build/extraResources/py/output'
  1167. const openOutputDir = (path) => {
  1168. try {
  1169. let fullPath = ''
  1170. if (path) {
  1171. fullPath = path
  1172. } else {
  1173. const appPath = useConfigInfoStore?.appConfig?.appPath || ''
  1174. if (!appPath) {
  1175. ElMessage.error('未获取到应用目录 appPath')
  1176. return
  1177. }
  1178. fullPath = `${pyPath}\\output`
  1179. }
  1180. clientStore.ipc.removeAllListeners(icpList.utils.shellFun);
  1181. clientStore.ipc.send(icpList.utils.shellFun, {
  1182. action: 'openPath',
  1183. params: fullPath.replace(/\//g, '\\')
  1184. });
  1185. } catch (e) {
  1186. console.error(e)
  1187. ElMessage.error('打开目录失败')
  1188. }
  1189. }
  1190. function buildSceneSubmitParams() {
  1191. if (sceneMode.value === 'upload') {
  1192. return {
  1193. product_scene_image: sceneImage.value || '',
  1194. product_scene_prompt: (sceneBgPrompt.value || '').trim() || DEFAULT_BG_SCENE_PROMPT,
  1195. }
  1196. }
  1197. return {
  1198. product_scene_prompt: scenePrompt.value || '',
  1199. }
  1200. }
  1201. // 检测参数是否有效
  1202. const checkParams = async function () {
  1203. const useConfigInfoStore = configInfo();
  1204. const tokenInfoStore = tokenInfo();
  1205. const token = tokenInfoStore.getToken;
  1206. let temp_list = []
  1207. templates.value.map(item => {
  1208. temp_list.push({
  1209. template_id: item.template_id,
  1210. template_local_classes: item.template_local_classes,
  1211. template_type: item.template_type,
  1212. })
  1213. })
  1214. // 根据选择的服务内容设置参数
  1215. const isDetail = form.services.includes('is_detail') ? 1 : 0
  1216. const isProductScene = form.services.includes('is_product_scene') ? 1 : 0
  1217. const isUpperFooter = form.services.includes('is_upper_footer') ? 1 : 0
  1218. const params = {
  1219. goods_art_no: JSON.parse(JSON.stringify(goods_art_nos.value)),
  1220. logo_path: form.logo_path || '',
  1221. temp_name: form.selectTemplate?.template_id || '',
  1222. excel_path: (isDetail && form.dataType == '1') ? (form.excel_path || '') : '',
  1223. template_image_order: form.selectTemplate?.template_image_order,
  1224. temp_list,
  1225. token,
  1226. uuid: uuidStore.getUuid || '',
  1227. // 新增服务参数 - 合并国内和国外平台
  1228. online_stores: [...(domesticPlatforms.value || []), ...(foreignPlatforms.value || [])],
  1229. is_detail: isDetail,
  1230. is_product_scene: isProductScene,
  1231. is_upper_footer: isUpperFooter,
  1232. upper_footer_params: selectedModels.value ? {
  1233. man_id: selectedModels.value.male?.id || "",
  1234. women_id: selectedModels.value.female?.id || "",
  1235. child_id: selectedModels.value.child?.id || ""
  1236. } : {},
  1237. ...buildSceneSubmitParams(),
  1238. is_check: 1 // 仅检测,不生成
  1239. }
  1240. try {
  1241. // 直接调用API进行检测,因为检测模式会直接返回结果
  1242. const response = await clientStore.ipc.invoke(icpList.generate.generatePhotoDetail, params);
  1243. console.log('=======checkParamscheckParamscheckParamscheckParams===========');
  1244. console.log(params);
  1245. console.log(response);
  1246. if (response.code === 0) {
  1247. return response;
  1248. } else {
  1249. throw new Error(response.msg || '检测失败');
  1250. }
  1251. } catch (error) {
  1252. throw new Error(error.message || '检测失败');
  1253. }
  1254. }
  1255. // 开始生成操作
  1256. const generate = async function () {
  1257. if (requesting.value) {
  1258. return
  1259. }
  1260. // 重置目录打开状态
  1261. window.segmentFolderOpened = false;
  1262. window.modelOrSceneFolderOpened = false;
  1263. if (form.services.length == 0) {
  1264. ElMessage.error('请选择服务内容')
  1265. return
  1266. }
  1267. // 必填验证
  1268. if (form.services.includes('is_upper_footer')) {
  1269. const hasMale = selectedModels.value?.male?.id
  1270. const hasFemale = selectedModels.value?.female?.id
  1271. if (!hasMale && !hasFemale) {
  1272. ElMessage.error('请选择男模特和女模特')
  1273. return
  1274. } else if (!hasMale) {
  1275. ElMessage.error('请选择男模特')
  1276. return
  1277. } else if (!hasFemale) {
  1278. ElMessage.error('请选择女模特')
  1279. return
  1280. }
  1281. }
  1282. if (form.services.includes('is_product_scene')) {
  1283. if (sceneMode.value === 'upload') {
  1284. if (!sceneImage.value) {
  1285. ElMessage.error('请上传或选择背景图')
  1286. return
  1287. }
  1288. } else if (!(scenePrompt.value || '').trim()) {
  1289. ElMessage.error('请填写场景描述')
  1290. return
  1291. }
  1292. }
  1293. if (form.services.includes('is_detail') && form.dataType == '1' && !form.excel_path) {
  1294. ElMessage.error('请上传商品基础资料')
  1295. return
  1296. }
  1297. // 埋点:开始生成详情页
  1298. clickLog({
  1299. describe: {
  1300. action: '点击开始生成详情页',
  1301. services: form.services,
  1302. dataType: form.dataType,
  1303. template_name: form.selectTemplate?.template_name,
  1304. goods_count: goods_art_nos.value.length,
  1305. goods_art_nos: goods_art_nos.value
  1306. }
  1307. }, route);
  1308. // 先进行检测
  1309. let checkResult;
  1310. try {
  1311. requesting.value = true
  1312. // ElMessage.info('正在检测参数,请稍候...');
  1313. checkResult = await checkParams();
  1314. // ElMessage.success('检测通过,开始生成...');
  1315. } catch (error) {
  1316. ElMessage.error(error.message || '检测失败,请检查参数');
  1317. requesting.value = false
  1318. return;
  1319. }
  1320. const useConfigInfoStore = configInfo();
  1321. console.log(useConfigInfoStore.appConfig);
  1322. const tokenInfoStore = tokenInfo();
  1323. const token = tokenInfoStore.getToken; // 使用 getToken() 获取 token
  1324. let temp_list = []
  1325. templates.value.map(item => {
  1326. temp_list.push({
  1327. template_id: item.template_id,
  1328. template_local_classes: item.template_local_classes,
  1329. template_type: item.template_type,
  1330. })
  1331. })
  1332. // 根据选择的服务内容设置参数
  1333. const isDetail = form.services.includes('is_detail') ? 1 : 0
  1334. const isProductScene = form.services.includes('is_product_scene') ? 1 : 0
  1335. const isUpperFooter = form.services.includes('is_upper_footer') ? 1 : 0
  1336. const params = {
  1337. goods_art_no: JSON.parse(JSON.stringify(goods_art_nos.value)),
  1338. logo_path: form.logo_path || '',
  1339. temp_name: form.selectTemplate?.template_id || '',
  1340. excel_path: (isDetail && form.dataType == '1') ? (form.excel_path || '') : '',
  1341. template_image_order: form.selectTemplate?.template_image_order,
  1342. temp_list,
  1343. token,
  1344. uuid: uuidStore.getUuid || '',
  1345. // 新增服务参数 - 合并国内和国外平台
  1346. online_stores: [...(domesticPlatforms.value || []), ...(foreignPlatforms.value || [])],
  1347. is_detail: isDetail,
  1348. is_product_scene: isProductScene,
  1349. is_upper_footer: isUpperFooter,
  1350. upper_footer_params: selectedModels.value ? {
  1351. man_id: selectedModels.value.male?.id || "",
  1352. women_id: selectedModels.value.female?.id || "",
  1353. child_id: selectedModels.value.child?.id || ""
  1354. } : {},
  1355. ...buildSceneSubmitParams(),
  1356. is_check: 0 // 正式生成
  1357. }
  1358. // 开启进度弹窗
  1359. requesting.value = true
  1360. partErrList.value = []
  1361. message.value = '正在为您处理,请稍后'
  1362. progress.value = 0
  1363. // 清空之前的进度消息
  1364. progressMessages.value = []
  1365. showMessageHistory.value = true
  1366. // 启用新的进度条并初始化步骤
  1367. useNewProgress.value = true
  1368. // 清空之前的进度步骤
  1369. progressSteps.value = []
  1370. // 从检测结果中获取步骤信息
  1371. const backendSteps = checkResult?.data?.progress || []
  1372. initProgressSteps(backendSteps)
  1373. openLoadingDialog(goods_art_nos.value.length * 10)
  1374. clientStore.ipc.removeAllListeners(icpList.socket.message + '_detail_result_progress');
  1375. clientStore.ipc.send(icpList.generate.generatePhotoDetail, params);
  1376. /*
  1377. * detail_result_progress
  1378. *
  1379. * */
  1380. // 监听进度消息
  1381. clientStore.ipc.removeAllListeners(icpList.socket.message + '_detail_progress');
  1382. clientStore.ipc.on(icpList.socket.message + '_detail_progress', (event, data) => {
  1383. console.log('_detail_progress', data);
  1384. handleProgressMessage(data)
  1385. });
  1386. // 监听抠图进度消息
  1387. clientStore.ipc.removeAllListeners(icpList.socket.message + '_segment_progress');
  1388. clientStore.ipc.on(icpList.socket.message + '_segment_progress', (event, data) => {
  1389. console.log('_segment_progress', data);
  1390. handleSegmentProgressMessage(data)
  1391. });
  1392. // 监听上脚图进度消息
  1393. clientStore.ipc.removeAllListeners(icpList.socket.message + '_upper_footer_progress');
  1394. clientStore.ipc.on(icpList.socket.message + '_upper_footer_progress', (event, data) => {
  1395. console.log('_upper_footer_progress', data);
  1396. handleUpperFooterProgressMessage(data)
  1397. });
  1398. // 监听场景图进度消息
  1399. clientStore.ipc.removeAllListeners(icpList.socket.message + '_scene_progress');
  1400. clientStore.ipc.on(icpList.socket.message + '_scene_progress', (event, data) => {
  1401. console.log('_scene_progress', data);
  1402. handleSceneProgressMessage(data)
  1403. });
  1404. // 监听商品上传进度消息
  1405. clientStore.ipc.removeAllListeners(icpList.socket.message + '_upload_goods_progress');
  1406. clientStore.ipc.on(icpList.socket.message + '_upload_goods_progress', (event, data) => {
  1407. console.log('_upload_goods_progress', data);
  1408. handleUploadGoodsProgressMessage(data)
  1409. });
  1410. clientStore.ipc.on(icpList.socket.message + '_detail_result_progress', (event, result) => {
  1411. if (result.code !== 0) {
  1412. if (result.msg) {
  1413. handleFail(result.msg)
  1414. message.value = 'result.msg'
  1415. }
  1416. progress.value = 0
  1417. loadingDialogVisible.value = false
  1418. requesting.value = false
  1419. return;
  1420. }
  1421. console.log('result', result)
  1422. requesting.value = true
  1423. setTimeout(() => {
  1424. clientStore.ipc.removeAllListeners(icpList.socket.message + '_detail_result_progress');
  1425. clientStore.ipc.removeAllListeners(icpList.socket.message + '_detail_progress');
  1426. clientStore.ipc.removeAllListeners(icpList.socket.message + '_segment_progress');
  1427. clientStore.ipc.removeAllListeners(icpList.socket.message + '_upper_footer_progress');
  1428. clientStore.ipc.removeAllListeners(icpList.socket.message + '_scene_progress');
  1429. clientStore.ipc.removeAllListeners(icpList.socket.message + '_upload_goods_progress');
  1430. }, 100)
  1431. clearInterval(INTERVAL.value)
  1432. if (result.code === 0) {
  1433. const { output_folder, list } = result.data
  1434. const allSuccess = list.every(item => item.success);
  1435. const allFailure = list.every(item => !item.success);
  1436. if (allSuccess) {
  1437. console.log("全部成功")
  1438. handleSuccess(output_folder, '全部生成成功')
  1439. } else if (allFailure) {
  1440. console.log("全部失败");
  1441. handleFailure(list)
  1442. } else {
  1443. console.log("部分成功,部分失败");
  1444. handlePartSuccess(output_folder, list)
  1445. }
  1446. } else {
  1447. console.log('code全部生成失败')
  1448. handleFail(result.msg)
  1449. }
  1450. //生成失败 (接口请求失败)
  1451. function handleFail(errorMsg: string) {
  1452. // loadingDialogVisible.value = false
  1453. // disabledButton.value = false
  1454. if (errorMsg) {
  1455. ElMessage.error(errorMsg)
  1456. }
  1457. requesting.value = false // 重置请求状态,允许再次生成
  1458. // 处理完成后停止监听进度消息
  1459. // clientStore.ipc.removeAllListeners(icpList.socket.message + '_detail_progress');
  1460. // clientStore.ipc.removeAllListeners(icpList.socket.message + '_segment_progress');
  1461. }
  1462. // 全部生成成功
  1463. function handleSuccess(href, loadingMsg) {
  1464. // 埋点:生成完成
  1465. setLogInfo(route, { action: '生成完成', output_folder: href, message: loadingMsg });
  1466. completeDirectory.value = href
  1467. progress.value = 100
  1468. disabledButton.value = false
  1469. message.value = loadingMsg
  1470. requesting.value = false // 重置请求状态,允许再次生成
  1471. // handleComplete()
  1472. }
  1473. // 部分成功
  1474. function handlePartSuccess(output_folder: string, partSuccessList) {
  1475. let errorList = []
  1476. partSuccessList.map(item => {
  1477. if (!item.success) {
  1478. errorList.push(item)
  1479. }
  1480. })
  1481. partErrList.value = errorList
  1482. handleSuccess(output_folder, '部分货号生成失败')
  1483. }
  1484. // 全部生成失败
  1485. function handleFailure(partSuccessList) {
  1486. // 埋点:生成失败(携带货号)
  1487. const failedGoods = (partSuccessList || []).map(item => item.goods_art_no).filter(Boolean)
  1488. setLogInfo(route, { action: '生成失败', error_count: partSuccessList.length, goods_art_nos: goods_art_nos.value, failed_goods_art_nos: failedGoods });
  1489. let errorList = []
  1490. partSuccessList.map(item => {
  1491. if (!item.success) {
  1492. errorList.push(item)
  1493. }
  1494. })
  1495. partErrList.value = errorList
  1496. completeDirectory.value = ''
  1497. progress.value = 100
  1498. disabledButton.value = true
  1499. message.value = '全部货号生成失败'
  1500. requesting.value = false // 重置请求状态,允许再次生成
  1501. }
  1502. requesting.value = false
  1503. });
  1504. }
  1505. const openLoadingDialog = (timer: number) => {
  1506. loadingDialogVisible.value = true
  1507. disabledButton.value = true
  1508. // 根据传入的秒数计算每次增加的进度值
  1509. const step = 100 / timer
  1510. INTERVAL.value = setInterval(() => {
  1511. if (progress.value < 50) {
  1512. progress.value = Math.min(progress.value + step, 100)
  1513. } else if (progress.value < 70) {
  1514. progress.value = Math.min(progress.value + step / 2, 100)
  1515. } if (progress.value < 85) {
  1516. progress.value = Math.min(progress.value + step / 5, 100)
  1517. } else if (progress.value < 90) {
  1518. progress.value = Math.min(progress.value + step / 10, 100)
  1519. } else if (progress.value < 95) {
  1520. progress.value = Math.min(progress.value + step / 50, 100)// 新增中间阶段
  1521. } else {
  1522. progress.value = Math.min(progress.value + step / 100, 100)
  1523. }
  1524. }, 1000)
  1525. }
  1526. //logo
  1527. const logoList = ref([])
  1528. const logoLoadError = ref(false)
  1529. const logoPreviewVisible = ref(false)
  1530. const logoPreviewUrl = ref('')
  1531. // 打开LOGO上传
  1532. const handleLogoSelected = (path?: string) => {
  1533. if (!path) return
  1534. form.logo_path = path
  1535. logoLoadError.value = false
  1536. saveLogoToCache(form.logo_path)
  1537. }
  1538. const openLogoUpload = () => {
  1539. clientStore.ipc.removeAllListeners(icpList.utils.openImage);
  1540. clientStore.ipc.send(icpList.utils.openImage);
  1541. clientStore.ipc.on(icpList.utils.openImage, async (event, result) => {
  1542. if (result && result.filePath) {
  1543. handleLogoSelected(result.filePath)
  1544. }
  1545. clientStore.ipc.removeAllListeners(icpList.utils.openImage);
  1546. })
  1547. }
  1548. // 预览LOGO
  1549. const previewLogo = () => {
  1550. if (form.logo_path) {
  1551. logoPreviewUrl.value = 'file:///' + form.logo_path
  1552. logoPreviewVisible.value = true
  1553. }
  1554. }
  1555. // 删除LOGO
  1556. const removeLogo = () => {
  1557. if (form.logo_path) {
  1558. saveLogoToCache('')
  1559. form.logo_path = ''
  1560. /* const currentLogoPath = form.logo_path
  1561. clientStore.ipc.send(icpList.generate.deleteLogo, {
  1562. path: currentLogoPath
  1563. });
  1564. clientStore.ipc.on(icpList.generate.deleteLogo, async (event, result) => {
  1565. console.log('deleteLogo', result);
  1566. form.logo_path = ''
  1567. saveLogoToCache('')
  1568. logoLoadError.value = false
  1569. // 从列表中移除
  1570. const index = logoList.value.indexOf(currentLogoPath)
  1571. if (index > -1) {
  1572. logoList.value.splice(index, 1)
  1573. }
  1574. clientStore.ipc.removeAllListeners(icpList.generate.deleteLogo);
  1575. })*/
  1576. }
  1577. }
  1578. const handleLogoLoadError = () => {
  1579. if (!form.logo_path) return
  1580. if (!logoLoadError.value) {
  1581. logoLoadError.value = true
  1582. form.logo_path = ''
  1583. saveLogoToCache('')
  1584. ElMessage.warning('LOGO加载出错或文件已被删除,请重新上传')
  1585. }
  1586. }
  1587. const getLogolist = async () => {
  1588. clientStore.ipc.send(icpList.generate.getLogoList);
  1589. clientStore.ipc.on(icpList.generate.getLogoList, async (event, result) => {
  1590. // 保持数组格式,兼容老的格式
  1591. logoList.value = result.data || []
  1592. console.log('getLogoList', result.data)
  1593. // 只使用第一个LOGO(如果存在且当前没有选择)
  1594. if (logoList.value.length && !form.logo_path) {
  1595. form.logo_path = logoList.value[0]
  1596. logoLoadError.value = false
  1597. // 保存默认LOGO到缓存
  1598. saveLogoToCache(form.logo_path)
  1599. }
  1600. clientStore.ipc.removeAllListeners(icpList.generate.getLogoList);
  1601. })
  1602. }
  1603. function clearExcel() {
  1604. form.excel_path = ''
  1605. }
  1606. function selectExcel() {
  1607. clientStore.ipc.removeAllListeners(icpList.utils.openFile);
  1608. clientStore.ipc.send(icpList.utils.openFile, {
  1609. filters: [
  1610. { name: '支持xls,xlsx', extensions: ['xlsx', 'xls'] }
  1611. ],
  1612. title: "选择基础文件资料"
  1613. });
  1614. clientStore.ipc.on(icpList.utils.openFile, async (event, result) => {
  1615. form.excel_path = result
  1616. clientStore.ipc.removeAllListeners(icpList.utils.openFile);
  1617. })
  1618. }
  1619. const Router = useRouter()
  1620. //打开主图详情
  1621. function openPhotographySeniorDetail() {
  1622. const { href } = Router.resolve({
  1623. name: 'PhotographySeniorDetail'
  1624. })
  1625. clientStore.ipc.removeAllListeners(icpList.utils.openMain);
  1626. let params = {
  1627. title: '详情高级配置',
  1628. width: 1000,
  1629. height: 630,
  1630. frame: true,
  1631. id: "PhotographySeniorDetail",
  1632. url: getRouterUrl(href)
  1633. }
  1634. clientStore.ipc.send(icpList.utils.openMain, params);
  1635. }
  1636. // 处理打开目录事件
  1637. const handleOpenFolder = (event) => {
  1638. const { folder } = event.detail;
  1639. if (folder) {
  1640. openOutputDir(folder);
  1641. }
  1642. }
  1643. const handleComplete = () => {
  1644. // loadingDialogVisible.value = false
  1645. // 这里可以添加打开目录的逻辑
  1646. if (!completeDirectory.value) {
  1647. openOutputDir()
  1648. return
  1649. }
  1650. clientStore.ipc.removeAllListeners(icpList.utils.shellFun);
  1651. let params = {
  1652. action: 'openPath',
  1653. params: completeDirectory.value?.replace(/\//g, '\\')
  1654. }
  1655. clientStore.ipc.send(icpList.utils.shellFun, params);
  1656. }
  1657. const selectFolder = () => {
  1658. clientStore.ipc.removeAllListeners(icpList.utils.openDirectory);
  1659. clientStore.ipc.send(icpList.utils.openDirectory);
  1660. clientStore.ipc.on(icpList.utils.openDirectory, async (event, result) => {
  1661. folderPath.value = result
  1662. clientStore.ipc.removeAllListeners(icpList.utils.openDirectory);
  1663. })
  1664. }
  1665. </script>
  1666. <style lang="scss" scoped>
  1667. // 服务标签页样式
  1668. .aigc-sprite {
  1669. position: absolute;
  1670. width: 0;
  1671. height: 0;
  1672. overflow: hidden;
  1673. }
  1674. .detail-page {
  1675. height: calc(100vh - 50px);
  1676. overflow: auto;
  1677. background: #F2F5FA;
  1678. display: flex;
  1679. flex-direction: column;
  1680. }
  1681. .aigc-wrap {
  1682. max-width: 1780px;
  1683. width: 100%;
  1684. min-width: 1420px;
  1685. margin: 0 auto;
  1686. padding: 16px 20px 22px;
  1687. box-sizing: border-box;
  1688. flex: 1;
  1689. min-height: 0;
  1690. display: flex;
  1691. flex-direction: column;
  1692. }
  1693. .aigc-board {
  1694. display: grid;
  1695. grid-template-columns: minmax(320px, 0.85fr) minmax(320px, 0.85fr) minmax(400px, 1.5fr) 330px;
  1696. grid-template-rows: minmax(0, 1fr);
  1697. gap: 14px;
  1698. align-items: stretch;
  1699. flex: 1;
  1700. min-height: 0;
  1701. min-width: 1420px;
  1702. }
  1703. .fcard {
  1704. grid-row: 1;
  1705. background: #fff;
  1706. border: 1px solid #e7ebf4;
  1707. border-radius: 16px;
  1708. box-shadow: 0 1px 2px rgba(23, 43, 99, 0.04), 0 10px 30px rgba(23, 43, 99, 0.06);
  1709. display: flex;
  1710. flex-direction: column;
  1711. overflow: hidden;
  1712. min-width: 320px;
  1713. min-height: 0;
  1714. height: 100%;
  1715. max-height: 100%;
  1716. }
  1717. .fcard-wide { min-width: 400px; }
  1718. .fhead {
  1719. display: block;
  1720. padding: 11px 16px 9px;
  1721. border-bottom: 1px solid #e7ebf4;
  1722. text-align: left;
  1723. }
  1724. .fh-row {
  1725. display: flex;
  1726. align-items: flex-start;
  1727. justify-content: flex-start;
  1728. gap: 10px;
  1729. flex-wrap: nowrap;
  1730. text-align: left;
  1731. }
  1732. .fh-text {
  1733. min-width: 0;
  1734. flex: 1;
  1735. display: flex;
  1736. flex-direction: column;
  1737. align-items: flex-start;
  1738. text-align: left;
  1739. }
  1740. .fico {
  1741. flex: none;
  1742. width: 38px;
  1743. height: 38px;
  1744. border-radius: 11px;
  1745. display: grid;
  1746. place-items: center;
  1747. background: linear-gradient(135deg, #eef2ff, #e3e9ff);
  1748. color: #3d63f2;
  1749. svg { width: 20px; height: 20px; display: block; }
  1750. }
  1751. .fh-t {
  1752. font-size: 20px;
  1753. font-weight: 800;
  1754. letter-spacing: 0.3px;
  1755. line-height: 1.25;
  1756. color: #1a2233;
  1757. white-space: nowrap;
  1758. text-align: left;
  1759. align-self: flex-start;
  1760. }
  1761. .fh-s {
  1762. font-size: 12.5px;
  1763. color: #8b95ab;
  1764. margin-top: 4px;
  1765. text-align: left;
  1766. align-self: flex-start;
  1767. white-space: normal;
  1768. overflow: visible;
  1769. line-height: 1.4;
  1770. max-width: 100%;
  1771. }
  1772. .toggle {
  1773. margin-left: auto;
  1774. align-self: flex-start;
  1775. flex: none;
  1776. display: flex;
  1777. flex-direction: column;
  1778. align-items: flex-end;
  1779. gap: 4px;
  1780. .swl {
  1781. font-size: 12px;
  1782. font-weight: 600;
  1783. color: #8b95ab;
  1784. min-width: 0;
  1785. text-align: right;
  1786. line-height: 1;
  1787. }
  1788. }
  1789. .sw {
  1790. position: relative;
  1791. display: inline-block;
  1792. width: 46px;
  1793. height: 25px;
  1794. flex: none;
  1795. input {
  1796. position: absolute;
  1797. inset: 0;
  1798. opacity: 0;
  1799. margin: 0;
  1800. cursor: pointer;
  1801. z-index: 2;
  1802. }
  1803. i {
  1804. position: absolute;
  1805. inset: 0;
  1806. border-radius: 13px;
  1807. background: #cbd3e3;
  1808. transition: background 0.18s;
  1809. &::after {
  1810. content: "";
  1811. position: absolute;
  1812. top: 3px;
  1813. left: 3px;
  1814. width: 19px;
  1815. height: 19px;
  1816. border-radius: 50%;
  1817. background: #fff;
  1818. box-shadow: 0 1px 3px rgba(10, 25, 70, 0.3);
  1819. transition: transform 0.18s;
  1820. }
  1821. }
  1822. input:checked + i {
  1823. background: linear-gradient(100deg, #3e7bfa, #7a5af8);
  1824. }
  1825. input:checked + i::after {
  1826. transform: translateX(21px);
  1827. }
  1828. }
  1829. .fbody {
  1830. position: relative;
  1831. padding: 14px 16px 12px;
  1832. display: flex;
  1833. flex-direction: column;
  1834. gap: 12px;
  1835. flex: 1;
  1836. min-width: 0;
  1837. min-height: 0;
  1838. overflow: hidden;
  1839. > :deep(.model-card),
  1840. > :deep(.scene-card) {
  1841. flex: 1 1 0;
  1842. min-height: 0;
  1843. }
  1844. }
  1845. .ffoot {
  1846. margin-top: auto;
  1847. padding: 9px 16px;
  1848. border-top: 1px dashed #d9dfec;
  1849. color: #8b95ab;
  1850. font-size: 13px;
  1851. display: flex;
  1852. gap: 7px;
  1853. align-items: flex-start;
  1854. justify-content: flex-start;
  1855. text-align: left;
  1856. line-height: 1.5;
  1857. .ic {
  1858. flex: none;
  1859. width: 14px;
  1860. height: 14px;
  1861. transform: translateY(1px);
  1862. display: block;
  1863. }
  1864. }
  1865. .ffoot--tip {
  1866. :deep(.el-tooltip__trigger),
  1867. :deep(.el-only-child__content) {
  1868. display: flex !important;
  1869. width: 100%;
  1870. justify-content: flex-start;
  1871. text-align: left;
  1872. }
  1873. }
  1874. .ffoot-inner {
  1875. display: flex;
  1876. gap: 7px;
  1877. align-items: flex-start;
  1878. justify-content: flex-start;
  1879. min-width: 0;
  1880. width: 100%;
  1881. cursor: help;
  1882. text-align: left;
  1883. }
  1884. .ffoot-copy {
  1885. min-width: 0;
  1886. flex: 1;
  1887. text-align: left;
  1888. }
  1889. .off .ffoot {
  1890. opacity: 0.38;
  1891. pointer-events: none;
  1892. filter: saturate(0.5);
  1893. }
  1894. .off .ffoot--tip {
  1895. pointer-events: auto;
  1896. }
  1897. .off .fbody {
  1898. pointer-events: none;
  1899. }
  1900. .off .fbody::after {
  1901. content: "";
  1902. position: absolute;
  1903. inset: 0;
  1904. background: rgba(255, 255, 255, 0.62);
  1905. z-index: 5;
  1906. }
  1907. .off .fbody :deep(.hbtns) {
  1908. position: relative;
  1909. z-index: 6;
  1910. pointer-events: auto;
  1911. }
  1912. .tabs-row {
  1913. display: flex;
  1914. align-items: flex-end;
  1915. gap: 12px;
  1916. border-bottom: 1.5px solid #e7ebf4;
  1917. }
  1918. .tabs-row-tools {
  1919. justify-content: flex-end;
  1920. border-bottom: 0;
  1921. padding-bottom: 0;
  1922. .hbtns { padding-bottom: 0; }
  1923. }
  1924. .tabs {
  1925. display: flex;
  1926. gap: 16px;
  1927. flex: 1;
  1928. min-width: 0;
  1929. }
  1930. .tab {
  1931. background: none;
  1932. border: 0;
  1933. padding: 2px 1px 10px;
  1934. font-size: 14px;
  1935. font-weight: 700;
  1936. color: #46516a;
  1937. position: relative;
  1938. white-space: nowrap;
  1939. &.on {
  1940. color: #3d63f2;
  1941. &::after {
  1942. content: "";
  1943. position: absolute;
  1944. left: 0;
  1945. right: 0;
  1946. bottom: -1.5px;
  1947. height: 3px;
  1948. border-radius: 3px;
  1949. background: linear-gradient(100deg, #3e7bfa, #7a5af8);
  1950. }
  1951. }
  1952. }
  1953. .hbtns { display: flex; gap: 6px; flex: none; padding-bottom: 7px; }
  1954. .hbtn {
  1955. width: 27px;
  1956. height: 27px;
  1957. border-radius: 50%;
  1958. border: 1.5px solid #d9dfec;
  1959. background: #fff;
  1960. color: #46516a;
  1961. cursor: pointer;
  1962. display: grid;
  1963. place-items: center;
  1964. padding: 0;
  1965. svg { width: 13px; height: 13px; display: block; }
  1966. &:hover {
  1967. border-color: #3d63f2;
  1968. color: #3d63f2;
  1969. background: #f5f8ff;
  1970. }
  1971. }
  1972. .tpl-hscroll {
  1973. display: grid;
  1974. grid-auto-flow: column;
  1975. grid-template-rows: minmax(0, 1fr);
  1976. grid-auto-columns: calc(50% - 20px);
  1977. gap: 11px;
  1978. overflow-x: auto;
  1979. overflow-y: hidden;
  1980. scroll-snap-type: x mandatory;
  1981. padding-bottom: 2px;
  1982. scrollbar-width: none;
  1983. flex: 1;
  1984. min-height: 0;
  1985. &::-webkit-scrollbar { display: none; }
  1986. > * { scroll-snap-align: start; min-width: 0; }
  1987. }
  1988. .tpl {
  1989. position: relative;
  1990. border: 1.5px solid #d9dfec;
  1991. border-radius: 13px;
  1992. overflow: hidden;
  1993. cursor: pointer;
  1994. background: #fff;
  1995. display: flex;
  1996. flex-direction: column;
  1997. height: 100%;
  1998. min-height: 0;
  1999. max-height: 100%;
  2000. margin: 0;
  2001. transition: all 0.15s;
  2002. &:hover {
  2003. box-shadow: 0 10px 22px rgba(23, 43, 99, 0.14);
  2004. }
  2005. &.sel {
  2006. border: 2px solid #3d63f2;
  2007. box-shadow: 0 8px 22px rgba(61, 99, 242, 0.2);
  2008. }
  2009. .ck {
  2010. position: absolute;
  2011. top: 6px;
  2012. right: 6px;
  2013. width: 21px;
  2014. height: 21px;
  2015. border-radius: 50%;
  2016. background: #3d63f2;
  2017. color: #fff;
  2018. font-size: 12px;
  2019. display: grid;
  2020. place-items: center;
  2021. box-shadow: 0 2px 6px rgba(23, 43, 99, 0.35);
  2022. z-index: 2;
  2023. }
  2024. .template-download-btn {
  2025. position: absolute;
  2026. top: 8px;
  2027. left: 8px;
  2028. z-index: 3;
  2029. color: #3d63f2;
  2030. height: 26px;
  2031. line-height: 26px;
  2032. padding: 0 8px;
  2033. border-radius: 4px;
  2034. background: rgba(255, 255, 255, 0.92);
  2035. font-size: 12px;
  2036. font-weight: 700;
  2037. }
  2038. .tpl-head {
  2039. padding: 11px 14px 8px;
  2040. background: #eef2ff;
  2041. b {
  2042. display: block;
  2043. font-size: 16px;
  2044. font-weight: 800;
  2045. line-height: 1.3;
  2046. color: #1a2233;
  2047. }
  2048. }
  2049. .tpl-img-wrap {
  2050. flex: 1;
  2051. min-height: 0;
  2052. overflow: hidden;
  2053. background: #f5f7fb;
  2054. position: relative;
  2055. }
  2056. .tpl-img {
  2057. width: 100%;
  2058. height: auto;
  2059. display: block;
  2060. :deep(.el-image__inner) {
  2061. width: 100% !important;
  2062. height: auto !important;
  2063. object-fit: cover;
  2064. object-position: top center;
  2065. display: block;
  2066. }
  2067. }
  2068. .tpl-mini {
  2069. display: flex;
  2070. align-items: center;
  2071. gap: 10px;
  2072. padding: 8px 14px 9px;
  2073. background: #eef2ff;
  2074. font-size: 12px;
  2075. .lk {
  2076. color: #3d63f2;
  2077. font-weight: 700;
  2078. cursor: pointer;
  2079. &.danger { color: #ff4c00; }
  2080. }
  2081. }
  2082. }
  2083. .template-tips {
  2084. flex: none;
  2085. display: flex;
  2086. align-items: flex-start;
  2087. justify-content: flex-start;
  2088. gap: 8px;
  2089. height: auto;
  2090. min-height: 36px;
  2091. line-height: 1.55;
  2092. padding: 8px 10px;
  2093. background: #fff6dc;
  2094. border-radius: 10px;
  2095. border: 1px solid #f1e2ac;
  2096. color: #7a5e17;
  2097. font-size: 13px;
  2098. text-align: left;
  2099. .el-icon {
  2100. flex: none;
  2101. margin-top: 2px;
  2102. }
  2103. span {
  2104. flex: 1;
  2105. min-width: 0;
  2106. white-space: normal;
  2107. word-break: break-word;
  2108. text-align: left;
  2109. }
  2110. }
  2111. .side {
  2112. display: flex;
  2113. flex-direction: column;
  2114. gap: 12px;
  2115. min-width: 330px;
  2116. min-height: 0;
  2117. overflow: auto;
  2118. }
  2119. .scard {
  2120. background: #fff;
  2121. border: 1px solid #e7ebf4;
  2122. border-radius: 14px;
  2123. box-shadow: 0 1px 2px rgba(23, 43, 99, 0.04), 0 10px 30px rgba(23, 43, 99, 0.06);
  2124. padding: 11px 15px;
  2125. text-align: left;
  2126. .stitle {
  2127. font-size: 15.5px;
  2128. font-weight: 800;
  2129. margin-bottom: 9px;
  2130. color: #1a2233;
  2131. text-align: left;
  2132. }
  2133. }
  2134. .trow {
  2135. display: flex;
  2136. align-items: center;
  2137. gap: 10px;
  2138. padding: 8px 6px;
  2139. border-radius: 9px;
  2140. cursor: pointer;
  2141. font-size: 14px;
  2142. font-weight: 700;
  2143. color: #1a2233;
  2144. & + .trow { border-top: 1px solid #e7ebf4; }
  2145. &:hover { background: #f5f7fe; }
  2146. .tic {
  2147. flex: none;
  2148. width: 30px;
  2149. height: 30px;
  2150. border-radius: 9px;
  2151. background: linear-gradient(135deg, #eef2ff, #e3e9ff);
  2152. color: #3d63f2;
  2153. display: grid;
  2154. place-items: center;
  2155. svg { width: 16px; height: 16px; display: block; }
  2156. }
  2157. .arr {
  2158. margin-left: auto;
  2159. color: #8b95ab;
  2160. width: 15px;
  2161. height: 15px;
  2162. flex: none;
  2163. }
  2164. &.disabled {
  2165. opacity: 0.55;
  2166. cursor: not-allowed;
  2167. }
  2168. }
  2169. .gbtn {
  2170. width: 100%;
  2171. height: 42px;
  2172. border-radius: 11px;
  2173. border: 1.5px solid #3d63f2;
  2174. color: #3d63f2;
  2175. background: #fff;
  2176. font-size: 14.5px;
  2177. font-weight: 800;
  2178. display: flex;
  2179. align-items: center;
  2180. justify-content: center;
  2181. gap: 8px;
  2182. cursor: pointer;
  2183. svg { width: 17px; height: 17px; display: block; }
  2184. &:hover { background: #f3f6ff; }
  2185. }
  2186. .data-mode {
  2187. display: grid;
  2188. grid-template-columns: 1fr 1fr;
  2189. gap: 8px;
  2190. padding: 4px;
  2191. background: #f3f5f6;
  2192. border-radius: 10px;
  2193. }
  2194. .data-mode-btn {
  2195. height: 34px;
  2196. border: 0;
  2197. border-radius: 8px;
  2198. background: transparent;
  2199. color: #46516a;
  2200. font-size: 13.5px;
  2201. font-weight: 700;
  2202. cursor: pointer;
  2203. &.on {
  2204. background: #fff;
  2205. color: #3d63f2;
  2206. box-shadow: 0 1px 3px rgba(23, 43, 99, 0.08);
  2207. }
  2208. }
  2209. .data-prep-link {
  2210. background: none;
  2211. border: 0;
  2212. color: #3d63f2;
  2213. font-size: 13px;
  2214. font-weight: 700;
  2215. padding: 0;
  2216. text-align: left;
  2217. cursor: pointer;
  2218. &:hover { text-decoration: underline; }
  2219. }
  2220. .sys-hint {
  2221. font-size: 13px;
  2222. color: #8b95ab;
  2223. line-height: 1.5;
  2224. text-align: left;
  2225. padding: 8px 2px 0;
  2226. }
  2227. .up {
  2228. border: 1.8px dashed #d9dfec;
  2229. border-radius: 13px;
  2230. background: #fafbfe;
  2231. display: flex;
  2232. flex-direction: column;
  2233. align-items: center;
  2234. justify-content: center;
  2235. gap: 7px;
  2236. padding: 14px 12px;
  2237. text-align: center;
  2238. cursor: pointer;
  2239. &:hover {
  2240. border-color: #3d63f2;
  2241. background: #f5f8ff;
  2242. }
  2243. .uic {
  2244. width: 40px;
  2245. height: 40px;
  2246. border-radius: 11px;
  2247. background: linear-gradient(135deg, #eef2ff, #e3e9ff);
  2248. display: grid;
  2249. place-items: center;
  2250. color: #3d63f2;
  2251. svg { width: 21px; height: 21px; display: block; }
  2252. }
  2253. .t { font-size: 14px; font-weight: 700; color: #46516a; }
  2254. .s { font-size: 12px; color: #8b95ab; }
  2255. &.is-error {
  2256. border-color: #ff4d4f;
  2257. .t, .s { color: #ff4d4f; }
  2258. }
  2259. }
  2260. .frow2 {
  2261. display: grid;
  2262. grid-template-columns: 1fr 1fr;
  2263. gap: 9px;
  2264. label {
  2265. display: block;
  2266. font-size: 13px;
  2267. font-weight: 600;
  2268. color: #46516a;
  2269. margin-bottom: 5px;
  2270. white-space: nowrap;
  2271. }
  2272. .publish-select {
  2273. width: 100%;
  2274. :deep(.el-select__tags) {
  2275. max-width: calc(100% - 32px);
  2276. padding-right: 4px;
  2277. box-sizing: border-box;
  2278. }
  2279. :deep(.el-input__inner) {
  2280. padding-right: 28px;
  2281. }
  2282. :deep(.el-input__suffix) {
  2283. z-index: 2;
  2284. }
  2285. :deep(.el-select__caret) {
  2286. position: relative;
  2287. z-index: 3;
  2288. }
  2289. }
  2290. }
  2291. .cta {
  2292. margin-top: auto;
  2293. flex: none;
  2294. position: sticky;
  2295. bottom: 0;
  2296. z-index: 2;
  2297. border: 0;
  2298. border-radius: 15px;
  2299. padding: 13px;
  2300. background: linear-gradient(100deg, #3e7bfa, #7a5af8);
  2301. color: #fff;
  2302. display: flex;
  2303. flex-direction: column;
  2304. align-items: center;
  2305. gap: 3px;
  2306. box-shadow: 0 12px 28px rgba(84, 98, 246, 0.35);
  2307. cursor: pointer;
  2308. transition: all 0.15s;
  2309. &:hover {
  2310. transform: translateY(-2px);
  2311. box-shadow: 0 16px 34px rgba(84, 98, 246, 0.42);
  2312. }
  2313. &:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
  2314. b {
  2315. font-size: 18px;
  2316. font-weight: 800;
  2317. letter-spacing: 2px;
  2318. display: flex;
  2319. align-items: center;
  2320. gap: 8px;
  2321. svg { width: 19px; height: 19px; display: block; }
  2322. }
  2323. small { font-size: 12px; opacity: 0.88; letter-spacing: 0.4px; }
  2324. }
  2325. .ybar {
  2326. flex: none;
  2327. margin-top: 14px;
  2328. background: #fff6dc;
  2329. border: 1px solid #f1e2ac;
  2330. border-radius: 12px;
  2331. padding: 10px 16px;
  2332. color: #7a5e17;
  2333. font-size: 13.5px;
  2334. display: flex;
  2335. gap: 8px;
  2336. align-items: flex-start;
  2337. line-height: 1.55;
  2338. b { color: #6b4a08; }
  2339. .ic {
  2340. flex: none;
  2341. width: 15px;
  2342. height: 15px;
  2343. transform: translateY(2px);
  2344. display: block;
  2345. }
  2346. }
  2347. .side .logo-upload-preview {
  2348. height: 110px;
  2349. }
  2350. .side .data-prep-section {
  2351. height: auto;
  2352. }
  2353. @media (max-width: 1220px) {
  2354. .detail-page { overflow: auto; }
  2355. }
  2356. .service-tabs {
  2357. display: flex;
  2358. gap: 10px;
  2359. padding: 20px;
  2360. .service-tab {
  2361. display: flex;
  2362. flex: 1;
  2363. align-items: center;
  2364. justify-content: center;
  2365. gap: 10px;
  2366. padding: 10px 20px;
  2367. border: 1px solid #e8e8e8;
  2368. border-radius: 8px;
  2369. cursor: pointer;
  2370. transition: all 0.3s;
  2371. position: relative;
  2372. background: #fff;
  2373. height: 140px;
  2374. .tab-checkbox {
  2375. margin-right: 0;
  2376. position: absolute;
  2377. left: 10px;
  2378. top: 10px;
  2379. ::v-deep {
  2380. .is-checked .el-checkbox__inner {
  2381. background: #2957FF;
  2382. border-color: #2957FF;
  2383. }
  2384. .el-checkbox__inner {
  2385. border-radius: 18px;
  2386. transform: scale(1.2);
  2387. }
  2388. }
  2389. }
  2390. .tab-img {
  2391. width: 48px;
  2392. height: 48px;
  2393. background: #EFF6FF;
  2394. border-radius: 10px;
  2395. margin: 0 auto 5px;
  2396. }
  2397. .tab-icon {
  2398. width: 24px;
  2399. height: 24px;
  2400. }
  2401. .tab-name {
  2402. font-size: 14px;
  2403. color: #333;
  2404. font-weight: 500;
  2405. }
  2406. &.external-tool {
  2407. cursor: pointer;
  2408. opacity: 1;
  2409. background: #fff;
  2410. }
  2411. .tab-edit-btn {
  2412. position: absolute;
  2413. right: 10px;
  2414. top: 10px;
  2415. width: 24px;
  2416. height: 24px;
  2417. display: flex;
  2418. align-items: center;
  2419. justify-content: center;
  2420. background: rgba(41, 87, 255, 0.1);
  2421. border-radius: 4px;
  2422. opacity: 0;
  2423. transition: opacity 0.3s;
  2424. cursor: pointer;
  2425. .el-icon {
  2426. color: #2957FF;
  2427. font-size: 16px;
  2428. }
  2429. }
  2430. &:hover {
  2431. border-color: #2957FF;
  2432. .tab-edit-btn {
  2433. opacity: 1;
  2434. }
  2435. }
  2436. &.active {
  2437. border-color: #2957FF;
  2438. border-bottom: 4px solid #2957FF;
  2439. .tab-img {
  2440. background: #2957FF;
  2441. }
  2442. }
  2443. &.disabled {
  2444. opacity: 0.8;
  2445. cursor: not-allowed;
  2446. background: #f5f5f5;
  2447. }
  2448. }
  2449. }
  2450. .detail-container {
  2451. background: #F5F6F7;
  2452. padding: 0 20px 20px 20px; // 底部留出空间给固定按钮
  2453. .detail-content {
  2454. max-width: 100%;
  2455. }
  2456. width: 100%;
  2457. min-width: 600px;
  2458. overflow: hidden;
  2459. }
  2460. .service-section {
  2461. margin-bottom: 20px;
  2462. .service-cards {
  2463. display: flex;
  2464. gap: 60px;
  2465. margin-top: 16px;
  2466. }
  2467. .service-card {
  2468. width: 240px;
  2469. height: 140px;
  2470. border-radius: 8px;
  2471. background: #fff;
  2472. border: 1px solid #e0e0e0;
  2473. display: flex;
  2474. align-items: flex-start;
  2475. padding: 12px;
  2476. cursor: pointer;
  2477. transition: all 0.3s ease;
  2478. position: relative;
  2479. &:hover {
  2480. border-color: #2957FF;
  2481. box-shadow: 0 2px 8px rgba(41, 87, 255, 0.1);
  2482. }
  2483. &.active {
  2484. border: 3px solid #2957FF;
  2485. background: #f8f9ff;
  2486. box-shadow: 0 4px 12px rgba(41, 87, 255, 0.25);
  2487. }
  2488. .service-checkbox {
  2489. position: absolute;
  2490. left: -40px;
  2491. top: 10px;
  2492. width: 30px;
  2493. transform: scale(1.5);
  2494. z-index: 10;
  2495. ::v-deep {
  2496. .el-checkbox {
  2497. display: block;
  2498. margin-right: 0;
  2499. }
  2500. .el-checkbox__input {
  2501. cursor: pointer;
  2502. }
  2503. }
  2504. }
  2505. .service-content {
  2506. flex: 1;
  2507. display: flex;
  2508. flex-direction: column;
  2509. align-items: center;
  2510. position: absolute;
  2511. left: 0;
  2512. top: 0;
  2513. right: 0;
  2514. bottom: 0;
  2515. ;
  2516. }
  2517. .service-image {
  2518. position: absolute;
  2519. width: 100%;
  2520. height: 100%;
  2521. img {
  2522. width: 100%;
  2523. height: 100%;
  2524. object-fit: cover;
  2525. border-radius: 4px;
  2526. }
  2527. .service-icon {
  2528. position: absolute;
  2529. top: 10px;
  2530. right: 10px;
  2531. width: 30px;
  2532. height: 30px;
  2533. background: #2957FF;
  2534. border-radius: 50%;
  2535. display: flex;
  2536. align-items: center;
  2537. justify-content: center;
  2538. color: white;
  2539. font-size: 18px;
  2540. }
  2541. }
  2542. .service-name {
  2543. font-size: 14px;
  2544. font-weight: 500;
  2545. text-align: center;
  2546. position: absolute;
  2547. background: rgba(0, 0, 0, .5);
  2548. height: 30px;
  2549. line-height: 30px;
  2550. color: #fff;
  2551. left: 0;
  2552. right: 0;
  2553. bottom: 0px
  2554. }
  2555. }
  2556. }
  2557. .logo-section,
  2558. .template-section,
  2559. .data-prep-section {}
  2560. .template-section {
  2561. background: #fff;
  2562. padding: 10px 20px 20px;
  2563. border-radius: 8px;
  2564. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  2565. .section-header {
  2566. display: flex;
  2567. justify-content: space-between;
  2568. align-items: center;
  2569. }
  2570. .template-tips {
  2571. height: auto;
  2572. min-height: 36px;
  2573. line-height: 1.55;
  2574. padding: 8px 10px;
  2575. background: #FFFBEA;
  2576. border-radius: 10px;
  2577. border: 1px solid #FEEEB0;
  2578. color: #9B4D26;
  2579. }
  2580. }
  2581. .template-section--disabled {
  2582. opacity: 0.8;
  2583. .template-list,
  2584. .template-pagination {
  2585. pointer-events: none;
  2586. }
  2587. }
  2588. .publish-section--disabled {
  2589. opacity: 0.6;
  2590. }
  2591. // 主布局:左右分栏
  2592. .main-layout {
  2593. display: flex;
  2594. gap: 20px;
  2595. align-items: flex-start;
  2596. .left-panel {
  2597. flex: 1;
  2598. min-width: 0;
  2599. }
  2600. .right-panel {
  2601. width: 400px;
  2602. flex-shrink: 0;
  2603. display: flex;
  2604. flex-direction: column;
  2605. gap: 20px;
  2606. }
  2607. }
  2608. .right-section {
  2609. background: #fff;
  2610. padding: 20px;
  2611. border-radius: 8px;
  2612. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  2613. &.data-prep-section {
  2614. height: 225px;
  2615. display: flex;
  2616. flex-direction: column;
  2617. box-sizing: border-box;
  2618. }
  2619. .section-title {
  2620. display: flex;
  2621. align-items: center;
  2622. gap: 10px;
  2623. font-weight: 600;
  2624. font-size: 16px;
  2625. color: #333333;
  2626. margin-bottom: 16px;
  2627. .section-title-line {
  2628. width: 3px;
  2629. height: 16px;
  2630. background: linear-gradient(135deg, #7C3AED 0%, #2957FF 100%);
  2631. border-radius: 2px;
  2632. }
  2633. .section-title-hint {
  2634. font-weight: normal;
  2635. font-size: 14px;
  2636. color: #999;
  2637. }
  2638. }
  2639. .data-prep-content {
  2640. display: flex;
  2641. flex-direction: column;
  2642. gap: 12px;
  2643. flex: 1;
  2644. .data-type-radio {
  2645. padding: 5px;
  2646. background: #F3F5F6;
  2647. border-radius: 10px;
  2648. ::v-deep {
  2649. .el-radio {
  2650. margin-right: 20px;
  2651. }
  2652. .el-radio-button {
  2653. flex: 1;
  2654. box-shadow: none !important;
  2655. .el-radio-button__inner {
  2656. width: 100%;
  2657. background: none !important;
  2658. border: none !important;
  2659. display: flex;
  2660. align-items: center;
  2661. border-radius: 10px !important;
  2662. justify-content: center;
  2663. img {
  2664. height: 14px;
  2665. margin: 0 5px;
  2666. position: relative;
  2667. top: -1px;
  2668. }
  2669. }
  2670. &.is-active {
  2671. background: #F8F9FF;
  2672. .el-radio-button__inner {
  2673. background: #fff !important;
  2674. color: #2957FF !important;
  2675. border-radius: 10px !important;
  2676. box-shadow: none !important;
  2677. }
  2678. }
  2679. }
  2680. }
  2681. }
  2682. .excel-upload-section {
  2683. display: flex;
  2684. flex-direction: column;
  2685. gap: 8px;
  2686. flex: 1;
  2687. .excel-upload-area {
  2688. width: 100%;
  2689. height: 64px;
  2690. border: 1px dashed #D9D9D9;
  2691. border-radius: 8px;
  2692. display: flex;
  2693. align-items: center;
  2694. padding: 0 16px;
  2695. cursor: pointer;
  2696. transition: all 0.3s;
  2697. background: #fff;
  2698. &:hover {
  2699. border-color: #2957FF;
  2700. background: #F8F9FF;
  2701. }
  2702. .excel-icon {
  2703. width: 32px;
  2704. height: 32px;
  2705. margin-right: 10px;
  2706. img {
  2707. width: 32px;
  2708. height: 32px;
  2709. display: block;
  2710. }
  2711. }
  2712. .excel-upload-text {
  2713. font-size: 14px;
  2714. color: #333;
  2715. font-weight: 500;
  2716. }
  2717. }
  2718. .excel-selected-info {
  2719. width: 100%;
  2720. min-height: 64px;
  2721. border: 1px solid #E5E6EB;
  2722. border-radius: 8px;
  2723. padding: 10px 12px;
  2724. background: #fff;
  2725. display: flex;
  2726. align-items: center;
  2727. gap: 10px;
  2728. box-sizing: border-box;
  2729. text-align: left;
  2730. .excel-icon {
  2731. width: 36px;
  2732. height: 36px;
  2733. flex: none;
  2734. img {
  2735. width: 36px;
  2736. height: 36px;
  2737. display: block;
  2738. }
  2739. }
  2740. .excel-file-text {
  2741. display: flex;
  2742. flex-direction: column;
  2743. align-items: flex-start;
  2744. gap: 2px;
  2745. min-width: 0;
  2746. flex: 1;
  2747. }
  2748. .excel-file-name {
  2749. font-size: 14px;
  2750. color: #1D2129;
  2751. font-weight: 500;
  2752. white-space: nowrap;
  2753. overflow: hidden;
  2754. text-overflow: ellipsis;
  2755. max-width: 100%;
  2756. text-align: left;
  2757. }
  2758. .excel-file-actions {
  2759. display: flex;
  2760. align-items: center;
  2761. gap: 8px;
  2762. }
  2763. .reupload-btn,
  2764. .delete-excel-btn {
  2765. flex-shrink: 0;
  2766. padding: 0;
  2767. height: auto;
  2768. }
  2769. }
  2770. .download-link {
  2771. color: #2957FF;
  2772. text-decoration: underline;
  2773. padding: 0;
  2774. font-size: 14px;
  2775. margin-top: 0;
  2776. justify-content: flex-start;
  2777. }
  2778. }
  2779. }
  2780. .publish-content {
  2781. display: flex;
  2782. flex-direction: column;
  2783. gap: 15px;
  2784. .publish-form-item {
  2785. display: flex;
  2786. align-items: center;
  2787. gap: 8px;
  2788. .publish-label {
  2789. font-size: 14px;
  2790. color: #333;
  2791. margin-bottom: 4px;
  2792. text-align: left;
  2793. }
  2794. .publish-select {
  2795. flex-grow: 1;
  2796. ::v-deep {
  2797. .el-input.is-disabled .el-input__inner {
  2798. background-color: #F5F6F7;
  2799. border-color: #E8E8E8;
  2800. color: #999;
  2801. }
  2802. }
  2803. }
  2804. }
  2805. }
  2806. }
  2807. .logo-template-row {
  2808. display: flex;
  2809. gap: 24px;
  2810. align-items: flex-start;
  2811. .logo-col {
  2812. flex: 2;
  2813. min-width: 300px;
  2814. }
  2815. .template-col {
  2816. flex: 3;
  2817. }
  2818. }
  2819. .logo-section {
  2820. .upload-item {
  2821. border: 2px solid rgba(0, 0, 0, 0);
  2822. }
  2823. .active {
  2824. border: 2px solid #2957FF;
  2825. border-radius: 6px;
  2826. overflow: hidden;
  2827. ;
  2828. }
  2829. &.multi-line {
  2830. flex-direction: row; // 默认横向排列
  2831. flex-wrap: wrap; // 允许换行
  2832. align-items: flex-start; // 对齐方式调整为顶部对齐
  2833. .upload-item {
  2834. margin-bottom: 10px; // 每行之间增加间距
  2835. width: 90px; // 每行显示 4 个元素,减去外边距
  2836. box-sizing: border-box; // 确保宽度计算包含 padding 和 border
  2837. }
  2838. }
  2839. }
  2840. // LOGO上传区域样式
  2841. .logo-upload-area {
  2842. width: 100%;
  2843. }
  2844. .logo-upload-placeholder {
  2845. width: 100%;
  2846. height: 160px;
  2847. border: 1px dashed #D9D9D9;
  2848. border-radius: 10px;
  2849. display: flex;
  2850. flex-direction: column;
  2851. align-items: center;
  2852. justify-content: center;
  2853. cursor: pointer;
  2854. transition: all 0.3s;
  2855. background: #fff;
  2856. &:hover {
  2857. border-color: #2957FF;
  2858. background: #F8F9FF;
  2859. }
  2860. .logo-upload-icon {
  2861. width: 42px;
  2862. height: 42px;
  2863. margin-bottom: 12px;
  2864. display: flex;
  2865. align-items: center;
  2866. justify-content: center;
  2867. background: linear-gradient(135deg, #EFF6FF 0%, #F3E8FF 100%);
  2868. border-radius: 8px;
  2869. color: #2957FF;
  2870. img {
  2871. width: 42px;
  2872. height: 42px;
  2873. }
  2874. }
  2875. .logo-upload-text {
  2876. font-size: 14px;
  2877. color: #333;
  2878. margin-bottom: 8px;
  2879. font-weight: 500;
  2880. }
  2881. .logo-upload-hint {
  2882. font-size: 12px;
  2883. color: #999;
  2884. }
  2885. &.is-error {
  2886. border-color: #FF4D4F;
  2887. background: #FFF2F0;
  2888. .logo-upload-text,
  2889. .logo-upload-hint {
  2890. color: #FF4D4F;
  2891. }
  2892. }
  2893. }
  2894. .logo-upload-preview {
  2895. width: 100%;
  2896. height: 160px;
  2897. border: 1px solid #E8E8E8;
  2898. border-radius: 8px;
  2899. position: relative;
  2900. overflow: hidden;
  2901. background: #F5F5F5;
  2902. cursor: pointer;
  2903. .logo-preview-image {
  2904. width: 100%;
  2905. height: 100%;
  2906. object-fit: contain;
  2907. }
  2908. .logo-upload-actions {
  2909. position: absolute;
  2910. bottom: 0;
  2911. left: 0;
  2912. right: 0;
  2913. height: 40px;
  2914. background: rgba(0, 0, 0, 0.5);
  2915. display: flex;
  2916. align-items: center;
  2917. justify-content: center;
  2918. gap: 20px;
  2919. opacity: 0;
  2920. transition: opacity 0.3s;
  2921. .logo-action-btn {
  2922. width: 32px;
  2923. height: 32px;
  2924. display: flex;
  2925. align-items: center;
  2926. justify-content: center;
  2927. background: rgba(255, 255, 255, 0.2);
  2928. border-radius: 4px;
  2929. cursor: pointer;
  2930. color: #fff;
  2931. transition: background 0.3s;
  2932. &:hover {
  2933. background: rgba(255, 255, 255, 0.3);
  2934. }
  2935. .el-icon {
  2936. font-size: 18px;
  2937. }
  2938. }
  2939. }
  2940. &:hover .logo-upload-actions {
  2941. opacity: 1;
  2942. }
  2943. .logo-upload-footer {
  2944. display: flex;
  2945. justify-content: flex-end;
  2946. gap: 12px;
  2947. padding: 8px 4px 0;
  2948. }
  2949. }
  2950. .logo-upload {
  2951. border: 1px dashed #ccc;
  2952. border-radius: 5px;
  2953. padding: 50px 0;
  2954. text-align: center;
  2955. cursor: pointer;
  2956. }
  2957. .template-pagination {
  2958. background: #EFF3F6;
  2959. padding: 2px 0;
  2960. border-radius: 5px;
  2961. ::v-deep {
  2962. .is-active {
  2963. background: #fff !important;
  2964. color: #2957FF !important;
  2965. font-size: 14px !important;
  2966. font-weight: normal !important;
  2967. border-radius: 2px !important;
  2968. }
  2969. .number {
  2970. margin: 0px !important;
  2971. }
  2972. .btn-prev {
  2973. display: none;
  2974. }
  2975. .btn-next {
  2976. display: none;
  2977. }
  2978. }
  2979. }
  2980. .template-pagination button {
  2981. margin-right: 5px;
  2982. }
  2983. .template-pagination span {
  2984. display: inline-block;
  2985. width: 20px;
  2986. height: 20px;
  2987. line-height: 20px;
  2988. text-align: center;
  2989. border: 1px solid #ccc;
  2990. border-radius: 5px;
  2991. margin-right: 5px;
  2992. cursor: pointer;
  2993. }
  2994. .template-list {
  2995. display: flex;
  2996. flex-wrap: wrap;
  2997. gap: 20px;
  2998. margin-top: 10px;
  2999. .template-item {
  3000. flex: 1;
  3001. max-width: 33%;
  3002. border: 1px solid #ccc;
  3003. border-radius: 10px;
  3004. cursor: pointer;
  3005. background: #f0f0f0;
  3006. position: relative;
  3007. height: 594px;
  3008. overflow: hidden;
  3009. &.active {
  3010. border-color: #1677FF;
  3011. }
  3012. .template-download-btn {
  3013. position: absolute;
  3014. top: 10px;
  3015. right: 10px;
  3016. z-index: 10;
  3017. color: #3366FF;
  3018. height: 30px;
  3019. line-height: 30px;
  3020. padding: 0 10px;
  3021. border-radius: 4px;
  3022. background: rgba(255, 255, 255, 0.9);
  3023. font-size: 14px;
  3024. cursor: pointer;
  3025. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  3026. transition: all 0.3s;
  3027. &:hover {
  3028. background: rgba(255, 255, 255, 1);
  3029. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  3030. }
  3031. }
  3032. .template-info {
  3033. position: absolute;
  3034. bottom: 0;
  3035. left: 0;
  3036. background: #fff;
  3037. width: 100%;
  3038. height: 40px;
  3039. line-height: 40px;
  3040. color: #333;
  3041. display: flex;
  3042. align-items: center;
  3043. justify-content: space-between;
  3044. .template-view {
  3045. color: #3366FF;
  3046. height: 30px;
  3047. line-height: 30px;
  3048. padding: 0 5px;
  3049. border-radius: 4px;
  3050. font-size: 14px;
  3051. }
  3052. }
  3053. }
  3054. }
  3055. .publish-section {
  3056. .label {
  3057. min-width: 120px;
  3058. margin-right: 12px;
  3059. }
  3060. }
  3061. .excel-upload {
  3062. width: 100%;
  3063. background: #F7F7F7;
  3064. padding: 20px 0;
  3065. }
  3066. .generate-button {
  3067. padding: 10px 20px;
  3068. color: white;
  3069. border: none;
  3070. border-radius: 5px;
  3071. cursor: pointer;
  3072. }
  3073. .select-button {
  3074. background: #DFE2E3 !important;
  3075. color: #3366FF !important;
  3076. height: 30px;
  3077. line-height: 30px;
  3078. padding: 0 10px;
  3079. border-radius: 4px;
  3080. margin-right: 10px;
  3081. font-size: 14px;
  3082. font-weight: 550;
  3083. }
  3084. .select-warp {
  3085. width: 18px;
  3086. height: 18px;
  3087. border-radius: 18px;
  3088. background-color: #fff;
  3089. position: absolute;
  3090. font-size: 12px;
  3091. line-height: 18px;
  3092. display: flex;
  3093. justify-content: center;
  3094. align-items: center;
  3095. top: 10px;
  3096. left: 10px;
  3097. border: 1px solid #efefef;
  3098. &.active {
  3099. background-color: #1677FF;
  3100. }
  3101. }
  3102. .section-title {
  3103. display: flex;
  3104. align-items: center;
  3105. gap: 8px;
  3106. font-weight: bold;
  3107. color: #474747;
  3108. }
  3109. .section {
  3110. margin-bottom: 24px;
  3111. .section-title {
  3112. display: flex;
  3113. align-items: center;
  3114. gap: 8px;
  3115. font-weight: bold;
  3116. margin-bottom: 16px;
  3117. color: #474747;
  3118. }
  3119. .section-content {
  3120. padding-left: 16px;
  3121. }
  3122. }
  3123. .instruction-out {
  3124. background: #EAF3FF;
  3125. border-radius: 4px;
  3126. border: 1px solid #CBE1FF;
  3127. padding: 10px 20px;
  3128. width: 80%;
  3129. position: relative;
  3130. .instruction-list {
  3131. margin: 0px 0 0 10px;
  3132. padding-left: 20px;
  3133. padding-right: 40px;
  3134. width: 100%;
  3135. li {
  3136. margin-bottom: 4px;
  3137. text-align: left;
  3138. font-size: 14px;
  3139. }
  3140. }
  3141. .close-icon {
  3142. position: absolute;
  3143. top: 12px;
  3144. right: 19px;
  3145. }
  3146. }
  3147. .form-item {
  3148. margin: 16px 0;
  3149. display: flex;
  3150. .label {
  3151. min-width: 120px;
  3152. margin-right: 12px;
  3153. }
  3154. .folder-warp {
  3155. width: 100%;
  3156. display: flex;
  3157. flex-direction: column;
  3158. .folder-input {
  3159. flex: 1;
  3160. display: flex;
  3161. align-items: center;
  3162. .check-button {
  3163. background: #DFE2E3;
  3164. border-radius: 6px;
  3165. padding: 6px 12px;
  3166. color: #2957FF;
  3167. margin-left: 20px;
  3168. }
  3169. }
  3170. }
  3171. .hint {
  3172. text-align: left;
  3173. color: #999;
  3174. margin-top: 6px;
  3175. font-size: 14px;
  3176. color: #FF4C00;
  3177. font-style: normal;
  3178. }
  3179. .specific-page-input {
  3180. flex: 1;
  3181. }
  3182. }
  3183. .image-order {
  3184. flex: 1;
  3185. display: flex;
  3186. justify-content: space-between;
  3187. align-items: center;
  3188. }
  3189. .footer {
  3190. display: flex;
  3191. z-index: 100;
  3192. .footer-button {
  3193. padding: 12px 40px;
  3194. font-size: 16px;
  3195. border-radius: 8px;
  3196. display: block;
  3197. width: 100%;
  3198. height: 50px;
  3199. img {
  3200. height: 16px;
  3201. ;
  3202. margin: 0 10px;
  3203. }
  3204. .go {
  3205. opacity: .5;
  3206. }
  3207. }
  3208. }
  3209. .explain-btn {
  3210. padding-left: 20px;
  3211. padding-right: 20px;
  3212. color: #2957FF !important;
  3213. }
  3214. .progress-messages {
  3215. margin-top: 20px;
  3216. border-top: 1px solid #e4e7ed;
  3217. padding-top: 20px;
  3218. width: 100%;
  3219. display: none;
  3220. .message-header {
  3221. display: flex;
  3222. justify-content: space-between;
  3223. align-items: center;
  3224. margin-bottom: 15px;
  3225. font-weight: 500;
  3226. color: #606266;
  3227. }
  3228. .message-list {
  3229. max-height: 200px;
  3230. overflow-y: auto;
  3231. border: 1px solid #e4e7ed;
  3232. border-radius: 4px;
  3233. padding: 10px;
  3234. background: #fafafa;
  3235. .message-item {
  3236. margin-bottom: 12px;
  3237. padding-bottom: 12px;
  3238. border-bottom: 1px solid #f0f0f0;
  3239. &:last-child {
  3240. margin-bottom: 0;
  3241. padding-bottom: 0;
  3242. border-bottom: none;
  3243. }
  3244. .message-time {
  3245. font-size: 12px;
  3246. color: #909399;
  3247. margin-bottom: 4px;
  3248. }
  3249. .message-content {
  3250. font-size: 14px;
  3251. line-height: 1.4;
  3252. .goods-no {
  3253. color: #2957FF;
  3254. font-weight: 500;
  3255. }
  3256. .message-text {
  3257. color: #606266;
  3258. }
  3259. }
  3260. }
  3261. }
  3262. }
  3263. .side .right-section.data-prep-section {
  3264. height: auto;
  3265. }
  3266. .side .right-section {
  3267. padding: 11px 15px;
  3268. }
  3269. .side .excel-selected-info {
  3270. width: 100%;
  3271. min-height: 72px;
  3272. border: 1px solid #E5E6EB;
  3273. border-radius: 8px;
  3274. padding: 10px 12px;
  3275. background: #fff;
  3276. display: flex;
  3277. flex-direction: row;
  3278. align-items: center;
  3279. gap: 12px;
  3280. box-sizing: border-box;
  3281. text-align: left;
  3282. .excel-icon {
  3283. width: 53px;
  3284. height: 53px;
  3285. flex: none;
  3286. img {
  3287. width: 53px;
  3288. height: 53px;
  3289. display: block;
  3290. object-fit: contain;
  3291. }
  3292. }
  3293. .excel-file-text {
  3294. display: flex;
  3295. flex-direction: column;
  3296. align-items: flex-start;
  3297. justify-content: center;
  3298. gap: 6px;
  3299. min-width: 0;
  3300. flex: 1;
  3301. }
  3302. .excel-file-name {
  3303. font-size: 14px;
  3304. color: #1D2129;
  3305. font-weight: 600;
  3306. white-space: nowrap;
  3307. overflow: hidden;
  3308. text-overflow: ellipsis;
  3309. max-width: 100%;
  3310. text-align: left;
  3311. line-height: 1.3;
  3312. }
  3313. .excel-file-actions {
  3314. display: flex;
  3315. flex-direction: row;
  3316. align-items: center;
  3317. gap: 10px;
  3318. }
  3319. .reupload-btn,
  3320. .delete-excel-btn {
  3321. padding: 5px !important;
  3322. height: auto;
  3323. font-size: 13px;
  3324. font-weight: 600;
  3325. :deep(span) {
  3326. font-size: 13px;
  3327. font-weight: 600;
  3328. }
  3329. }
  3330. }
  3331. </style>
  3332. <style lang="scss">
  3333. .scene-ffoot-popper {
  3334. max-width: 280px;
  3335. line-height: 1.55;
  3336. text-align: left;
  3337. }
  3338. </style>