detail.vue 100 KB

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