detail.vue 111 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520
  1. <template>
  2. <view class="page">
  3. <view class="pageDecor">
  4. <view class="pageGlow glowA" />
  5. <view class="pageGlow glowB" />
  6. <view class="pageGlow glowC" />
  7. <view class="pageGrain" />
  8. </view>
  9. <!-- 顶部留白:兼容 iOS 刘海 -->
  10. <view class="safeTop" />
  11. <!-- 品牌页头:任何状态下均显示 -->
  12. <view class="brandPageHeader">
  13. <view class="brandPageHeaderInner">
  14. <text class="brandPageHeaderName">佳友厚苑</text>
  15. <view class="brandPageHeaderDot" />
  16. <text class="brandPageHeaderLabel">官方溯源 品质可验</text>
  17. </view>
  18. </view>
  19. <!-- ===== 加载中状态 ===== -->
  20. <view v-if="!traceLoaded" class="loadingState">
  21. <text class="loadingText">溯源信息加载中…</text>
  22. </view>
  23. <!-- ===== 数据加载完成后:正常态 / 异常态 ===== -->
  24. <view v-else class="mainContent">
  25. <!-- 正常态:已发布 -->
  26. <view v-if="canShowTraceContent">
  27. <!-- Hero 首屏:商品图 + 品牌氛围 + 商品信息面板 -->
  28. <view class="hero">
  29. <view class="heroCard">
  30. <!-- Hero 视觉区:商品图 + 品牌氛围 -->
  31. <view class="heroBg">
  32. <image
  33. class="heroImage"
  34. :src="traceDetail.product?.image || traceDetail.farm?.image"
  35. mode="aspectFill"
  36. />
  37. <!-- 底部大字号水印,营造品牌氛围 -->
  38. <view class="heroBrandAnchor">
  39. <text class="heroBrandAnchorText">JIAYOU</text>
  40. </view>
  41. <!-- 光感层:多层次渐变 + 景深 + 底部暗化 -->
  42. <view class="heroMask" />
  43. </view>
  44. <!-- 商品信息面板:嵌入 Hero 底部,与 Hero 自然过渡 -->
  45. <view class="heroInfoPanel">
  46. <view class="infoPanelInner">
  47. <view class="sectionHeader">
  48. <view class="sectionHeaderLeft">
  49. <text class="sectionEn">Product</text>
  50. <text class="sectionTitle">商品信息</text>
  51. </view>
  52. <view v-if="traceDetail.batch?.statusBadge" class="trustBadge" :class="traceDetail.batch.statusBadge.type">
  53. <!-- 认证徽章 SVG:双圆环 + 对勾,图标主视觉,文字辅助 -->
  54. <svg class="trustBadgeIcon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  55. <circle cx="10" cy="10" r="9" stroke="rgba(27,71,42,0.38)" stroke-width="0.9" />
  56. <circle cx="10" cy="10" r="5.5" stroke="rgba(27,71,42,0.22)" stroke-width="0.7" />
  57. <path d="M6.6 10.4L9.1 12.9L13.8 8" stroke="rgba(27,71,42,0.8)" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round" />
  58. </svg>
  59. <text class="trustBadgeText">{{ traceDetail.batch.statusBadge.text }}</text>
  60. </view>
  61. </view>
  62. <view class="infoPanelBody">
  63. <text class="infoPanelName">{{ traceDetail.product.name }}</text>
  64. <view v-if="traceDetail.product.spec" class="infoPanelSpec">
  65. <view class="specDot" />
  66. <text class="specText">{{ traceDetail.product.spec }}</text>
  67. </view>
  68. <view v-if="traceDetail.product?.intro" class="infoPanelIntro">
  69. <text>{{ traceDetail.product.intro }}</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <scroll-view class="content" scroll-y>
  77. <!-- 溯源信息卡:融合溯源结论 + 批次核心信息 -->
  78. <view v-if="traceDetail.batch?.exists && traceDetail.traceConclusionCard" class="card cardLevel1 cardConclusion">
  79. <view class="sectionHeader">
  80. <view class="sectionHeaderLeft">
  81. <text class="sectionEn">Conclusion</text>
  82. <text class="sectionTitle">溯源信息</text>
  83. </view>
  84. </view>
  85. <!-- 溯源信息卡片主体:三层竖向结构 -->
  86. <view class="conclusionIdentity">
  87. <!-- 第一层:批次号主信息区 -->
  88. <view class="conclusionBatchWrap">
  89. <text class="conclusionBatchLabel">批次编号</text>
  90. <text class="conclusionBatchNo">{{ traceDetail.batch.no }}</text>
  91. </view>
  92. <!-- 第二层:时间摘要区 -->
  93. <view v-if="traceDetail.batch?.harvestTime || traceDetail.batch?.packTime" class="conclusionSummary">
  94. <template v-if="traceDetail.batch?.harvestTime && traceDetail.batch?.packTime">
  95. <text class="summaryLabel">生产/采收日期:</text>
  96. <text class="summaryText">{{ traceDetail.batch.harvestTime }}</text>
  97. <text class="summaryDivider">|</text>
  98. <text class="summaryLabel">包装日期:</text>
  99. <text class="summaryText">{{ traceDetail.batch.packTime }}</text>
  100. </template>
  101. <template v-else-if="traceDetail.batch?.harvestTime">
  102. <text class="summaryLabel">生产/采收日期:</text>
  103. <text class="summaryText">{{ traceDetail.batch.harvestTime }}</text>
  104. </template>
  105. <template v-else-if="traceDetail.batch?.packTime">
  106. <text class="summaryLabel">包装日期:</text>
  107. <text class="summaryText">{{ traceDetail.batch.packTime }}</text>
  108. </template>
  109. </view>
  110. <!-- 第三层:结论标签区 -->
  111. <view class="conclusionTags">
  112. <view class="conclusionTag">
  113. <text>全程可追溯</text>
  114. </view>
  115. <view class="conclusionTag">
  116. <text>已通过安全检测</text>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <!-- 农场信息(合并为单卡:图片+名称+地区+介绍连续表达) -->
  122. <view v-if="traceDetail.farm?.name" class="card cardLevel2 cardFarm">
  123. <view class="sectionHeader">
  124. <view class="sectionHeaderLeft">
  125. <text class="sectionEn">Origin</text>
  126. <text class="sectionTitle">源头农场</text>
  127. </view>
  128. </view>
  129. <!-- 农场主体:左图右文结构,融入主体内容 -->
  130. <view class="farmBody">
  131. <view class="farmImageWrap">
  132. <image class="farmImage" :src="traceDetail.farm.image" mode="aspectFill" />
  133. <view class="farmImageVignette" />
  134. </view>
  135. <view class="farmMeta">
  136. <text class="farmName">{{ traceDetail.farm.name }}</text>
  137. <view class="farmTags">
  138. <text class="farmTag">真实种植</text>
  139. <text class="farmTag">可追溯来源</text>
  140. </view>
  141. <view v-if="traceDetail.farm.location" class="farmLocation">
  142. <svg class="locationIcon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  143. <path d="M10 2C7.24 2 5 4.24 5 7c0 4 5 11 5 11s5-7 5-11c0-2.76-2.24-5-5-5zm0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z" fill="rgba(39,113,76,0.6)"/>
  144. </svg>
  145. <text class="locationText">产地:{{ traceDetail.farm.location }}</text>
  146. </view>
  147. </view>
  148. </view>
  149. <view v-if="traceDetail.farm?.intro" class="farmIntro">
  150. <text class="farmIntroOrigin">{{ traceDetail.farm.intro }}</text>
  151. </view>
  152. </view>
  153. <!-- 农事时间轴:关键种植过程 -->
  154. <view v-if="traceDetail.batch?.exists && traceDetail.farmTimeline?.length" class="card cardLevel1 cardTimeline">
  155. <view class="sectionHeader">
  156. <view class="sectionHeaderLeft">
  157. <text class="sectionEn">Process</text>
  158. <text class="sectionTitle">种植过程记录</text>
  159. </view>
  160. </view>
  161. <view class="timelineList">
  162. <view
  163. v-for="(item, index) in traceDetail.farmTimeline"
  164. :key="`timeline-${index}`"
  165. :class="{
  166. 'timelineItem': true,
  167. 'is-key': item.stage === 'test',
  168. 'is-current': item.stage === 'pack'
  169. }"
  170. >
  171. <view class="timelineLeft">
  172. <view class="timelineDot" />
  173. <view v-if="index !== traceDetail.farmTimeline.length - 1" class="timelineLine" />
  174. </view>
  175. <view class="timelineRight">
  176. <text v-if="item.time" class="timelineTime">{{ item.time }}</text>
  177. <text class="timelineTitle">{{ item.title }}</text>
  178. <text class="timelineDesc">{{ item.desc }}</text>
  179. </view>
  180. </view>
  181. </view>
  182. <view class="timelineFootnote">
  183. <text>以上信息真实有效,可追溯验证</text>
  184. </view>
  185. </view>
  186. <!-- 种植现场实时画面 -->
  187. <view v-if="traceDetail.batch?.exists && traceDetail.camera" class="card cardLevel1 cardLive">
  188. <view class="sectionHeader">
  189. <view class="sectionHeaderLeft">
  190. <text class="sectionEn">Live Scene</text>
  191. <text class="sectionTitle">种植现场</text>
  192. </view>
  193. </view>
  194. <!-- <image
  195. v-if="traceDetail.camera.coverImage"
  196. class="liveCover"
  197. :src="traceDetail.camera.coverImage"
  198. mode="aspectFill"
  199. />
  200. <view v-else class="livePlaceholder">
  201. <view class="livePlayIcon">
  202. <view class="livePlayDot" />
  203. <view class="livePlayDot dot2" />
  204. <view class="livePlayDot dot3" />
  205. </view>
  206. <text class="livePlaceholderMain">实时画面接入中</text>
  207. <text class="livePlaceholderSub">请稍候查看现场情况</text>
  208. </view> -->
  209. <!-- 视频预览区域 -->
  210. <view class="video-section">
  211. <view class="video-container" :class="{'fullscreen-mode': isFullscreen}">
  212. <!-- 默认未播放态背景:深灰绿 + 柔和层次感 -->
  213. <view v-if="!isPlaying" class="video-placeholder-bg">
  214. <image :src="deviceInfo.imageUrl" mode="aspectFill" style="width:100%;height:100%"></image>
  215. </view>
  216. <!-- 使用跨平台视频播放组件 -->
  217. <!-- #ifdef H5 -->
  218. <!-- iOS H5:使用 video 直接播放 HLS(绕过 Jessibuca + wss_flv) -->
  219. <video
  220. v-if="isPlaying && isH5IOS"
  221. id="h5IosVideo"
  222. class="video-player"
  223. :src="getIOSH5StreamUrl"
  224. :autoplay="true"
  225. :controls="true"
  226. :show-center-play-btn="true"
  227. :enable-progress-gesture="false"
  228. :object-fit="'contain'"
  229. @error="onVideoError"
  230. @play="onVideoPlay"
  231. @pause="onVideoPause"
  232. @ended="onVideoEnded"
  233. @timeupdate="onTimeUpdate"
  234. @fullscreenchange="onFullscreenChange"
  235. ></video>
  236. <!-- 非 iOS H5:使用 Jessibuca + wss_flv(保持安卓/PC 原有逻辑) -->
  237. <view v-else-if="isPlaying && !isH5IOS" class="h5-video-wrapper">
  238. <Jessibuca ref="jessibucaRef" :videoUrl="getH5StreamUrl" :hasAudio="true" @error="onVideoError" />
  239. </view>
  240. <!-- #endif -->
  241. <!-- 微信小程序视频播放 -->
  242. <!-- #ifdef MP-WEIXIN -->
  243. <video
  244. v-if="isPlaying"
  245. id="myVideo"
  246. class="video-player"
  247. :src="getAppStreamUrl"
  248. :autoplay="true"
  249. :controls="true"
  250. :show-center-play-btn="true"
  251. :enable-progress-gesture="false"
  252. :object-fit="'contain'"
  253. @error="onVideoError"
  254. @play="onVideoPlay"
  255. @pause="onVideoPause"
  256. @ended="onVideoEnded"
  257. @timeupdate="onTimeUpdate"
  258. @fullscreenchange="onFullscreenChange"
  259. ></video>
  260. <!-- #endif -->
  261. <!-- App端视频播放 -->
  262. <!-- #ifdef APP-PLUS || APP-HARMONY -->
  263. <video
  264. v-if="isPlaying"
  265. id="appVideo"
  266. class="video-player"
  267. :src="getAppStreamUrl"
  268. :autoplay="true"
  269. :controls="true"
  270. :show-center-play-btn="true"
  271. @error="onVideoError"
  272. ></video>
  273. <!-- #endif -->
  274. <!-- 视频控制层 -->
  275. <view class="video-controls">
  276. <view class="control-row top-controls">
  277. <!-- 左上角留空,保持简洁 -->
  278. <!-- 右上角:全屏按钮(仅播放态显示) -->
  279. <view v-if="isPlaying" class="fullscreen-button" @click="toggleFullscreen">
  280. <image src="/static/icons/resize_icon.png" mode="aspectFit"
  281. style="width: 18px; height: 18px;"></image>
  282. </view>
  283. </view>
  284. <view class="control-row center-controls">
  285. <!-- 默认未播放态:圆形播放按钮 -->
  286. <view v-if="!isPlaying" class="play-button" @click="togglePlayState">
  287. <view class="play-btn-circle">
  288. <view class="play-btn-icon"></view>
  289. </view>
  290. </view>
  291. <!-- 播放态:暂停按钮 -->
  292. <view v-else class="center-button-container" @click="togglePlayState">
  293. <view class="pause-icon">
  294. <image src="/static/icons/pause_icon.png" mode="aspectFit"
  295. style="width: 24px; height: 24px;"></image>
  296. </view>
  297. </view>
  298. </view>
  299. <view class="control-row bottom-controls">
  300. <!-- 只在播放时显示时间码 -->
  301. <view v-if="isPlaying && !isH5IOS" class="video-time">{{ currentTime }}</view>
  302. </view>
  303. </view>
  304. <!-- 实时在线状态标签(固定在右上角,不受其他元素影响) -->
  305. <view class="video-fixed-status">
  306. <view class="liveStatusPill" :class="cameraStatus.value">
  307. <view class="liveStatusDot" />
  308. <text class="liveStatusText">实时在线</text>
  309. </view>
  310. </view>
  311. </view>
  312. </view>
  313. <view class="liveDesc">
  314. <text>现场画面可见,种植状态真实呈现</text>
  315. </view>
  316. </view>
  317. <!-- 种植环境记录 -->
  318. <view v-if="traceDetail.batch?.exists && traceDetail.environment" class="card cardLevel1 cardEnvironment">
  319. <view class="sectionHeader">
  320. <view class="sectionHeaderLeft">
  321. <text class="sectionEn">Environment</text>
  322. <text class="sectionTitle">种植环境记录</text>
  323. </view>
  324. </view>
  325. <view class="environmentSummary">
  326. <text>{{ traceDetail.environment.summary }}</text>
  327. </view>
  328. <!-- 土壤养分趋势图 -->
  329. <view v-if="traceDetail.environment.chart" class="environmentChart">
  330. <view class="environmentChartHead">
  331. <text class="environmentChartTitle">土壤养分变化趋势</text>
  332. <text class="environmentChartSub">氮 / 磷 / 钾 种植期记录</text>
  333. </view>
  334. <view class="environmentChartCanvas">
  335. <!-- SVG 绘图区 -->
  336. <view class="chartPlotArea">
  337. <svg class="chartSvg" viewBox="0 0 700 200" preserveAspectRatio="none">
  338. <!-- 网格线 -->
  339. <line v-for="(line, idx) in svgGridLines" :key="`grid-${idx}`"
  340. class="chartGridLineSvg"
  341. :x1="0" :y1="line" :x2="700" :y2="line"
  342. />
  343. <!-- 定义渐变和发光滤镜 -->
  344. <defs>
  345. <linearGradient id="gradN" x1="0%" y1="0%" x2="100%" y2="0%">
  346. <stop offset="0%" stop-color="rgba(47, 125, 85, 0.3)" />
  347. <stop offset="50%" stop-color="rgba(47, 125, 85, 0.7)" />
  348. <stop offset="100%" stop-color="rgba(47, 125, 85, 0.3)" />
  349. </linearGradient>
  350. <linearGradient id="gradP" x1="0%" y1="0%" x2="100%" y2="0%">
  351. <stop offset="0%" stop-color="rgba(180, 140, 70, 0.3)" />
  352. <stop offset="50%" stop-color="rgba(180, 140, 70, 0.7)" />
  353. <stop offset="100%" stop-color="rgba(180, 140, 70, 0.3)" />
  354. </linearGradient>
  355. <linearGradient id="gradK" x1="0%" y1="0%" x2="100%" y2="0%">
  356. <stop offset="0%" stop-color="rgba(84, 130, 110, 0.3)" />
  357. <stop offset="50%" stop-color="rgba(84, 130, 110, 0.7)" />
  358. <stop offset="100%" stop-color="rgba(84, 130, 110, 0.3)" />
  359. </linearGradient>
  360. <filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
  361. <feGaussianBlur stdDeviation="3" result="blur" />
  362. <feMerge>
  363. <feMergeNode in="blur" />
  364. <feMergeNode in="SourceGraphic" />
  365. </feMerge>
  366. </filter>
  367. </defs>
  368. <!-- 面积渐变层(先绘制,在线下方) -->
  369. <path class="chartAreaN" :d="chartAreas.n" />
  370. <path class="chartAreaP" :d="chartAreas.p" />
  371. <path class="chartAreaK" :d="chartAreas.k" />
  372. <!-- 曲线层(带渐变和发光) -->
  373. <path class="chartPathN" :d="chartPaths.n" stroke="url(#gradN)" />
  374. <path class="chartPathP" :d="chartPaths.p" stroke="url(#gradP)" />
  375. <path class="chartPathK" :d="chartPaths.k" stroke="url(#gradK)" />
  376. <!-- 数据点 -->
  377. <circle v-for="(pt, idx) in chartPoints.n" :key="`n-${idx}`"
  378. class="chartDotN"
  379. cx="0" cy="0" r="3"
  380. :transform="`translate(${pt.x}, ${pt.y})`"
  381. />
  382. <circle v-for="(pt, idx) in chartPoints.p" :key="`p-${idx}`"
  383. class="chartDotP"
  384. cx="0" cy="0" r="3"
  385. :transform="`translate(${pt.x}, ${pt.y})`"
  386. />
  387. <circle v-for="(pt, idx) in chartPoints.k" :key="`k-${idx}`"
  388. class="chartDotK"
  389. cx="0" cy="0" r="3"
  390. :transform="`translate(${pt.x}, ${pt.y})`"
  391. />
  392. </svg>
  393. </view>
  394. <!-- 日期标签:根据数据量和日期跨度智能显示 -->
  395. <view class="chartLabels">
  396. <text v-for="(item, idx) in chartXAxisLabels" :key="`label-${idx}`" :class="{'label-hidden': item.hidden}">{{ item.label }}</text>
  397. </view>
  398. </view>
  399. <view class="environmentChartLegend">
  400. <view class="legendItem">
  401. <view class="legendDot legendN" />
  402. <text>氮</text>
  403. </view>
  404. <view class="legendItem">
  405. <view class="legendDot legendP" />
  406. <text>磷</text>
  407. </view>
  408. <view class="legendItem">
  409. <view class="legendDot legendK" />
  410. <text>钾</text>
  411. </view>
  412. </view>
  413. </view>
  414. <!-- 环境摘要项 -->
  415. <view class="environmentGrid">
  416. <view
  417. v-for="(item, index) in traceDetail.environment.items"
  418. :key="`env-${index}`"
  419. class="environmentItem"
  420. >
  421. <text class="environmentLabel">{{ item.label }}</text>
  422. <text class="environmentValue">{{ item.value }}</text>
  423. <text class="environmentStatus">{{ item.status }}</text>
  424. </view>
  425. </view>
  426. </view>
  427. <!-- 检测报告:横向卡片列表 -->
  428. <view v-if="traceDetail.batch?.exists" class="card cardLevel2 cardCredential">
  429. <view class="sectionHeader">
  430. <view class="sectionHeaderLeft">
  431. <text class="sectionEn">Report</text>
  432. <text class="sectionTitle">检测报告</text>
  433. </view>
  434. </view>
  435. <!-- 横向滑动卡片列表 -->
  436. <scroll-view
  437. v-if="reportItems.length"
  438. class="reportCardList"
  439. scroll-x
  440. :show-scrollbar="false"
  441. enhanced
  442. >
  443. <view class="reportCardTrack">
  444. <view
  445. v-for="(item, itemIdx) in reportItems"
  446. :key="`report-card-${itemIdx}`"
  447. class="reportCard"
  448. @click="previewDoc('report', getReportGlobalIndex(itemIdx, 0))"
  449. >
  450. <!-- 报告缩略图(带页数角标) -->
  451. <view class="reportCardThumb">
  452. <image
  453. v-if="item.images && item.images.length"
  454. class="reportCardThumbImg"
  455. :src="item.images[0]"
  456. mode="aspectFit"
  457. />
  458. <view v-else class="reportCardThumbEmpty">
  459. <text class="reportCardThumbEmptyText">暂无图片</text>
  460. </view>
  461. <view v-if="item.images && item.images.length > 1" class="reportCardPages">
  462. 共{{ item.images.length }}页
  463. </view>
  464. </view>
  465. <!-- 报告信息 -->
  466. <view class="reportCardMeta">
  467. <view v-if="item.detectDate" class="reportCardRow">
  468. <text class="reportCardLabel">检测日期</text>
  469. <text class="reportCardValue">{{ item.detectDate }}</text>
  470. </view>
  471. <view v-if="item.no" class="reportCardRow">
  472. <text class="reportCardLabel">报告编号</text>
  473. <text class="reportCardValue reportCardValueNo">{{ item.no }}</text>
  474. </view>
  475. </view>
  476. <!-- 点击提示 -->
  477. <text class="reportCardHint">点击查看大图</text>
  478. </view>
  479. </view>
  480. </scroll-view>
  481. <!-- 待补充状态 -->
  482. <view v-else class="docPlaceholder">
  483. <text class="docPlaceholderTitle">检测报告待补充</text>
  484. <text class="docPlaceholderText">
  485. {{ traceDetail.report?.emptyMessage || '检测报告待补充,请耐心等待。' }}
  486. </text>
  487. </view>
  488. </view>
  489. <!-- 合格证:信息摘要 + 缩略图一体化布局 -->
  490. <view v-if="traceDetail.batch?.exists" class="card cardLevel1 cardCredential">
  491. <view class="sectionHeader">
  492. <view class="sectionHeaderLeft">
  493. <text class="sectionEn">Certificate</text>
  494. <text class="sectionTitle">合格证</text>
  495. </view>
  496. </view>
  497. <!-- 信息与缩略图一体化区域 -->
  498. <view class="certSummary">
  499. <!-- 左侧:信息摘要 -->
  500. <view class="certSummaryInfo">
  501. <view v-if="traceDetail.certificate?.issueDate" class="certSummaryRow">
  502. <text class="certSummaryLabel">开具日期</text>
  503. <text class="certSummaryValue">{{ traceDetail.certificate.issueDate }}</text>
  504. </view>
  505. <view v-if="traceDetail.certificate?.no" class="certSummaryRow">
  506. <text class="certSummaryLabel">合格证编号</text>
  507. <text class="certSummaryValue">{{ traceDetail.certificate.no }}</text>
  508. </view>
  509. </view>
  510. <!-- 右侧:缩略图 -->
  511. <view
  512. v-if="traceDetail.certificate?.status === 'uploaded' && certificateImages.length"
  513. class="certThumbContainer"
  514. @click="previewDoc('certificate', 0)"
  515. >
  516. <view class="certThumbWrap">
  517. <image class="certThumbImage" :src="certificateImages[0]" mode="aspectFit" />
  518. </view>
  519. <text class="certPreviewHint">点击查看</text>
  520. </view>
  521. <!-- 待补充状态:仅显示提示 -->
  522. <view v-else class="certPendingHint">
  523. <text class="certPendingText">
  524. {{ traceDetail.certificate?.emptyMessage || '合格证待补充,请耐心等待。' }}
  525. </text>
  526. </view>
  527. </view>
  528. </view>
  529. <!-- 安心收口文案 -->
  530. <view class="pageEndHint">
  531. <text>本产品已完成全流程溯源记录,信息真实可查,请放心食用。</text>
  532. </view>
  533. <view class="footerDivider" />
  534. <!-- 微信小店复购引导 -->
  535. <view class="rebuyGuide">
  536. <view class="rebuyGuideLeft">
  537. <view class="rebuyGuideBrandRow">
  538. <image class="rebuyGuideLogo" src="/static/jyhy-logo.png" mode="aspectFit" />
  539. <text class="rebuyGuideTitle">佳友厚苑</text>
  540. </view>
  541. <text class="rebuyGuideText">喜欢这款产品?微信小店可查看同款</text>
  542. </view>
  543. <view class="rebuyGuideBtn" @click="goToWechatStore">
  544. <text>去看看</text>
  545. </view>
  546. </view>
  547. <!-- 轻量页脚 -->
  548. <view class="traceFooter">
  549. <view class="traceFooterHint">如需帮助,联系客服</view>
  550. <view class="traceFooterPhone" @click="contactCustomer">
  551. <image class="traceFooterPhoneIcon" src="/static/icons/phone.svg" mode="aspectFit" />
  552. <text class="traceFooterPhoneNum">13379508760</text>
  553. </view>
  554. <view class="traceFooterBrand">佳友厚苑 · 安心之选</view>
  555. </view>
  556. </scroll-view>
  557. </view>
  558. <!-- ===== 异常态:待发布 / 已下线 / 无效批次 ===== -->
  559. <view v-if="!canShowTraceContent">
  560. <view class="abnormalStateCard">
  561. <view class="sectionHeader">
  562. <view class="sectionHeaderLeft">
  563. <text class="sectionEn">Status</text>
  564. <text class="sectionTitle">暂无相关溯源码信息</text>
  565. </view>
  566. </view>
  567. <view class="emptyText">{{ traceDetail.batch?.emptyMessage || '未找到对应溯源码信息,请确认二维码是否正确。' }}</view>
  568. </view>
  569. </view>
  570. </view>
  571. </view>
  572. </template>
  573. <script setup>
  574. import { computed, ref, reactive } from 'vue'
  575. import { onLoad } from '@dcloudio/uni-app'
  576. import {getTraceDetail, listWeather } from '@/api/base/index.js'
  577. import {
  578. getDeviceCollectorDetail,
  579. getChannels,
  580. playStart,
  581. pause ,
  582. querySnap,
  583. fetchDevicesByType
  584. } from '@/api/device.js'
  585. import Jessibuca from '@/components/common/jessibuca.vue'
  586. // 页面状态选择(H5 演示用):通过路由参数传入 state 即可切换 mock 场景
  587. // 例如:/pages/trace/detail?state=reportPending
  588. // 加载状态
  589. const loading = ref(false)
  590. // 数据首次加载完成标记(用于区分"加载中"与"加载后异常态")
  591. const traceLoaded = ref(false)
  592. // 数据存储
  593. const traceInfo = ref(null)
  594. const routeOptions = ref({})
  595. const mockStateKey = ref('normal')
  596. const isFullscreen = ref(false)
  597. const isPlaying = ref(false)
  598. const livePlayerContext = ref(null) // 小程序视频上下文
  599. const appLivePlayerContext = ref(null) // App端视频上下文
  600. const h5IosVideoContext = ref(null) // H5 iOS video 上下文
  601. const jessibucaRef = ref(null)
  602. const isMuted = ref(false)
  603. const isRecording = ref(false)
  604. const isVoiceActive = ref(false)
  605. const isGridView = ref(false)
  606. const isZoomMode = ref(false)
  607. const currentTime = ref('14:30:25')
  608. // ===== 平台识别:iPhone / iOS 设备判断 =====
  609. const isIOSDevice = computed(() => {
  610. // #ifdef H5
  611. const ua = navigator.userAgent.toLowerCase()
  612. return /iphone|ipad|ipod/.test(ua)
  613. // #endif
  614. // #ifdef APP-PLUS
  615. const platform = uni.getSystemInfoSync().platform
  616. return platform === 'ios'
  617. // #endif
  618. return false
  619. })
  620. const isIPhoneH5 = computed(() => {
  621. // #ifdef H5
  622. const ua = navigator.userAgent.toLowerCase()
  623. return /iphone/.test(ua) && !/ipad|ipod/.test(ua)
  624. // #endif
  625. return false
  626. })
  627. const isIPadH5 = computed(() => {
  628. // #ifdef H5
  629. const ua = navigator.userAgent.toLowerCase()
  630. return /ipad/.test(ua)
  631. // #endif
  632. return false
  633. })
  634. // H5 iOS 设备(包括 iPhone 和 iPad)
  635. const isH5IOS = computed(() => {
  636. // #ifdef H5
  637. const ua = navigator.userAgent.toLowerCase()
  638. return /iphone|ipad|ipod/.test(ua)
  639. // #endif
  640. return false
  641. })
  642. // 响应式数据
  643. const deviceInfo = reactive({
  644. deviceId: '',
  645. name: '设备加载中...',
  646. status: 'off',
  647. location: '正在获取位置...',
  648. lastUpdate: '',
  649. deviceType: 'weather', // 默认类型,会根据API返回更新
  650. deviceTypeId: null,
  651. streamUrl: '',
  652. channelId: null, // 当前通道ID
  653. // ===== 流地址:分格式保存,不再互相覆盖 =====
  654. originalStreamUrl: '', // 兼容旧逻辑
  655. wsFlvStreamUrl: '', // wss_flv 流地址(安卓 H5 用)
  656. hlsStreamUrl: '', // hls 流地址(iOS H5 / 小程序 / App iOS 用)
  657. fmp4StreamUrl: '', // fmp4 流地址(App Android 用)
  658. imageUrl: '' // 设备图片(如果有)
  659. })
  660. // 气象数据(独立响应式变量,用于土壤养分趋势图)
  661. const weatherData = ref({
  662. labels: [],
  663. values: {
  664. n: [],
  665. p: [],
  666. k: []
  667. },
  668. items:[]
  669. })
  670. const MOCK_TRACE_DETAILS = {
  671. normal: {
  672. product: {
  673. name: '',
  674. spec: '',
  675. image: '',
  676. intro: ''
  677. },
  678. farm: {
  679. name: '',
  680. location: '',
  681. image: '',
  682. intro: ''
  683. },
  684. batch: {
  685. status: '',
  686. statusText: '',
  687. exists: false,
  688. statusBadge: { text: '', type: '' },
  689. no: '',
  690. plantStartTime: '2026-03-01',
  691. harvestTime: '',
  692. packTime: '',
  693. emptyTitle: '暂无相关溯源码信息',
  694. emptyMessage: '未找到对应溯源码信息,请确认二维码是否正确。'
  695. },
  696. report: {
  697. status: '',
  698. statusBadge: { text: '', type: '' },
  699. // 每份报告独立 detectDate / no / images
  700. items: [
  701. {
  702. detectDate: '',
  703. no: '',
  704. images: ['']
  705. },
  706. {
  707. detectDate: '',
  708. no: '',
  709. images: ['']
  710. },
  711. {
  712. detectDate: '',
  713. no: '',
  714. images: ['']
  715. }
  716. ]
  717. },
  718. certificate: {
  719. status: '',
  720. statusBadge: { text: '', type: '' },
  721. issueDate: '',
  722. no: '',
  723. fileUrl: '',
  724. images: ['']
  725. },
  726. traceConclusionCard: {
  727. title: '溯源结论',
  728. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  729. desc: '检测材料与溯源数据已展示,可继续查看',
  730. passed: true
  731. },
  732. farmTimeline: [
  733. {
  734. time: '2026-03-01',
  735. stage: 'planting',
  736. title: '开始种植',
  737. desc: '本批次产品进入种植管理阶段'
  738. },
  739. {
  740. time: '2026-03-12',
  741. stage: 'care',
  742. title: '生长期养护',
  743. desc: '种植期间已持续开展灌溉、施肥等日常养护'
  744. },
  745. {
  746. time: '2026-03-20',
  747. stage: 'inspection',
  748. title: '田间巡检',
  749. desc: '种植期间已持续开展长势检查与环境巡检'
  750. },
  751. {
  752. time: '2026-03-30',
  753. stage: 'harvest',
  754. title: '成熟采收',
  755. desc: '本批次产品进入成熟采收阶段'
  756. },
  757. {
  758. time: '2026-03-31',
  759. stage: 'test',
  760. title: '安全检测',
  761. desc: '已完成安全检测,相关结果可查'
  762. },
  763. {
  764. time: '2026-04-01',
  765. stage: 'pack',
  766. title: '包装日期:出库',
  767. desc: '已完成包装日期:整理,进入销售流通环节'
  768. }
  769. ],
  770. camera: {
  771. liveUrl: '',
  772. coverImage: '',
  773. status: 'online',
  774. desc: '来自农场实景画面,种植环境真实呈现'
  775. },
  776. environment: {
  777. summary: '本批次种植期环境稳定,整体处于适宜生长区间',
  778. chart: {
  779. type: 'npk_trend',
  780. labels: ['03-01', '03-06', '03-10', '03-15', '03-21', '03-27', '04-01'],
  781. values: {
  782. n: [26.2, 25.8, 26.4, 25.9, 26.6, 26.1, 26.4],
  783. p: [20.5, 20.1, 20.4, 20.0, 20.3, 20.2, 20.4],
  784. k: [14.2, 14.6, 14.3, 14.7, 14.4, 14.8, 14.5]
  785. }
  786. },
  787. items: [
  788. { label: '气温', value: '22.3℃', status: '种植期平均' },
  789. { label: '湿度', value: '45%', status: '种植期平均' },
  790. { label: '降雨量', value: '118mm', status: '种植期累计' },
  791. { label: '光照', value: '充足', status: '表现稳定' }
  792. ],
  793. current: {
  794. temperature: '24.5℃',
  795. humidity: '42.2%'
  796. }
  797. }
  798. },
  799. reportPending: {
  800. product: {
  801. name: '',
  802. spec: '',
  803. image: '',
  804. intro: ''
  805. },
  806. farm: {
  807. name: '',
  808. location: '',
  809. image: null,
  810. intro: ''
  811. },
  812. batch: {
  813. status: '',
  814. statusText: '',
  815. exists: false,
  816. statusBadge: { text: '', type: '' },
  817. no: '',
  818. plantStartTime: '',
  819. harvestTime: '',
  820. packTime: '',
  821. emptyTitle: '暂无相关溯源码信息',
  822. emptyMessage: '未找到对应溯源码信息,请确认二维码是否正确。'
  823. },
  824. report: {
  825. status: '',
  826. statusBadge: { text: '', type: '' },
  827. emptyMessage: '',
  828. items: []
  829. },
  830. certificate: {
  831. status: '',
  832. statusBadge: { text: '', type: '' },
  833. issueDate: '',
  834. no: '',
  835. fileUrl: '',
  836. images: []
  837. },
  838. traceConclusionCard: {
  839. title: '溯源结论',
  840. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  841. desc: '检测材料与溯源数据已展示,可继续查看',
  842. passed: true
  843. },
  844. farmTimeline: []
  845. },
  846. certificatePending: {
  847. product: {
  848. name: '',
  849. spec: '',
  850. image: '',
  851. intro: ''
  852. },
  853. farm: {
  854. name: '',
  855. location: '',
  856. image: null,
  857. intro: ''
  858. },
  859. batch: {
  860. status: '',
  861. statusText: '',
  862. exists: false,
  863. statusBadge: { text: '', type: '' },
  864. no: '',
  865. plantStartTime: '',
  866. harvestTime: '',
  867. packTime: '',
  868. emptyTitle: '暂无相关溯源码信息',
  869. emptyMessage: '未找到对应溯源码信息,请确认二维码是否正确。'
  870. },
  871. report: {
  872. status: '',
  873. statusBadge: { text: '', type: '' },
  874. items: [
  875. {
  876. detectDate: '',
  877. no: '',
  878. images: []
  879. }
  880. ]
  881. },
  882. certificate: {
  883. status: '',
  884. statusBadge: { text: '', type: '' },
  885. emptyMessage: ''
  886. },
  887. traceConclusionCard: {
  888. title: '溯源结论',
  889. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  890. desc: '检测材料与溯源数据已展示,可继续查看',
  891. passed: true
  892. },
  893. farmTimeline: []
  894. },
  895. batchNotFound: {
  896. product: {
  897. name:'',
  898. spec: '',
  899. image: '',
  900. intro: ''
  901. },
  902. farm: {
  903. name: '',
  904. location: '',
  905. image: null,
  906. intro: ''
  907. },
  908. batch: {
  909. status: '',
  910. statusText: '',
  911. exists: false,
  912. statusBadge: { text: '', type: '' },
  913. no: '',
  914. plantStartTime: '',
  915. harvestTime: '',
  916. packTime: '',
  917. emptyTitle: '暂无相关溯源码信息',
  918. emptyMessage: '未找到对应溯源码信息,请确认二维码是否正确。'
  919. },
  920. report: null,
  921. certificate: null,
  922. traceConclusionCard: {
  923. title: '溯源结论',
  924. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  925. desc: '检测材料与溯源数据已展示,可继续查看',
  926. passed: true
  927. },
  928. farmTimeline: []
  929. },
  930. batchOfflined: {
  931. product: {
  932. name: '',
  933. spec: '',
  934. image: '',
  935. intro: ''
  936. },
  937. farm: {
  938. name: '',
  939. location: '',
  940. image: null,
  941. intro: ''
  942. },
  943. batch: {
  944. status: '',
  945. statusText: '',
  946. exists: false,
  947. statusBadge: { text: '', type: '' },
  948. no: '',
  949. plantStartTime: '',
  950. harvestTime: '',
  951. packTime: '',
  952. emptyTitle: '暂无相关溯源码信息',
  953. emptyMessage: '未找到对应溯源码信息,请确认二维码是否正确。'
  954. },
  955. report: null,
  956. certificate: null,
  957. traceConclusionCard: {
  958. title: '溯源结论',
  959. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  960. desc: '检测材料与溯源数据已展示,可继续查看',
  961. passed: true
  962. },
  963. farmTimeline: []
  964. }
  965. }
  966. // 加载Jessibuca脚本
  967. const loadJessibucaScript = () => {
  968. // #ifdef H5
  969. const script = document.createElement('script')
  970. script.src = '/static/js/jessibuca/jessibuca.js'
  971. script.onload = () => {
  972. console.log('Jessibuca 脚本加载成功')
  973. }
  974. script.onerror = (error) => {
  975. console.error('Jessibuca 脚本加载失败:', error)
  976. }
  977. document.head.appendChild(script)
  978. // #endif
  979. }
  980. // 获取H5环境使用的流地址(非 iOS H5 用 wss_flv)
  981. const getH5StreamUrl = computed(() => {
  982. // 确保使用安全的 WSS 协议
  983. let url = deviceInfo.wsFlvStreamUrl
  984. if (url && url.startsWith('ws://')) {
  985. console.warn('检测到不安全的 ws:// 协议,自动转换为 wss://')
  986. url = url.replace('ws://', 'wss://')
  987. }
  988. return url
  989. })
  990. // ===== iOS H5 专用流地址(直接用 HLS,不走 Jessibuca) =====
  991. const getIOSH5StreamUrl = computed(() => {
  992. // iOS H5 优先使用 HLS 地址
  993. const hlsUrl = deviceInfo.hlsStreamUrl
  994. console.log('========== [诊断] iOS H5 流地址 ==========')
  995. console.log('hlsStreamUrl:', hlsUrl)
  996. return hlsUrl || ''
  997. })
  998. // 当前 H5 实际使用的流地址(根据设备类型选择)
  999. const getCurrentH5StreamUrl = computed(() => {
  1000. if (isH5IOS.value) {
  1001. return getIOSH5StreamUrl.value
  1002. } else {
  1003. return getH5StreamUrl.value
  1004. }
  1005. })
  1006. function resolveStateKey(opts) {
  1007. const raw = (opts?.state || opts?.batchState || opts?.scene || '').toString().trim()
  1008. if (!raw) return 'normal'
  1009. const allowed = ['normal', 'reportPending', 'certificatePending', 'batchNotFound', 'batchOfflined']
  1010. return allowed.includes(raw) ? raw : 'normal'
  1011. }
  1012. onLoad((opts) => {
  1013. // 拿到浏览器路径参数
  1014. const fullPath = window.location.pathname
  1015. const batchId = fullPath.split('/').filter(Boolean).pop()
  1016. // 优先使用路由参数中的 id,其次使用 URL 路径中的 id
  1017. const finalId = batchId || 1
  1018. loadData(finalId)
  1019. // queryChannels()
  1020. routeOptions.value = opts || {}
  1021. mockStateKey.value = resolveStateKey(opts || {})
  1022. startTimeUpdate()
  1023. // #ifdef MP-WEIXIN
  1024. setTimeout(() => {
  1025. livePlayerContext.value = uni.createVideoContext('myVideo')
  1026. console.log('微信小程序视频上下文已创建')
  1027. }, 500)
  1028. // #endif
  1029. // #ifdef APP-PLUS || APP-HARMONY
  1030. setTimeout(() => {
  1031. appLivePlayerContext.value = uni.createVideoContext('appVideo')
  1032. console.log('App视频上下文已创建')
  1033. }, 500)
  1034. // #endif
  1035. // #ifdef H5
  1036. loadJessibucaScript()
  1037. setTimeout(() => {
  1038. h5IosVideoContext.value = uni.createVideoContext('h5IosVideo')
  1039. console.log('H5 iOS 视频上下文已创建')
  1040. }, 500)
  1041. // #endif
  1042. })
  1043. // 加载设备列表
  1044. const loadDeviceList = (currentFieldId) => {
  1045. // 构建查询参数
  1046. const params = {
  1047. pageNum: 1,
  1048. pageSize: 10,
  1049. deviceType: 'monitor',
  1050. fieldId: currentFieldId || undefined
  1051. };
  1052. // 调用API获取设备列表
  1053. fetchDevicesByType(params)
  1054. .then(res => {
  1055. console.log("res", res);
  1056. if (res.data.code === 200 && res.data.rows) {
  1057. const { rows, total: totalCount } = res.data;
  1058. queryChannels(rows[0].deviceId)// 根据设备ID查询摄像头
  1059. } else {
  1060. handleApiError(res);
  1061. }
  1062. })
  1063. .catch(error => {
  1064. console.error('获取设备列表失败', error);
  1065. uni.showToast({
  1066. title: '获取设备列表失败',
  1067. icon: 'none'
  1068. });
  1069. })
  1070. }
  1071. // 根据设备id获取通道列表
  1072. const queryChannels = (deviceId) => {
  1073. deviceInfo.deviceId = deviceId
  1074. console.log('========== [诊断] queryChannels 被调用 ==========')
  1075. getChannels(deviceInfo.deviceId)
  1076. .then(response => {
  1077. console.log('获取通道列表:', response)
  1078. const res = response.data
  1079. if (res.code === 0 && res.data.total > 0) {
  1080. const channels = res.data.list
  1081. deviceInfo.channelId = channels[0].deviceId
  1082. deviceInfo.status = channels[0].status
  1083. console.log('通道信息:', { channelId: deviceInfo.channelId, status: deviceInfo.status })
  1084. // ===== 诊断日志:调用 playStart 前 =====
  1085. console.log('========== [诊断] 准备调用 playStart ==========')
  1086. console.log('deviceId:', deviceInfo.deviceId)
  1087. console.log('channelId:', deviceInfo.channelId)
  1088. console.log('isH5IOS:', isH5IOS.value)
  1089. console.log('isIPhoneH5:', isIPhoneH5.value)
  1090. querySnap(deviceInfo.deviceId, deviceInfo.channelId).then(url => {
  1091. deviceInfo.imageUrl = url
  1092. })
  1093. playStart(deviceInfo.deviceId, deviceInfo.channelId).then(res => {
  1094. if (res.data.code !== 0) {
  1095. console.error('播放开始失败:', res.message)
  1096. uni.showToast({
  1097. title: '播放失败: ' + res.message,
  1098. icon: 'none'
  1099. })
  1100. return
  1101. }
  1102. console.log('playStart 返回数据:', res.data.data)
  1103. console.log('playStart 可用流地址:', Object.keys(res.data.data || {}))
  1104. // ===== 诊断日志:playStart 成功,保存各格式流地址 =====
  1105. console.log('========== [诊断] 保存各格式流地址 ==========')
  1106. // #ifdef H5
  1107. // H5 环境:分别保存 wss_flv 和 hls
  1108. const rawWsFlv = res.data.data.wss_flv
  1109. const rawHls = res.data.data.hls
  1110. // 非 iOS H5:走 wss_flv + Jessibuca,保留 URL 替换逻辑
  1111. if (!isH5IOS.value && rawWsFlv) {
  1112. const urlObj = new URL(rawWsFlv)
  1113. urlObj.hostname = 'nxy.gbdfarm.com'
  1114. urlObj.port = '9000'
  1115. deviceInfo.wsFlvStreamUrl = urlObj.toString()
  1116. console.log('H5 非iOS - wsFlvStreamUrl:', deviceInfo.wsFlvStreamUrl)
  1117. } else if (!isH5IOS.value) {
  1118. console.warn('H5 非iOS - 未获取到 wss_flv')
  1119. }
  1120. // iOS H5:直接用 HLS,不做 URL 替换
  1121. if (isH5IOS.value && rawHls) {
  1122. deviceInfo.hlsStreamUrl = rawHls // 直接使用原始 HLS 地址,不替换域名
  1123. console.log('H5 iOS - hlsStreamUrl (不替换域名):', deviceInfo.hlsStreamUrl)
  1124. } else if (isH5IOS.value) {
  1125. console.warn('H5 iOS - 未获取到 hls,使用 wss_flv 兜底')
  1126. // iOS 没有 HLS 时,尝试用 wss_flv(可能也会黑屏,但至少有尝试)
  1127. deviceInfo.hlsStreamUrl = rawWsFlv || ''
  1128. }
  1129. // 兼容旧逻辑
  1130. deviceInfo.originalStreamUrl = isH5IOS.value
  1131. ? deviceInfo.hlsStreamUrl
  1132. : deviceInfo.wsFlvStreamUrl
  1133. console.log('H5 - originalStreamUrl (兼容):', deviceInfo.originalStreamUrl)
  1134. // #endif
  1135. // #ifdef MP-WEIXIN
  1136. deviceInfo.hlsStreamUrl = res.data.data.hls || deviceInfo.hlsStreamUrl
  1137. deviceInfo.originalStreamUrl = deviceInfo.hlsStreamUrl
  1138. console.log("queryChannels - 小程序 hlsStreamUrl:", deviceInfo.hlsStreamUrl)
  1139. // #endif
  1140. // #ifdef APP-PLUS || APP-HARMONY
  1141. deviceInfo.fmp4StreamUrl = res.data.data.fmp4 || deviceInfo.fmp4StreamUrl
  1142. deviceInfo.hlsStreamUrl = res.data.data.hls || deviceInfo.hlsStreamUrl
  1143. deviceInfo.originalStreamUrl = deviceInfo.fmp4StreamUrl
  1144. console.log("queryChannels - App fmp4StreamUrl:", deviceInfo.fmp4StreamUrl)
  1145. console.log("queryChannels - App hlsStreamUrl:", deviceInfo.hlsStreamUrl)
  1146. // #endif
  1147. // ===== 最终诊断日志 =====
  1148. console.log('========== [诊断] 流地址保存完成 ==========')
  1149. console.log('wsFlvStreamUrl:', deviceInfo.wsFlvStreamUrl)
  1150. console.log('hlsStreamUrl:', deviceInfo.hlsStreamUrl)
  1151. console.log('fmp4StreamUrl:', deviceInfo.fmp4StreamUrl)
  1152. console.log('originalStreamUrl (兼容):', deviceInfo.originalStreamUrl)
  1153. }).catch(err => {
  1154. console.error('播放开始失败:', err)
  1155. })
  1156. } else {
  1157. uni.showToast({
  1158. title: '获取通道列表失败: ' + res.data.message,
  1159. icon: 'none'
  1160. })
  1161. return
  1162. }
  1163. })
  1164. .catch(err => {
  1165. console.error('获取通道列表错误:', err)
  1166. })
  1167. }
  1168. const loadData = async (batchId) => {
  1169. // 重置首次加载标记,确保请求开始时不会误判为"已加载"
  1170. traceLoaded.value = false
  1171. loading.value = true
  1172. try {
  1173. const res = await getTraceDetail(batchId)
  1174. if (res && res.data && res.data.data) {
  1175. traceInfo.value = res.data.data
  1176. } else {
  1177. traceInfo.value = {}
  1178. }
  1179. loadDeviceList(res.data.data.fieldId) // 根据地块ID查询设备信息
  1180. const beginCollectTime = formatDateTime(traceInfo.value.startPlantingTime);
  1181. const endCollectTime = formatDateTime(traceInfo.value.packageDate);
  1182. const paramsMap = {
  1183. beginCollectTime:beginCollectTime,
  1184. endCollectTime:endCollectTime,
  1185. params: {
  1186. plotId: traceInfo.value.fieldId
  1187. }
  1188. }
  1189. // 查询气象数据并更新到 weatherData
  1190. listWeather(paramsMap).then(res => {
  1191. if (res && res.data && res.data.data) {
  1192. const data = res.data.data
  1193. // 更新气象数据到独立的响应式变量
  1194. weatherData.value = {
  1195. labels: data.weatherDate || [],
  1196. values: {
  1197. n: data.weatherAvgSoilN || [],
  1198. p: data.weatherAvgSoilP || [],
  1199. k: data.weatherAvgSoilK || []
  1200. },
  1201. items:[
  1202. { label: '气温', value: data.weatherRealtimeData.temperature+'℃', status: '种植期平均' },
  1203. { label: '湿度', value: data.weatherRealtimeData.humidity+'%', status: '种植期平均' },
  1204. { label: '降雨量', value: data.weatherRealtimeData.rainfallA+'mm', status: '种植期累计' },
  1205. { label: '光照', value: '充足', status: '表现稳定' }
  1206. ]
  1207. }
  1208. console.log('气象数据已更新:', weatherData.value)
  1209. }
  1210. }).catch(err => {
  1211. console.error('获取气象数据失败:', err)
  1212. })
  1213. console.log('接口返回数据:', traceInfo.value)
  1214. } catch (error) {
  1215. console.error('加载失败', error)
  1216. // 错误提示已在拦截器中自动处理
  1217. } finally {
  1218. // 无论成功失败都关闭 loading
  1219. loading.value = false
  1220. // 标记数据已完成首次加载
  1221. traceLoaded.value = true
  1222. }
  1223. }
  1224. // 工具函数:把日期字符串转为 年月日时分秒格式
  1225. const formatDateTime = (dateStr) => {
  1226. if (!dateStr) return '';
  1227. // 截取日期部分 + 拼接 00:00:00
  1228. return dateStr.substring(0, 10) + ' 00:00:00';
  1229. };
  1230. // 视频播放错误处理
  1231. const onVideoError = (e) => {
  1232. console.error('========== [诊断] 视频播放错误 ==========')
  1233. console.error('视频播放错误:', e)
  1234. let errorMsg = '视频加载失败'
  1235. // 微信小程序video组件错误码
  1236. if (e && e.detail) {
  1237. const errCode = e.detail.errCode
  1238. console.error('微信错误码:', errCode)
  1239. console.error('微信错误信息:', e.detail.errMsg)
  1240. switch(errCode) {
  1241. case 10001:
  1242. errorMsg = '网络错误,请检查网络连接'
  1243. break
  1244. case 10002:
  1245. errorMsg = '视频格式不支持'
  1246. break
  1247. case 10003:
  1248. errorMsg = '视频解码失败'
  1249. break
  1250. case 10004:
  1251. errorMsg = '视频地址无效'
  1252. break
  1253. default:
  1254. errorMsg = `播放失败(错误码:${errCode})`
  1255. }
  1256. }
  1257. // ===== 诊断日志:当前环境信息 =====
  1258. // #ifdef H5
  1259. console.log('========== [诊断] H5 错误上下文 ==========')
  1260. console.log('isH5IOS:', isH5IOS.value)
  1261. console.log('getH5StreamUrl (非iOS):', getH5StreamUrl.value)
  1262. console.log('getIOSH5StreamUrl (iOS):', getIOSH5StreamUrl.value)
  1263. // #endif
  1264. uni.showToast({
  1265. title: errorMsg,
  1266. icon: 'none',
  1267. duration: 3000
  1268. })
  1269. isPlaying.value = false
  1270. // #ifdef H5
  1271. // 只对非 iOS H5 做 Jessibuca 重试
  1272. setTimeout(() => {
  1273. if (isPlaying.value && !isH5IOS.value && jessibucaRef.value) {
  1274. console.log('尝试重新加载视频流')
  1275. } else if (isH5IOS.value) {
  1276. console.log('【诊断】iOS H5 播放失败,hlsStreamUrl:', deviceInfo.hlsStreamUrl)
  1277. }
  1278. }, 3000)
  1279. // #endif
  1280. }
  1281. // 更新时间
  1282. const startTimeUpdate = () => {
  1283. setInterval(() => {
  1284. const now = new Date()
  1285. const hours = String(now.getHours()).padStart(2, '0')
  1286. const minutes = String(now.getMinutes()).padStart(2, '0')
  1287. const seconds = String(now.getSeconds()).padStart(2, '0')
  1288. currentTime.value = `${hours}:${minutes}:${seconds}`
  1289. }, 1000)
  1290. }
  1291. // 播放/暂停切换
  1292. const togglePlayState = () => {
  1293. console.log('========== [诊断] togglePlayState 被调用 ==========')
  1294. console.log('当前 isPlaying:', isPlaying.value)
  1295. console.log('isH5IOS:', isH5IOS.value)
  1296. if (!isPlaying.value) {
  1297. // 开始播放
  1298. isPlaying.value = true
  1299. // ===== 诊断日志:播放链路选择 =====
  1300. // #ifdef H5
  1301. if (isH5IOS.value) {
  1302. console.log('========== [诊断] H5 iOS 播放链路 ==========')
  1303. console.log('使用 iOS H5 专用流地址')
  1304. console.log('getIOSH5StreamUrl:', getIOSH5StreamUrl.value)
  1305. } else {
  1306. console.log('========== [诊断] H5 非iOS 播放链路 ==========')
  1307. console.log('使用 Jessibuca + wss_flv')
  1308. console.log('getH5StreamUrl:', getH5StreamUrl.value)
  1309. }
  1310. // #endif
  1311. // #ifdef MP-WEIXIN
  1312. console.log('========== [诊断] 微信小程序播放链路 ==========')
  1313. console.log('使用 video + hls')
  1314. console.log('getAppStreamUrl:', getAppStreamUrl.value)
  1315. setTimeout(() => {
  1316. if (livePlayerContext.value) {
  1317. livePlayerContext.value.play()
  1318. console.log('微信小程序开始播放')
  1319. }
  1320. }, 300)
  1321. // #endif
  1322. // #ifdef APP-PLUS || APP-HARMONY
  1323. console.log('========== [诊断] App 播放链路 ==========')
  1324. console.log('使用 video + fmp4/hls')
  1325. console.log('getAppStreamUrl:', getAppStreamUrl.value)
  1326. setTimeout(() => {
  1327. if (appLivePlayerContext.value) {
  1328. appLivePlayerContext.value.play()
  1329. console.log('App开始播放')
  1330. }
  1331. }, 300)
  1332. // #endif
  1333. // #ifdef H5
  1334. // 【最小修复】不再重复调用 playStart,直接使用 queryChannels 中已保存的流地址
  1335. console.log('【修复】togglePlayState 不再调用 playStart,使用已保存的流地址')
  1336. console.log('H5 实际播放 URL:', getCurrentH5StreamUrl.value)
  1337. // iOS H5 需要手动调用 video.play()
  1338. if (isH5IOS.value) {
  1339. setTimeout(() => {
  1340. if (h5IosVideoContext.value) {
  1341. h5IosVideoContext.value.play()
  1342. console.log('H5 iOS video.play() 已调用')
  1343. }
  1344. }, 300)
  1345. }
  1346. uni.vibrateShort()
  1347. // #endif
  1348. } else {
  1349. // #ifdef H5
  1350. // iOS H5 的 video 暂停
  1351. if (isH5IOS.value && h5IosVideoContext.value) {
  1352. h5IosVideoContext.value.pause()
  1353. console.log('H5 iOS video.pause() 已调用')
  1354. }
  1355. // 非 iOS H5 的 Jessibuca 暂停
  1356. if (!isH5IOS.value && jessibucaRef.value) {
  1357. jessibucaRef.value.pause()
  1358. }
  1359. // #endif
  1360. // #ifdef MP-WEIXIN
  1361. if (livePlayerContext.value) {
  1362. livePlayerContext.value.pause()
  1363. }
  1364. // #endif
  1365. // #ifdef APP-PLUS || APP-HARMONY
  1366. if (appLivePlayerContext.value) {
  1367. appLivePlayerContext.value.pause()
  1368. }
  1369. // #endif
  1370. isPlaying.value = false
  1371. uni.showToast({
  1372. title: '视频已暂停',
  1373. icon: 'none',
  1374. duration: 1500
  1375. })
  1376. }
  1377. }
  1378. // 静音切换
  1379. const toggleMute = () => {
  1380. isMuted.value = !isMuted.value
  1381. // #ifdef H5
  1382. if (jessibucaRef.value) {
  1383. if (isMuted.value) {
  1384. jessibucaRef.value.mute()
  1385. } else {
  1386. jessibucaRef.value.cancelMute()
  1387. }
  1388. }
  1389. // #endif
  1390. // #ifndef H5
  1391. // App端的静音通过 live-player 的 muted 属性控制,会自动响应
  1392. uni.showToast({
  1393. title: isMuted.value ? '已静音' : '已取消静音',
  1394. icon: 'none'
  1395. })
  1396. // #endif
  1397. }
  1398. // 全屏切换
  1399. const toggleFullscreen = () => {
  1400. if (!isPlaying.value) {
  1401. togglePlayState()
  1402. setTimeout(() => {
  1403. setFullscreen(true)
  1404. }, 500)
  1405. } else {
  1406. setFullscreen(!isFullscreen.value)
  1407. }
  1408. }
  1409. // 设置全屏状态
  1410. const setFullscreen = (fullscreen) => {
  1411. isFullscreen.value = fullscreen
  1412. // #ifdef H5
  1413. if (isFullscreen.value) {
  1414. const ua = navigator.userAgent.toLowerCase()
  1415. const isMobile = /mobile|android|iphone|ipad/.test(ua)
  1416. if (isMobile && jessibucaRef.value) {
  1417. jessibucaRef.value.fullscreenSwich()
  1418. } else {
  1419. setTimeout(() => {
  1420. if (jessibucaRef.value) {
  1421. jessibucaRef.value.resize()
  1422. }
  1423. }, 300)
  1424. }
  1425. if (window.screen && window.screen.orientation && window.screen.orientation.lock) {
  1426. window.screen.orientation.lock('landscape').catch(err => {
  1427. console.error('无法锁定屏幕方向:', err)
  1428. })
  1429. }
  1430. } else {
  1431. if (jessibucaRef.value) {
  1432. if (jessibucaRef.value.isFullscreen()) {
  1433. jessibucaRef.value.fullscreenSwich()
  1434. }
  1435. setTimeout(() => {
  1436. if (jessibucaRef.value) {
  1437. jessibucaRef.value.resize()
  1438. }
  1439. }, 300)
  1440. }
  1441. if (window.screen && window.screen.orientation && window.screen.orientation.unlock) {
  1442. window.screen.orientation.unlock()
  1443. }
  1444. }
  1445. // #endif
  1446. // #ifdef MP-WEIXIN
  1447. if (livePlayerContext.value) {
  1448. if (isFullscreen.value) {
  1449. livePlayerContext.value.requestFullScreen({
  1450. direction: 90
  1451. })
  1452. } else {
  1453. livePlayerContext.value.exitFullScreen()
  1454. }
  1455. }
  1456. // #endif
  1457. // #ifdef APP-PLUS || APP-HARMONY
  1458. if (appLivePlayerContext.value) {
  1459. if (isFullscreen.value) {
  1460. appLivePlayerContext.value.requestFullScreen({
  1461. direction: 90
  1462. })
  1463. } else {
  1464. appLivePlayerContext.value.exitFullScreen()
  1465. }
  1466. }
  1467. // #endif
  1468. }
  1469. // 截图
  1470. const takeScreenshot = () => {
  1471. // #ifdef H5
  1472. if (jessibucaRef.value && isPlaying.value) {
  1473. jessibucaRef.value.screenshot()
  1474. uni.showToast({
  1475. title: '截图已保存',
  1476. icon: 'success'
  1477. })
  1478. } else {
  1479. uni.showToast({
  1480. title: '请先播放视频',
  1481. icon: 'none'
  1482. })
  1483. }
  1484. // #endif
  1485. // if (livePlayerContext.value && isPlaying.value) {
  1486. // livePlayerContext.value.snapshot({
  1487. // success: (res) => {
  1488. // console.log('截图成功:', res.tempImagePath)
  1489. // uni.saveImageToPhotosAlbum({
  1490. // filePath: res.tempImagePath,
  1491. // success: () => {
  1492. // uni.showToast({
  1493. // title: '截图已保存到相册',
  1494. // icon: 'success'
  1495. // })
  1496. // },
  1497. // fail: (err) => {
  1498. // console.error('保存截图失败:', err)
  1499. // uni.showToast({
  1500. // title: '保存截图失败',
  1501. // icon: 'none'
  1502. // })
  1503. // }
  1504. // })
  1505. // },
  1506. // fail: (err) => {
  1507. // console.error('截图失败:', err)
  1508. // uni.showToast({
  1509. // title: '截图失败',
  1510. // icon: 'none'
  1511. // })
  1512. // }
  1513. // })
  1514. // } else {
  1515. // uni.showToast({
  1516. // title: '请先播放视频',
  1517. // icon: 'none'
  1518. // })
  1519. // }
  1520. // #ifndef H5
  1521. if (appLivePlayerContext.value && isPlaying.value) {
  1522. appLivePlayerContext.value.snapshot({
  1523. success: (res) => {
  1524. console.log('App截图成功:', res.tempImagePath)
  1525. uni.saveImageToPhotosAlbum({
  1526. filePath: res.tempImagePath,
  1527. success: () => {
  1528. uni.showToast({
  1529. title: '截图已保存到相册',
  1530. icon: 'success'
  1531. })
  1532. },
  1533. fail: (err) => {
  1534. console.error('App保存截图失败:', err)
  1535. uni.showToast({
  1536. title: '保存截图失败',
  1537. icon: 'none'
  1538. })
  1539. }
  1540. })
  1541. },
  1542. fail: (err) => {
  1543. console.error('App截图失败:', err)
  1544. uni.showToast({
  1545. title: '截图失败',
  1546. icon: 'none'
  1547. })
  1548. }
  1549. })
  1550. } else {
  1551. uni.showToast({
  1552. title: '请先播放视频',
  1553. icon: 'none'
  1554. })
  1555. }
  1556. // #endif
  1557. }
  1558. // 小程序播放器状态变化处理
  1559. const onVideoPlay = () => {
  1560. console.log('视频开始播放')
  1561. isPlaying.value = true
  1562. }
  1563. const onVideoPause = () => {
  1564. console.log('视频暂停')
  1565. }
  1566. const onVideoEnded = () => {
  1567. console.log('视频播放结束')
  1568. isPlaying.value = false
  1569. }
  1570. const onTimeUpdate = (e) => {
  1571. // 更新播放时间
  1572. if (e && e.detail) {
  1573. const currentSeconds = Math.floor(e.detail.currentTime)
  1574. const hours = String(Math.floor(currentSeconds / 3600)).padStart(2, '0')
  1575. const minutes = String(Math.floor((currentSeconds % 3600) / 60)).padStart(2, '0')
  1576. const seconds = String(currentSeconds % 60).padStart(2, '0')
  1577. currentTime.value = `${hours}:${minutes}:${seconds}`
  1578. }
  1579. }
  1580. const onStateChange = (e) => {
  1581. console.log('播放器状态变化:', e.detail)
  1582. const state = e.detail.code
  1583. switch (state) {
  1584. case 2001:
  1585. console.log('已连接服务器')
  1586. break
  1587. case 2002:
  1588. console.log('开始拉流')
  1589. break
  1590. case 2003:
  1591. console.log('网络接收到首个视频帧')
  1592. break
  1593. case 2004:
  1594. console.log('视频播放开始')
  1595. break
  1596. case 2005:
  1597. console.log('视频播放进度')
  1598. break
  1599. case 2006:
  1600. console.log('视频播放结束')
  1601. isPlaying.value = false
  1602. break
  1603. case 2007:
  1604. console.log('视频播放Loading')
  1605. break
  1606. case 2008:
  1607. console.log('解码器启动')
  1608. break
  1609. case 2009:
  1610. console.log('视频分辨率改变')
  1611. break
  1612. case -2301:
  1613. console.error('网络断连,且重新连接亦不能恢复,播放器已停止')
  1614. isPlaying.value = false
  1615. uni.showToast({
  1616. title: '网络断连,请重试',
  1617. icon: 'none'
  1618. })
  1619. break
  1620. case -2302:
  1621. console.error('获取加速拉流地址失败')
  1622. break
  1623. case 2101:
  1624. console.error('当前视频帧解码失败')
  1625. break
  1626. case 2102:
  1627. console.error('当前音频帧解码失败')
  1628. break
  1629. case 2103:
  1630. console.warn('网络断连, 已启动自动重连')
  1631. break
  1632. case 2104:
  1633. console.warn('网络断连, 重连中...')
  1634. break
  1635. case 2105:
  1636. console.log('网络断连, 重连成功')
  1637. break
  1638. case 2106:
  1639. console.error('网络断连, 重连失败')
  1640. break
  1641. case 2107:
  1642. console.error('播放器连接超时')
  1643. break
  1644. case 2108:
  1645. console.error('获取点播文件信息失败')
  1646. break
  1647. default:
  1648. console.log('其他状态:', state)
  1649. }
  1650. }
  1651. // 小程序全屏状态变化
  1652. const onFullscreenChange = (e) => {
  1653. isFullscreen.value = e.detail.fullScreen
  1654. console.log('全屏状态变化:', isFullscreen.value)
  1655. }
  1656. // 获取App(安卓/鸿蒙)环境使用的流地址
  1657. const getAppStreamUrl = computed(() => {
  1658. // ===== 诊断日志 =====
  1659. console.log('========== [诊断] getAppStreamUrl ==========')
  1660. console.log('fmp4StreamUrl:', deviceInfo.fmp4StreamUrl)
  1661. console.log('hlsStreamUrl:', deviceInfo.hlsStreamUrl)
  1662. // App iOS 优先使用 HLS
  1663. // #ifdef APP-PLUS
  1664. const platform = uni.getSystemInfoSync().platform
  1665. console.log('App 平台:', platform)
  1666. if (platform === 'ios') {
  1667. if (deviceInfo.hlsStreamUrl) {
  1668. console.log('App iOS 优先使用 hlsStreamUrl')
  1669. return deviceInfo.hlsStreamUrl
  1670. } else if (deviceInfo.fmp4StreamUrl) {
  1671. console.log('App iOS 无 hls,使用 fmp4 兜底')
  1672. return deviceInfo.fmp4StreamUrl
  1673. }
  1674. }
  1675. // #endif
  1676. // App Android / 鸿蒙:优先使用 fmp4
  1677. if (deviceInfo.fmp4StreamUrl) {
  1678. console.log('App 使用 fmp4StreamUrl')
  1679. return deviceInfo.fmp4StreamUrl
  1680. }
  1681. // 如果没有流地址,返回空字符串
  1682. console.warn('未获取到视频流地址')
  1683. return ''
  1684. })
  1685. // ===== 批次状态判断 =====
  1686. // 爱智农后台状态:1=待发布, 2=已发布, 3=已下线
  1687. const BATCH_STATUS_PENDING = '1'
  1688. const BATCH_STATUS_PUBLISHED = '2'
  1689. const BATCH_STATUS_OFFLINED = '3'
  1690. // 获取当前批次状态值
  1691. const batchStatus = computed(() => {
  1692. const data = traceInfo.value
  1693. if (!data) return ''
  1694. const s = String(data.status)
  1695. if ([BATCH_STATUS_PENDING, BATCH_STATUS_PUBLISHED, BATCH_STATUS_OFFLINED].includes(s)) {
  1696. return s
  1697. }
  1698. return ''
  1699. })
  1700. // 是否可展示完整溯源内容(仅已发布状态)
  1701. const canShowTraceContent = computed(() => batchStatus.value === BATCH_STATUS_PUBLISHED)
  1702. // 各状态布尔值
  1703. const isBatchPending = computed(() => batchStatus.value === BATCH_STATUS_PENDING)
  1704. const isBatchPublished = computed(() => batchStatus.value === BATCH_STATUS_PUBLISHED)
  1705. const isBatchOfflined = computed(() => batchStatus.value === BATCH_STATUS_OFFLINED)
  1706. const isBatchUnavailable = computed(() => !canShowTraceContent.value)
  1707. // 各状态文案映射
  1708. const batchStatusTextMap = {
  1709. [BATCH_STATUS_PENDING]: '待发布',
  1710. [BATCH_STATUS_PUBLISHED]: '已发布',
  1711. [BATCH_STATUS_OFFLINED]: '已下线'
  1712. }
  1713. // 各状态 badge 映射
  1714. const batchStatusBadgeMap = {
  1715. [BATCH_STATUS_PENDING]: { text: '待发布', type: 'wait' },
  1716. [BATCH_STATUS_PUBLISHED]: { text: '检验合格', type: 'ok' },
  1717. [BATCH_STATUS_OFFLINED]: { text: '已下线', type: 'muted' },
  1718. _invalid: { text: '未找到', type: 'muted' }
  1719. }
  1720. // 各状态异常态文案
  1721. const batchEmptyMessageMap = {
  1722. [BATCH_STATUS_PENDING]: '当前批次暂未开放查询,相关溯源内容暂不对外展示。',
  1723. [BATCH_STATUS_OFFLINED]: '当前批次已下线,相关溯源内容暂不对外展示。',
  1724. _invalid: '未找到对应溯源码信息,请确认二维码是否正确。'
  1725. }
  1726. // 获取当前状态对应的 badge
  1727. const getCurrentStatusBadge = () => {
  1728. const s = batchStatus.value
  1729. if (!s) return batchStatusBadgeMap._invalid
  1730. return batchStatusBadgeMap[s] || batchStatusBadgeMap._invalid
  1731. }
  1732. // 获取当前状态对应的异常态文案
  1733. const getCurrentEmptyMessage = () => {
  1734. const s = batchStatus.value
  1735. if (!s) return batchEmptyMessageMap._invalid
  1736. return batchEmptyMessageMap[s] || batchEmptyMessageMap._invalid
  1737. }
  1738. const traceDetail = computed(() => {
  1739. // 如果没有真实数据,返回 mock 数据
  1740. if (!traceInfo.value) {
  1741. return MOCK_TRACE_DETAILS[mockStateKey.value] || MOCK_TRACE_DETAILS.normal
  1742. }
  1743. const data = traceInfo.value
  1744. // 解析 certFiles 和 reportFiles(JSON 字符串转数组)
  1745. let certFiles = []
  1746. let reportFiles = []
  1747. // 查找 farmTimeline 中 stage === 'planting' 的节点,用于兜底种植时间
  1748. const plantingNode = Array.isArray(data.farmTimeline)
  1749. ? data.farmTimeline.find(item => item.stage === 'planting')
  1750. : null
  1751. try {
  1752. if (data.certificate?.certFiles) {
  1753. certFiles = JSON.parse(data.certificate.certFiles)
  1754. }
  1755. } catch (e) {
  1756. console.error('解析 certFiles 失败', e)
  1757. }
  1758. // 构建返回数据结构
  1759. return {
  1760. product: {
  1761. name: data.productName || '',
  1762. spec: data.productSpec || '',
  1763. image: data.productImage || '',
  1764. intro: data.productDesc || ''
  1765. },
  1766. farm: {
  1767. name: data.farmName || '',
  1768. location: data.farmRegion || '',
  1769. image: data.farmImage || '',
  1770. intro: data.farmIntro || ''
  1771. },
  1772. batch: {
  1773. status: batchStatus.value,
  1774. statusText: batchStatusTextMap[batchStatus.value] || '未找到',
  1775. exists: canShowTraceContent.value,
  1776. statusBadge: getCurrentStatusBadge(),
  1777. no: data.batchNo || '',
  1778. plantStartTime: '2026-03-01',
  1779. harvestTime: data.produceDate || '',
  1780. packTime: data.packageDate || '',
  1781. emptyTitle: '暂无相关溯源码信息',
  1782. emptyMessage: getCurrentEmptyMessage()
  1783. },
  1784. report: {
  1785. status: data.reports && data.reports.length > 0 ? 'uploaded' : 'pending',
  1786. statusBadge: data.reports && data.reports.length > 0
  1787. ? { text: '已上传', type: 'ok' }
  1788. : { text: '待补充', type: 'wait' },
  1789. emptyMessage: '检测报告待补充,上传完成后可查看大图。',
  1790. items: (data.reports || []).map(report => {
  1791. let images = []
  1792. // 处理 reportFiles:可能是字符串 URL、JSON 字符串数组、或已解析的数组
  1793. if (report.reportFiles) {
  1794. if (typeof report.reportFiles === 'string') {
  1795. // 尝试解析 JSON 字符串
  1796. try {
  1797. const parsed = JSON.parse(report.reportFiles)
  1798. // 如果解析成功且是数组,提取 url 字段
  1799. if (Array.isArray(parsed)) {
  1800. images = parsed.map(item =>
  1801. typeof item === 'string' ? item : (item.url || item)
  1802. ).filter(Boolean)
  1803. } else {
  1804. // 解析后不是数组,可能是单个对象
  1805. images = [parsed.url || parsed].filter(Boolean)
  1806. }
  1807. } catch (e) {
  1808. // 解析失败,当作普通 URL 字符串处理
  1809. images = [report.reportFiles]
  1810. }
  1811. } else if (Array.isArray(report.reportFiles)) {
  1812. // 已经是数组,提取 url 字段
  1813. images = report.reportFiles.map(item =>
  1814. typeof item === 'string' ? item : (item.url || item)
  1815. ).filter(Boolean)
  1816. } else if (typeof report.reportFiles === 'object') {
  1817. // 单个对象
  1818. images = [report.reportFiles.url || report.reportFiles].filter(Boolean)
  1819. }
  1820. }
  1821. return {
  1822. detectDate: report.reportDate || '',
  1823. no: report.reportNo || '',
  1824. images: images
  1825. }
  1826. })
  1827. },
  1828. certificate: {
  1829. status: data.certificate && certFiles.length > 0 ? 'uploaded' : 'pending',
  1830. statusBadge: data.certificate && certFiles.length > 0
  1831. ? { text: '已上传', type: 'ok' }
  1832. : { text: '待补充', type: 'wait' },
  1833. issueDate: data.certificate?.certIssueDate || '',
  1834. no: data.certificate?.certNo || '',
  1835. fileUrl: certFiles.length > 0 ? certFiles[0].url : '',
  1836. images: certFiles.map(f => f.url),
  1837. emptyMessage: '合格证待补充,上传完成后可查看大图。'
  1838. },
  1839. traceConclusionCard: {
  1840. title: '溯源结论',
  1841. conclusion: '本批次产品来源清晰,已完成安全检测,过程可查',
  1842. desc: '检测材料与溯源数据已展示,可继续查看',
  1843. passed: true
  1844. },
  1845. // 时间轴逻辑:演示态使用 mock + 真实态使用真实数据
  1846. farmTimeline: (() => {
  1847. // 判断是否有真实时间轴数据
  1848. const hasRealTimeline = data.startPlantingTime == '' || data.startPlantingTime == null
  1849. let timeline = []
  1850. if(!hasRealTimeline){
  1851. // 开始种植
  1852. if (data.startPlantingTime) {
  1853. timeline.push({
  1854. time: data.startPlantingTime,
  1855. stage: 'planting',
  1856. title: '开始种植',
  1857. desc: '本批次产品进入种植管理阶段'
  1858. })
  1859. }
  1860. // 生长养护
  1861. if (data.growingPeriodTime) {
  1862. timeline.push({
  1863. time: data.growingPeriodTime,
  1864. stage: 'care',
  1865. title: '生长期养护',
  1866. desc: '种植期间已持续开展灌溉、施肥等日常养护'
  1867. })
  1868. }
  1869. // 田间巡检
  1870. if (data.inspectionTime) {
  1871. timeline.push({
  1872. time: data.inspectionTime,
  1873. stage: 'inspection',
  1874. title: '田间巡检',
  1875. desc: '种植期间已持续开展长势检查与环境巡检'
  1876. })
  1877. }
  1878. // 成熟采收
  1879. if (data.produceDate) {
  1880. timeline.push({
  1881. time: data.produceDate,
  1882. stage: 'harvest',
  1883. title: '成熟采收',
  1884. desc: '本批次产品进入成熟采收阶段'
  1885. })
  1886. }
  1887. // 安全检测
  1888. if (data.reports && data.reports.length > 0) {
  1889. const validDates = data.reports
  1890. .map(r => r.reportDate)
  1891. .filter(d => d && /^\d{4}-\d{2}-\d{2}/.test(d))
  1892. .sort()
  1893. if (validDates.length > 0) {
  1894. timeline.push({
  1895. time: validDates[0],
  1896. stage: 'test',
  1897. title: '安全检测',
  1898. desc: '已完成安全检测,相关结果可查'
  1899. })
  1900. }
  1901. }else{
  1902. const validDates = data.certificate
  1903. if (validDates) {
  1904. timeline.push({
  1905. time: validDates.certIssueDate,
  1906. stage: 'test',
  1907. title: '安全检测',
  1908. desc: '已完成安全检测,相关结果可查'
  1909. })
  1910. }
  1911. }
  1912. // 包装出库
  1913. if (data.packageDate) {
  1914. timeline.push({
  1915. time: data.packageDate,
  1916. stage: 'pack',
  1917. title: '包装日期:出库',
  1918. desc: '已完成包装日期:整理,进入销售流通环节'
  1919. })
  1920. }
  1921. }
  1922. // stage 顺序权重
  1923. const stageOrder = {
  1924. planting: 1,
  1925. care: 2,
  1926. inspection: 3,
  1927. harvest: 4,
  1928. test: 5,
  1929. pack: 6
  1930. }
  1931. // 按业务阶段排序,同 stage 内再按时间
  1932. timeline.sort((a, b) => {
  1933. const orderA = stageOrder[a.stage] || 99
  1934. const orderB = stageOrder[b.stage] || 99
  1935. // 先按 stage 排序
  1936. if (orderA !== orderB) {
  1937. return orderA - orderB
  1938. }
  1939. // 同 stage 再按时间
  1940. if (!a.time) return -1
  1941. if (!b.time) return 1
  1942. return a.time > b.time ? 1 : -1
  1943. })
  1944. return timeline.slice(0, 6)
  1945. }
  1946. )(),
  1947. camera: {
  1948. liveUrl: data.camera?.liveUrl || '',
  1949. coverImage: data.camera?.coverImage || '',
  1950. status: data.camera?.status || 'online',
  1951. desc: data.camera?.liveUrl
  1952. ? '当前为种植现场实时画面,现场环境与种植状态可见'
  1953. : '来自农场实景画面,种植环境真实呈现'
  1954. },
  1955. environment: {
  1956. summary: '本批次种植期环境稳定,整体处于适宜生长区间',
  1957. chart: {
  1958. type: 'npk_trend',
  1959. labels: weatherData.value.labels,
  1960. values: {
  1961. n: weatherData.value.values.n,
  1962. p: weatherData.value.values.p,
  1963. k: weatherData.value.values.k
  1964. }
  1965. },
  1966. items: weatherData.value.items,
  1967. current: {
  1968. temperature: '24.5℃',
  1969. humidity: '42.2%'
  1970. }
  1971. }
  1972. }
  1973. })
  1974. // 种植现场状态:三态逻辑
  1975. const cameraStatus = computed(() => {
  1976. const camera = deviceInfo?.status
  1977. if (!camera) return 'off'
  1978. // const hasLiveUrl = !!camera.liveUrl
  1979. // 有 liveUrl 但无封面图 → loading(信号接入中)
  1980. // 有 liveUrl 且有封面图 → online(可播放)
  1981. // 无 liveUrl → offline
  1982. if (camera && camera == 'off') {
  1983. return 'loading'
  1984. }
  1985. if (camera && camera == 'ON') {
  1986. return 'online'
  1987. }
  1988. return 'offline'
  1989. })
  1990. const cameraStatusText = computed(() => {
  1991. const map = {
  1992. loading: '连接中',
  1993. online: '实时在线',
  1994. offline: '暂未连接'
  1995. }
  1996. return map[cameraStatus.value] || '暂未连接'
  1997. })
  1998. // 种植环境记录图表配置
  1999. const CHART_SVG_WIDTH = 700
  2000. const CHART_SVG_HEIGHT = 200
  2001. const CHART_PADDING = 24 // SVG 内边距
  2002. // 动态计算数据范围(从真实数据中获取,并留上下边距)
  2003. const chartValueRange = computed(() => {
  2004. const chart = traceDetail.value?.environment?.chart
  2005. if (!chart?.values) {
  2006. return { min: 0, max: 1 }
  2007. }
  2008. const allValues = [
  2009. ...(chart.values.n || []),
  2010. ...(chart.values.p || []),
  2011. ...(chart.values.k || [])
  2012. ].filter(v => typeof v === 'number' && !Number.isNaN(v))
  2013. if (!allValues.length) {
  2014. return { min: 0, max: 1 }
  2015. }
  2016. const min = Math.min(...allValues)
  2017. const max = Math.max(...allValues)
  2018. // 增加上下留白,避免点贴边
  2019. const padding = (max - min) * 0.18 || 1
  2020. return {
  2021. min: min - padding,
  2022. max: max + padding
  2023. }
  2024. })
  2025. // 计算单个数据点在 SVG 坐标中的 y 值(使用动态范围)
  2026. const getSvgY = (value) => {
  2027. const { min, max } = chartValueRange.value
  2028. const range = max - min
  2029. if (range === 0) return CHART_SVG_HEIGHT / 2
  2030. const normalized = (value - min) / range
  2031. const innerHeight = CHART_SVG_HEIGHT - CHART_PADDING * 2
  2032. const y = CHART_PADDING + innerHeight * (1 - normalized)
  2033. return y
  2034. }
  2035. // 计算单个数据点在 SVG 坐标中的 x 值
  2036. const getSvgX = (idx, dataLength) => {
  2037. if (dataLength <= 1) return CHART_SVG_WIDTH / 2
  2038. const innerWidth = CHART_SVG_WIDTH - CHART_PADDING * 2
  2039. return CHART_PADDING + (idx / (dataLength - 1)) * innerWidth
  2040. }
  2041. // 获取某组数据的所有点位(过滤无效数据)
  2042. const getSvgPoints = (data) => {
  2043. if (!Array.isArray(data) || data.length === 0) return []
  2044. return data
  2045. .filter(v => typeof v === 'number' && !Number.isNaN(v))
  2046. .map((val, idx, arr) => ({
  2047. x: getSvgX(idx, arr.length),
  2048. y: getSvgY(val),
  2049. value: val
  2050. }))
  2051. }
  2052. // Catmull-Rom 转 Bezier 生成平滑曲线路径
  2053. const buildSmoothPath = (points) => {
  2054. if (points.length < 2) return ''
  2055. if (points.length === 2) {
  2056. return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`
  2057. }
  2058. // 起点
  2059. let d = `M ${points[0].x} ${points[0].y}`
  2060. // 中间点使用 Catmull-Rom 转 Bezier
  2061. for (let i = 0; i < points.length - 1; i++) {
  2062. const p0 = points[Math.max(0, i - 1)]
  2063. const p1 = points[i]
  2064. const p2 = points[i + 1]
  2065. const p3 = points[Math.min(points.length - 1, i + 2)]
  2066. // 控制点计算(张力系数 0.5)
  2067. const cp1x = p1.x + (p2.x - p0.x) / 6
  2068. const cp1y = p1.y + (p2.y - p0.y) / 6
  2069. const cp2x = p2.x - (p3.x - p1.x) / 6
  2070. const cp2y = p2.y - (p3.y - p1.y) / 6
  2071. d += ` C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p2.x} ${p2.y}`
  2072. }
  2073. return d
  2074. }
  2075. // SVG 网格线 y 坐标
  2076. const svgGridLines = [24, 56, 88, 120, 152, 176]
  2077. // 平滑曲线配置
  2078. const CURVE_TENSION = 0.35 // 张力系数,越小越平滑
  2079. // 统一的图表计算 computed(确保所有依赖正确响应式)
  2080. const chartData = computed(() => {
  2081. const chart = traceDetail.value?.environment?.chart
  2082. if (!chart || !chart.values) {
  2083. return { n: [], p: [], k: [], paths: { n: '', p: '', k: '' }, areas: { n: '', p: '', k: '' } }
  2084. }
  2085. const valuesN = chart.values.n || []
  2086. const valuesP = chart.values.p || []
  2087. const valuesK = chart.values.k || []
  2088. // 收集所有有效数值,计算全局范围
  2089. const allValues = [...valuesN, ...valuesP, ...valuesK]
  2090. .filter(v => typeof v === 'number' && !Number.isNaN(v))
  2091. if (!allValues.length) {
  2092. return { n: [], p: [], k: [], paths: { n: '', p: '', k: '' }, areas: { n: '', p: '', k: '' } }
  2093. }
  2094. const dataMin = Math.min(...allValues)
  2095. const dataMax = Math.max(...allValues)
  2096. const padding = (dataMax - dataMin) * 0.25 || 1 // 增加边距空间
  2097. const minVal = dataMin - padding
  2098. const maxVal = dataMax + padding
  2099. const range = maxVal - minVal || 1
  2100. // 计算坐标的辅助函数
  2101. const calcY = (val) => {
  2102. const normalized = (val - minVal) / range
  2103. const innerHeight = CHART_SVG_HEIGHT - CHART_PADDING * 2
  2104. return CHART_PADDING + innerHeight * (1 - normalized)
  2105. }
  2106. const calcX = (idx, length) => {
  2107. if (length <= 1) return CHART_SVG_WIDTH / 2
  2108. const innerWidth = CHART_SVG_WIDTH - CHART_PADDING * 2
  2109. return CHART_PADDING + (idx / (length - 1)) * innerWidth
  2110. }
  2111. // 异常点平滑处理(简单移动平均)
  2112. const smoothValues = (data) => {
  2113. if (data.length < 3) return data
  2114. return data.map((v, i, arr) => {
  2115. if (i === 0 || i === arr.length - 1) return v
  2116. const prev = arr[i - 1]
  2117. const next = arr[i + 1]
  2118. // 如果与前后差值过大,做轻微平滑
  2119. if (Math.abs(v - prev) > range * 0.3 && Math.abs(v - next) > range * 0.3) {
  2120. return (prev + v + next) / 3
  2121. }
  2122. return v
  2123. })
  2124. }
  2125. // 计算点坐标(带平滑)
  2126. const calcPoints = (data) => {
  2127. if (!data.length) return []
  2128. const smoothed = smoothValues(data.filter(v => typeof v === 'number' && !Number.isNaN(v)))
  2129. return smoothed.map((val, idx, arr) => ({
  2130. x: calcX(idx, arr.length),
  2131. y: calcY(val),
  2132. value: val
  2133. }))
  2134. }
  2135. // 生成平滑曲线路径(使用优化的张力系数)
  2136. const buildPath = (points) => {
  2137. if (points.length < 2) return ''
  2138. if (points.length === 2) {
  2139. return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`
  2140. }
  2141. let d = `M ${points[0].x} ${points[0].y}`
  2142. for (let i = 0; i < points.length - 1; i++) {
  2143. const p0 = points[Math.max(0, i - 1)]
  2144. const p1 = points[i]
  2145. const p2 = points[i + 1]
  2146. const p3 = points[Math.min(points.length - 1, i + 2)]
  2147. // 使用可配置的张力系数
  2148. const cp1x = p1.x + (p2.x - p0.x) * CURVE_TENSION
  2149. const cp1y = p1.y + (p2.y - p0.y) * CURVE_TENSION
  2150. const cp2x = p2.x - (p3.x - p1.x) * CURVE_TENSION
  2151. const cp2y = p2.y - (p3.y - p1.y) * CURVE_TENSION
  2152. d += ` C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p2.x} ${p2.y}`
  2153. }
  2154. return d
  2155. }
  2156. // 生成面积渐变路径(曲线下方填充)
  2157. const buildArea = (points) => {
  2158. if (points.length < 2) return ''
  2159. const linePath = buildPath(points)
  2160. const bottomY = CHART_SVG_HEIGHT - CHART_PADDING
  2161. const firstX = points[0].x
  2162. const lastX = points[points.length - 1].x
  2163. return `${linePath} L ${lastX} ${bottomY} L ${firstX} ${bottomY} Z`
  2164. }
  2165. const nPoints = calcPoints(valuesN)
  2166. const pPoints = calcPoints(valuesP)
  2167. const kPoints = calcPoints(valuesK)
  2168. return {
  2169. n: nPoints,
  2170. p: pPoints,
  2171. k: kPoints,
  2172. paths: {
  2173. n: buildPath(nPoints),
  2174. p: buildPath(pPoints),
  2175. k: buildPath(kPoints)
  2176. },
  2177. areas: {
  2178. n: buildArea(nPoints),
  2179. p: buildArea(pPoints),
  2180. k: buildArea(kPoints)
  2181. }
  2182. }
  2183. })
  2184. // 兼容旧接口
  2185. const chartPoints = computed(() => ({
  2186. n: chartData.value.n,
  2187. p: chartData.value.p,
  2188. k: chartData.value.k
  2189. }))
  2190. const chartPaths = computed(() => chartData.value.paths)
  2191. const chartAreas = computed(() => chartData.value.areas)
  2192. // 智能计算 X 轴标签:根据数据量和日期跨度决定哪些显示
  2193. const chartXAxisLabels = computed(() => {
  2194. const labels = traceDetail.value?.environment?.chart?.labels || []
  2195. if (!labels.length) return []
  2196. // 如果标签数量 <= 7,全部显示
  2197. if (labels.length <= 7) {
  2198. return labels.map(label => ({ label, hidden: false }))
  2199. }
  2200. // 数量 > 7,需要智能抽取
  2201. const result = []
  2202. const total = labels.length
  2203. // 计算最大显示数量(根据容器宽度,每个标签最小约 60px)
  2204. const avgSpacing = 700 / total
  2205. if (avgSpacing < 60) {
  2206. // 标签太密集,只显示首尾 + 每隔一段显示一个
  2207. const step = Math.max(1, Math.floor(total / 6))
  2208. for (let i = 0; i < total; i++) {
  2209. if (i === 0 || i === total - 1 || i % step === 0) {
  2210. result.push({ label: labels[i], hidden: false })
  2211. } else {
  2212. result.push({ label: '', hidden: true })
  2213. }
  2214. }
  2215. } else {
  2216. // 标签间距足够,每隔一个显示
  2217. for (let i = 0; i < total; i++) {
  2218. if (i % 2 === 0) {
  2219. result.push({ label: labels[i], hidden: false })
  2220. } else {
  2221. result.push({ label: '', hidden: true })
  2222. }
  2223. }
  2224. }
  2225. return result
  2226. })
  2227. const reportImages = computed(() => {
  2228. const items = traceDetail.value?.report?.items
  2229. if (Array.isArray(items)) {
  2230. return items.flatMap(item => Array.isArray(item.images) ? item.images : [])
  2231. }
  2232. return []
  2233. })
  2234. const reportItems = computed(() => {
  2235. return traceDetail.value?.report?.items || []
  2236. })
  2237. // 计算某份报告内某张图在全局 reportImages 扁平数组中的索引
  2238. function getReportGlobalIndex(itemIndex, imgIndex) {
  2239. const items = reportItems.value
  2240. let offset = 0
  2241. for (let i = 0; i < itemIndex; i++) {
  2242. const imgArr = items[i]?.images
  2243. offset += Array.isArray(imgArr) ? imgArr.length : 0
  2244. }
  2245. return offset + imgIndex
  2246. }
  2247. const certificateImages = computed(() => {
  2248. const c = traceDetail.value?.certificate
  2249. if (!c) return []
  2250. if (Array.isArray(c.images) && c.images.length) return c.images
  2251. return c.fileUrl ? [c.fileUrl] : []
  2252. })
  2253. function contactCustomer() {
  2254. uni.makePhoneCall({
  2255. phoneNumber: '13379508760'
  2256. })
  2257. }
  2258. function goToWechatStore() {
  2259. const url = 'https://store.weixin.qq.com/shop/a/MfixzaIsuMchTDd'
  2260. // #ifdef H5
  2261. window.location.href = url
  2262. // #endif
  2263. // #ifndef H5
  2264. uni.setClipboardData({
  2265. data: url,
  2266. success: () => {
  2267. uni.showToast({ title: '链接已复制,请在浏览器打开', icon: 'none' })
  2268. }
  2269. })
  2270. // #endif
  2271. }
  2272. function goBackToPurchase() {
  2273. uni.showModal({
  2274. title: '返回购买渠道',
  2275. content: 'mock 模式:后续可跳转到直播间/小店页面。',
  2276. showCancel: true,
  2277. confirmText: '确认返回'
  2278. })
  2279. }
  2280. function previewDoc(kind, index) {
  2281. const urls = kind === 'report' ? reportImages.value : certificateImages.value
  2282. if (!urls.length) {
  2283. uni.showToast({ title: '该文件暂未上传', icon: 'none' })
  2284. return
  2285. }
  2286. uni.previewImage({
  2287. urls,
  2288. current: urls[index] || urls[0]
  2289. })
  2290. }
  2291. </script>
  2292. <style scoped>
  2293. .page {
  2294. position: relative;
  2295. min-height: 100vh;
  2296. --bg-cream-1: #f8f2e8;
  2297. --bg-cream-2: #f3ebdd;
  2298. --bg-cream-3: #ece1ce;
  2299. --forest-900: #143a2b;
  2300. --forest-800: #1f513b;
  2301. --forest-700: #2d6849;
  2302. --sage-500: #708f7d;
  2303. --gold-320: #ccb086;
  2304. --gold-260: #dcc4a0;
  2305. --text-900: #233126;
  2306. --text-700: #3c4d41;
  2307. --text-500: #6b776d;
  2308. background: linear-gradient(172deg,
  2309. #FAF6EF 0%,
  2310. #F4EEE3 38%,
  2311. #EDF0EC 68%,
  2312. #E8EFE9 100%
  2313. );
  2314. overflow: hidden;
  2315. }
  2316. /* 背景氛围层:三层光感(前景/中景/背景)+ grain */
  2317. .pageDecor {
  2318. position: fixed;
  2319. inset: 0;
  2320. pointer-events: none;
  2321. z-index: 0;
  2322. }
  2323. .pageGlow {
  2324. position: absolute;
  2325. border-radius: 50%;
  2326. filter: blur(14rpx);
  2327. }
  2328. /* 背景层:左上森林绿微光 */
  2329. .glowA {
  2330. width: 780rpx;
  2331. height: 780rpx;
  2332. top: -280rpx;
  2333. left: -300rpx;
  2334. background: radial-gradient(circle, rgba(26, 84, 58, 0.18) 0%, rgba(20, 72, 50, 0) 70%);
  2335. opacity: 0.85;
  2336. }
  2337. /* 中景层:右下金色暖光 */
  2338. .glowB {
  2339. width: 720rpx;
  2340. height: 720rpx;
  2341. right: -280rpx;
  2342. top: 480rpx;
  2343. background: radial-gradient(circle, rgba(200, 170, 120, 0.2) 0%, rgba(200, 170, 120, 0) 72%);
  2344. opacity: 0.9;
  2345. }
  2346. /* 前景层:顶部柔和高光,塑造空间感 */
  2347. .glowC {
  2348. width: 600rpx;
  2349. height: 360rpx;
  2350. top: -60rpx;
  2351. left: 50%;
  2352. transform: translateX(-50%);
  2353. background: radial-gradient(ellipse at 50% 0%, rgba(255, 252, 246, 0.38), transparent 70%);
  2354. filter: blur(20rpx);
  2355. opacity: 0.7;
  2356. }
  2357. /* 纹理叠加层 */
  2358. .pageGrain {
  2359. position: absolute;
  2360. inset: 0;
  2361. opacity: 0.55;
  2362. background:
  2363. radial-gradient(900rpx 380rpx at 48% -4%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
  2364. radial-gradient(640rpx 400rpx at 104% 48%, rgba(68, 112, 86, 0.09), rgba(68, 112, 86, 0)),
  2365. radial-gradient(700rpx 320rpx at -4% 76%, rgba(210, 180, 130, 0.12), rgba(210, 180, 130, 0)),
  2366. linear-gradient(180deg, rgba(248, 244, 236, 0.16) 0%, rgba(228, 242, 232, 0.08) 100%);
  2367. }
  2368. .safeTop {
  2369. height: calc(env(safe-area-inset-top));
  2370. position: relative;
  2371. z-index: 1;
  2372. }
  2373. /* 轻品牌页头:透明底,不叠在 Hero 上产生「白雾」;层级低于首屏卡 */
  2374. .brandPageHeader {
  2375. position: relative;
  2376. z-index: 2;
  2377. display: flex;
  2378. align-items: center;
  2379. min-height: 72rpx;
  2380. padding: 0 40rpx;
  2381. box-sizing: border-box;
  2382. border-bottom: 1rpx solid rgba(39, 75, 57, 0.05);
  2383. background: transparent;
  2384. }
  2385. .brandPageHeaderInner {
  2386. display: flex;
  2387. align-items: center;
  2388. gap: 10rpx;
  2389. width: 100%;
  2390. }
  2391. .brandPageHeaderName {
  2392. font-size: 22rpx;
  2393. font-weight: 600;
  2394. line-height: 1.15;
  2395. letter-spacing: 0.1em;
  2396. color: rgba(27, 41, 33, 0.65);
  2397. }
  2398. .brandPageHeaderDot {
  2399. flex-shrink: 0;
  2400. width: 4rpx;
  2401. height: 4rpx;
  2402. border-radius: 50%;
  2403. background: rgba(39, 113, 76, 0.4);
  2404. }
  2405. .brandPageHeaderLabel {
  2406. font-size: 20rpx;
  2407. font-weight: 400;
  2408. line-height: 1.15;
  2409. letter-spacing: 0.06em;
  2410. color: rgba(112, 143, 125, 0.7);
  2411. }
  2412. .hero,
  2413. .content {
  2414. position: relative;
  2415. z-index: 1;
  2416. }
  2417. .hero {
  2418. padding: 0 24rpx;
  2419. }
  2420. /* 完整首屏大卡:与品牌页头分离,避免负 margin 上提后被页头遮盖 */
  2421. .heroCard {
  2422. border-radius: 42rpx;
  2423. overflow: hidden;
  2424. margin-top: 20rpx;
  2425. position: relative;
  2426. z-index: 4;
  2427. box-shadow:
  2428. 0 48rpx 120rpx rgba(10, 36, 24, 0.2),
  2429. 0 16rpx 48rpx rgba(10, 36, 24, 0.1),
  2430. 0 2rpx 0 rgba(255, 255, 255, 0.6) inset;
  2431. backdrop-filter: blur(4px);
  2432. }
  2433. /* Hero 视觉区:多层次光感空间,顶部高光 + 景深 + 底部暗化 */
  2434. .heroBg {
  2435. position: relative;
  2436. width: 100%;
  2437. height: 0;
  2438. padding-bottom: 56.25%;
  2439. overflow: hidden;
  2440. background: linear-gradient(160deg, rgba(20, 74, 52, 0.72), rgba(205, 177, 129, 0.3) 70%, rgba(243, 232, 214, 0.36));
  2441. }
  2442. /* 前景层光晕:右下淡金色微光(提升质感) */
  2443. .heroBg::before {
  2444. content: '';
  2445. position: absolute;
  2446. right: -100rpx;
  2447. bottom: -72rpx;
  2448. width: 520rpx;
  2449. height: 280rpx;
  2450. border-radius: 50%;
  2451. background: radial-gradient(ellipse at 42% 38%, rgba(252, 244, 228, 0.18), transparent 68%);
  2452. pointer-events: none;
  2453. z-index: 2;
  2454. }
  2455. .heroImage {
  2456. position: absolute;
  2457. inset: 0;
  2458. width: 100%;
  2459. height: 100%;
  2460. display: block;
  2461. z-index: 1;
  2462. }
  2463. .heroBrandAnchor {
  2464. position: absolute;
  2465. right: -48rpx;
  2466. bottom: -14rpx;
  2467. z-index: 2;
  2468. pointer-events: none;
  2469. }
  2470. .heroBrandAnchorText {
  2471. font-size: 164rpx;
  2472. font-weight: 700;
  2473. letter-spacing: 0.1em;
  2474. line-height: 1;
  2475. color: rgba(248, 241, 227, 0.045);
  2476. transform: rotate(-8deg);
  2477. }
  2478. /* Hero 遮罩层:提亮后仍保留轻微底部过渡,避免压住真实商品图 */
  2479. .heroMask {
  2480. position: absolute;
  2481. inset: 0;
  2482. z-index: 3;
  2483. background:
  2484. radial-gradient(ellipse 180% 60% at 50% 0%, rgba(255, 252, 248, 0.26), transparent 68%),
  2485. radial-gradient(480rpx 240rpx at 90% 8%, rgba(252, 248, 240, 0.2), transparent 62%),
  2486. radial-gradient(700rpx 360rpx at 8% 65%, rgba(6, 24, 16, 0.12), transparent 58%),
  2487. radial-gradient(560rpx 300rpx at 88% 80%, rgba(205, 177, 129, 0.06), transparent 62%),
  2488. linear-gradient(180deg,
  2489. rgba(8, 28, 18, 0) 0%,
  2490. rgba(8, 28, 18, 0) 62%,
  2491. rgba(10, 36, 24, 0.05) 80%,
  2492. rgba(8, 26, 18, 0.1) 92%,
  2493. rgba(248, 244, 238, 0.12) 100%
  2494. );
  2495. }
  2496. /* 商品信息面板:玻璃浮层效果,负margin上浮 + backdrop-filter */
  2497. .heroInfoPanel {
  2498. background: rgba(252, 248, 242, 0.88);
  2499. backdrop-filter: blur(14px);
  2500. -webkit-backdrop-filter: blur(14px);
  2501. position: relative;
  2502. }
  2503. /* 与 Hero 底部自然过渡 */
  2504. .heroInfoPanel::before {
  2505. content: '';
  2506. position: absolute;
  2507. top: -56rpx;
  2508. left: 0;
  2509. right: 0;
  2510. height: 56rpx;
  2511. background: linear-gradient(180deg,
  2512. rgba(252, 248, 242, 0) 0%,
  2513. rgba(252, 248, 242, 0.88) 100%
  2514. );
  2515. pointer-events: none;
  2516. z-index: 1;
  2517. }
  2518. .infoPanelInner {
  2519. position: relative;
  2520. z-index: 2;
  2521. padding: 32rpx 30rpx 30rpx;
  2522. }
  2523. /* 与下方农场/批次等卡片共用 .sectionHeader / .sectionHeaderLeft 样式 */
  2524. .infoPanelBody {
  2525. padding-top: 0;
  2526. }
  2527. .infoPanelName {
  2528. display: block;
  2529. font-size: 30rpx;
  2530. font-weight: 600;
  2531. line-height: 1.4;
  2532. letter-spacing: 0.01em;
  2533. color: rgba(27, 41, 33, 0.92);
  2534. }
  2535. .infoPanelSpec {
  2536. display: inline-flex;
  2537. align-items: center;
  2538. gap: 10rpx;
  2539. margin-top: 14rpx;
  2540. padding: 8rpx 16rpx;
  2541. border-radius: 20rpx;
  2542. background: rgba(39, 113, 76, 0.06);
  2543. border: 1rpx solid rgba(39, 113, 76, 0.08);
  2544. }
  2545. .specDot {
  2546. width: 6rpx;
  2547. height: 6rpx;
  2548. border-radius: 50%;
  2549. background: rgba(39, 113, 76, 0.5);
  2550. }
  2551. .specText {
  2552. font-size: 20rpx;
  2553. font-weight: 400;
  2554. color: rgba(54, 66, 57, 0.85);
  2555. }
  2556. .infoPanelIntro {
  2557. margin-top: 16rpx;
  2558. padding-top: 16rpx;
  2559. border-top: 1rpx solid rgba(39, 75, 57, 0.06);
  2560. font-size: 23rpx;
  2561. line-height: 1.8;
  2562. color: rgba(54, 66, 57, 0.75);
  2563. }
  2564. .purchaseBanner {
  2565. margin-top: 20rpx;
  2566. padding: 20rpx 24rpx;
  2567. background: linear-gradient(135deg, rgba(39, 75, 57, 0.04) 0%, rgba(39, 75, 57, 0.08) 100%);
  2568. border-radius: 20rpx;
  2569. border: 1rpx solid rgba(39, 75, 57, 0.08);
  2570. }
  2571. .purchaseBannerInner {
  2572. display: flex;
  2573. flex-direction: column;
  2574. align-items: flex-start;
  2575. gap: 8rpx;
  2576. }
  2577. .purchaseBannerTitle {
  2578. font-size: 24rpx;
  2579. font-weight: 600;
  2580. color: rgba(39, 75, 57, 0.9);
  2581. }
  2582. .purchaseBannerText {
  2583. font-size: 22rpx;
  2584. color: rgba(54, 66, 57, 0.65);
  2585. }
  2586. .purchaseBannerBtn {
  2587. margin-top: 6rpx;
  2588. padding: 10rpx 20rpx;
  2589. background: rgba(39, 75, 57, 0.08);
  2590. border-radius: 40rpx;
  2591. border: 1rpx solid rgba(39, 75, 57, 0.15);
  2592. }
  2593. .purchaseBannerBtn text {
  2594. font-size: 22rpx;
  2595. color: rgba(39, 75, 57, 0.85);
  2596. }
  2597. .content {
  2598. padding: 20rpx 0 40rpx;
  2599. }
  2600. /* 加载中状态:轻量提示,不闪异常态 */
  2601. .loadingState {
  2602. margin: 40rpx 24rpx;
  2603. padding: 60rpx 32rpx;
  2604. border-radius: 36rpx;
  2605. background: rgba(252, 250, 244, 0.76);
  2606. display: flex;
  2607. justify-content: center;
  2608. align-items: center;
  2609. }
  2610. .loadingText {
  2611. font-size: 24rpx;
  2612. font-weight: 400;
  2613. color: rgba(84, 106, 93, 0.65);
  2614. letter-spacing: 0.02em;
  2615. }
  2616. /* 异常态空状态卡:与页面整体风格一致的轻量提示 */
  2617. .abnormalStateCard {
  2618. margin: 40rpx 24rpx;
  2619. padding: 40rpx 32rpx;
  2620. border-radius: 36rpx;
  2621. background: rgba(252, 250, 244, 0.76);
  2622. box-shadow:
  2623. 0 16rpx 40rpx rgba(38, 41, 32, 0.07),
  2624. 0 1rpx 0 rgba(255, 255, 255, 0.5) inset;
  2625. }
  2626. .abnormalStateCard .sectionHeader {
  2627. margin-bottom: 20rpx;
  2628. }
  2629. .abnormalStateCard .emptyText {
  2630. font-size: 24rpx;
  2631. line-height: 1.8;
  2632. color: rgba(54, 66, 57, 0.7);
  2633. margin-top: 16rpx;
  2634. }
  2635. /* 基础卡片:半透明玻璃质感 */
  2636. .card {
  2637. margin: 0 24rpx 22rpx;
  2638. padding: 30rpx 28rpx;
  2639. border-radius: 36rpx;
  2640. background: rgba(252, 250, 244, 0.76);
  2641. box-shadow:
  2642. 0 16rpx 40rpx rgba(38, 41, 32, 0.07),
  2643. 0 1rpx 0 rgba(255, 255, 255, 0.5) inset;
  2644. backdrop-filter: blur(8px);
  2645. -webkit-backdrop-filter: blur(8px);
  2646. }
  2647. .card.soft {
  2648. background: rgba(252, 248, 244, 0.6);
  2649. }
  2650. /* Hero 之后第一张卡:适度上浮 */
  2651. .cardHeroFirst {
  2652. margin-top: -28rpx;
  2653. position: relative;
  2654. z-index: 3;
  2655. }
  2656. /* 层级 0:与 Hero 同级,主卡(商品面板) */
  2657. .cardLevel0 {
  2658. box-shadow:
  2659. 0 48rpx 120rpx rgba(10, 36, 24, 0.16),
  2660. 0 16rpx 48rpx rgba(10, 36, 24, 0.08),
  2661. 0 1rpx 0 rgba(255, 255, 255, 0.6) inset;
  2662. }
  2663. /* 层级 1:次要信息卡,阴影中等 */
  2664. .cardLevel1 {
  2665. box-shadow:
  2666. 0 20rpx 50rpx rgba(30, 34, 24, 0.09),
  2667. 0 8rpx 24rpx rgba(30, 34, 24, 0.05),
  2668. 0 1rpx 0 rgba(255, 255, 255, 0.55) inset;
  2669. }
  2670. /* 层级 2:次次要信息卡,阴影更轻 */
  2671. .cardLevel2 {
  2672. box-shadow:
  2673. 0 14rpx 36rpx rgba(36, 38, 28, 0.065),
  2674. 0 1rpx 0 rgba(255, 255, 255, 0.5) inset;
  2675. }
  2676. /* 层级 3:底部辅助信息卡,最轻 */
  2677. .cardLevel3 {
  2678. box-shadow:
  2679. 0 8rpx 22rpx rgba(42, 44, 30, 0.04),
  2680. 0 1rpx 0 rgba(255, 255, 255, 0.44) inset;
  2681. }
  2682. .cardFarm {
  2683. background: rgba(250, 248, 242, 0.82);
  2684. }
  2685. .cardCredential {
  2686. background: rgba(252, 248, 240, 0.84);
  2687. }
  2688. .cardBatchState {
  2689. background: rgba(252, 248, 244, 0.74);
  2690. }
  2691. /* 检测结论卡:融合溯源信息,与农场卡视觉统一 */
  2692. .cardConclusion {
  2693. background: rgba(250, 248, 242, 0.82);
  2694. padding-top: 20rpx;
  2695. }
  2696. /* 溯源信息卡主体:三层竖向结构 */
  2697. .conclusionIdentity {
  2698. display: flex;
  2699. flex-direction: column;
  2700. gap: 16rpx;
  2701. }
  2702. /* 第一层:批次号主信息区 */
  2703. .conclusionBatchWrap {
  2704. display: flex;
  2705. flex-direction: column;
  2706. gap: 4rpx;
  2707. }
  2708. .conclusionBatchLabel {
  2709. display: block;
  2710. font-size: 20rpx;
  2711. font-weight: 500;
  2712. line-height: 1.4;
  2713. color: rgba(84, 106, 93, 0.6);
  2714. letter-spacing: 0.02em;
  2715. }
  2716. .conclusionBatchNo {
  2717. display: block;
  2718. font-size: 26rpx;
  2719. font-weight: 500;
  2720. line-height: 1.4;
  2721. color: rgba(27, 41, 33, 0.78);
  2722. letter-spacing: 0.02em;
  2723. }
  2724. /* 第二层:时间摘要区,一行式表达 */
  2725. .conclusionSummary {
  2726. display: flex;
  2727. align-items: baseline;
  2728. flex-wrap: wrap;
  2729. gap: 6rpx 0;
  2730. }
  2731. .summaryLabel {
  2732. font-size: 20rpx;
  2733. font-weight: 500;
  2734. color: rgba(84, 106, 93, 0.6);
  2735. letter-spacing: 0.01em;
  2736. margin-right: 6rpx;
  2737. }
  2738. .summaryText {
  2739. font-size: 21rpx;
  2740. font-weight: 400;
  2741. color: rgba(27, 41, 33, 0.78);
  2742. letter-spacing: 0.01em;
  2743. }
  2744. .summaryDivider {
  2745. font-size: 20rpx;
  2746. font-weight: 400;
  2747. color: rgba(84, 106, 93, 0.4);
  2748. margin: 0 16rpx;
  2749. }
  2750. /* 第三层:结论标签区,独立横向排列 */
  2751. .conclusionTags {
  2752. display: flex;
  2753. flex-direction: row;
  2754. gap: 12rpx;
  2755. }
  2756. .conclusionTag {
  2757. display: inline-flex;
  2758. align-items: center;
  2759. padding: 6rpx 16rpx;
  2760. border-radius: 999rpx;
  2761. background: rgba(39, 113, 76, 0.08);
  2762. }
  2763. .conclusionTag text {
  2764. font-size: 19rpx;
  2765. font-weight: 500;
  2766. letter-spacing: 0.02em;
  2767. color: rgba(39, 113, 76, 0.8);
  2768. }
  2769. /* 农事时间轴:关键种植过程 */
  2770. .cardTimeline {
  2771. background: rgba(252, 250, 244, 0.82);
  2772. }
  2773. .timelineList {
  2774. padding-top: 4rpx;
  2775. }
  2776. .timelineItem {
  2777. display: flex;
  2778. padding-bottom: 24rpx;
  2779. }
  2780. .timelineItem:last-child {
  2781. padding-bottom: 0;
  2782. }
  2783. .timelineLeft {
  2784. display: flex;
  2785. flex-direction: column;
  2786. align-items: center;
  2787. width: 40rpx;
  2788. flex-shrink: 0;
  2789. }
  2790. .timelineDot {
  2791. width: 12rpx;
  2792. height: 12rpx;
  2793. border-radius: 50%;
  2794. background: rgba(39, 113, 76, 0.5);
  2795. flex-shrink: 0;
  2796. }
  2797. .timelineLine {
  2798. width: 1rpx;
  2799. flex: 1;
  2800. background: rgba(39, 113, 76, 0.2);
  2801. margin-top: 8rpx;
  2802. }
  2803. .timelineRight {
  2804. flex: 1;
  2805. padding-left: 24rpx;
  2806. }
  2807. .timelineTime {
  2808. display: block;
  2809. font-size: 19rpx;
  2810. font-weight: 400;
  2811. color: rgba(84, 106, 93, 0.5);
  2812. margin-bottom: 6rpx;
  2813. letter-spacing: 0.02em;
  2814. }
  2815. .timelineTitle {
  2816. display: block;
  2817. font-size: 25rpx;
  2818. font-weight: 500;
  2819. color: rgba(27, 41, 33, 0.88);
  2820. margin-bottom: 6rpx;
  2821. line-height: 1.35;
  2822. }
  2823. .timelineDesc {
  2824. display: block;
  2825. font-size: 21rpx;
  2826. font-weight: 400;
  2827. line-height: 1.7;
  2828. color: rgba(84, 106, 93, 0.75);
  2829. }
  2830. /* 关键节点(安全检测):轻强调 */
  2831. .timelineItem.is-key .timelineDot {
  2832. background: rgba(39, 113, 76, 0.7);
  2833. }
  2834. .timelineItem.is-key .timelineTitle {
  2835. font-weight: 600;
  2836. color: rgba(27, 41, 33, 0.9);
  2837. }
  2838. /* 当前节点(包装日期:出库):主高亮 */
  2839. .timelineItem.is-current .timelineDot {
  2840. background: #2f7d55;
  2841. box-shadow: 0 0 0 6rpx rgba(47, 125, 85, 0.12);
  2842. }
  2843. .timelineItem.is-current .timelineTitle {
  2844. font-weight: 600;
  2845. color: rgba(20, 60, 40, 0.95);
  2846. }
  2847. /* 底部可信来源说明 */
  2848. .timelineFootnote {
  2849. margin-top: 20rpx;
  2850. font-size: 20rpx;
  2851. color: rgba(84, 106, 93, 0.45);
  2852. line-height: 1.6;
  2853. }
  2854. /* 种植现场实时画面模块 */
  2855. .cardLive {
  2856. background: rgba(252, 250, 244, 0.82);
  2857. }
  2858. .liveMediaWrap {
  2859. position: relative;
  2860. width: 100%;
  2861. height: 380rpx;
  2862. border-radius: 20rpx;
  2863. overflow: hidden;
  2864. background: linear-gradient(
  2865. 160deg,
  2866. rgba(39, 113, 76, 0.04) 0%,
  2867. rgba(39, 113, 76, 0.015) 50%,
  2868. rgba(39, 113, 76, 0.05) 100%
  2869. );
  2870. border: 1rpx solid rgba(39, 75, 57, 0.08);
  2871. box-shadow: inset 0 2rpx 12rpx rgba(39, 113, 76, 0.04);
  2872. }
  2873. .liveCover {
  2874. width: 100%;
  2875. height: 100%;
  2876. }
  2877. /* 默认未播放态背景:深灰绿 + 墨绿色层次感 */
  2878. .video-placeholder-bg {
  2879. position: absolute;
  2880. top: 0;
  2881. left: 0;
  2882. width: 100%;
  2883. height: 100%;
  2884. background: linear-gradient(
  2885. 165deg,
  2886. rgba(45, 70, 55, 0.78) 0%,
  2887. rgba(35, 55, 45, 0.82) 50%,
  2888. rgba(28, 45, 38, 0.88) 100%
  2889. );
  2890. box-shadow: inset 0 0 100rpx rgba(55, 90, 68, 0.12);
  2891. }
  2892. .livePlaceholder {
  2893. width: 100%;
  2894. height: 100%;
  2895. display: flex;
  2896. flex-direction: column;
  2897. align-items: center;
  2898. justify-content: center;
  2899. background: transparent;
  2900. }
  2901. .livePlayIcon {
  2902. display: flex;
  2903. align-items: center;
  2904. gap: 8rpx;
  2905. margin-bottom: 20rpx;
  2906. }
  2907. .livePlayDot {
  2908. width: 8rpx;
  2909. height: 8rpx;
  2910. border-radius: 50%;
  2911. background: rgba(39, 113, 76, 0.35);
  2912. animation: livePulse 1.4s ease-in-out infinite;
  2913. }
  2914. .livePlayDot.dot2 {
  2915. animation-delay: 0.2s;
  2916. }
  2917. .livePlayDot.dot3 {
  2918. animation-delay: 0.4s;
  2919. }
  2920. @keyframes livePulse {
  2921. 0%, 100% {
  2922. opacity: 0.3;
  2923. transform: scale(0.8);
  2924. }
  2925. 50% {
  2926. opacity: 1;
  2927. transform: scale(1.1);
  2928. }
  2929. }
  2930. .livePlaceholderMain {
  2931. font-size: 26rpx;
  2932. font-weight: 500;
  2933. color: rgba(39, 113, 76, 0.5);
  2934. margin-bottom: 10rpx;
  2935. }
  2936. .livePlaceholderSub {
  2937. font-size: 20rpx;
  2938. color: rgba(84, 106, 93, 0.35);
  2939. }
  2940. /* 实时在线状态标签(视频区内部轻量风格) */
  2941. .liveStatusPill {
  2942. display: flex;
  2943. align-items: center;
  2944. gap: 5rpx;
  2945. padding: 0;
  2946. background: transparent;
  2947. border: none;
  2948. }
  2949. .liveStatusDot {
  2950. width: 6rpx;
  2951. height: 6rpx;
  2952. border-radius: 50%;
  2953. flex-shrink: 0;
  2954. background: #6EDFA3;
  2955. box-shadow: 0 0 6rpx rgba(110, 223, 163, 0.6);
  2956. }
  2957. .liveStatusPill.online .liveStatusDot {
  2958. animation: statusPulse 2s ease-in-out infinite;
  2959. }
  2960. .liveStatusText {
  2961. font-size: 18rpx;
  2962. font-weight: 600;
  2963. color: rgba(235, 245, 240, 0.88);
  2964. letter-spacing: 0.02em;
  2965. text-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.25);
  2966. }
  2967. @keyframes statusPulse {
  2968. 0%, 100% {
  2969. opacity: 1;
  2970. box-shadow: 0 0 6rpx rgba(110, 223, 163, 0.6);
  2971. }
  2972. 50% {
  2973. opacity: 0.7;
  2974. box-shadow: 0 0 3rpx rgba(110, 223, 163, 0.3);
  2975. }
  2976. }
  2977. .liveStatusPill.offline .liveStatusDot {
  2978. background: rgba(150, 160, 155, 0.6);
  2979. box-shadow: none;
  2980. }
  2981. .liveDesc {
  2982. margin-top: 14rpx;
  2983. font-size: 18rpx;
  2984. color: rgba(84, 106, 93, 0.45);
  2985. line-height: 1.6;
  2986. }
  2987. /* 种植环境记录模块 */
  2988. .cardEnvironment {
  2989. background: rgba(252, 250, 244, 0.82);
  2990. }
  2991. .environmentSummary {
  2992. font-size: 26rpx;
  2993. font-weight: 500;
  2994. color: rgba(27, 41, 33, 0.8);
  2995. line-height: 1.6;
  2996. margin-bottom: 24rpx;
  2997. }
  2998. /* 土壤养分趋势图 */
  2999. .environmentChart {
  3000. background: rgba(39, 113, 76, 0.03);
  3001. border: 1rpx solid rgba(39, 113, 76, 0.08);
  3002. border-radius: 16rpx;
  3003. padding: 24rpx;
  3004. margin-bottom: 24rpx;
  3005. }
  3006. .environmentChartHead {
  3007. margin-bottom: 20rpx;
  3008. }
  3009. .environmentChartTitle {
  3010. display: block;
  3011. font-size: 24rpx;
  3012. font-weight: 500;
  3013. color: rgba(27, 41, 33, 0.75);
  3014. }
  3015. .environmentChartSub {
  3016. display: block;
  3017. font-size: 20rpx;
  3018. color: rgba(84, 106, 93, 0.45);
  3019. margin-top: 4rpx;
  3020. }
  3021. .environmentChartCanvas {
  3022. position: relative;
  3023. height: 200rpx;
  3024. margin-bottom: 16rpx;
  3025. }
  3026. .chartPlotArea {
  3027. position: absolute;
  3028. top: 0;
  3029. left: 0;
  3030. right: 0;
  3031. bottom: 30rpx;
  3032. }
  3033. /* SVG 图表样式 */
  3034. .chartSvg {
  3035. width: 100%;
  3036. height: 100%;
  3037. }
  3038. /* 网格线(弱化,避免抢视觉) */
  3039. .chartGridLineSvg {
  3040. stroke: rgba(39, 113, 76, 0.05);
  3041. stroke-width: 1;
  3042. }
  3043. /* 面积渐变层(趋势带效果) */
  3044. .chartAreaN {
  3045. fill: rgba(47, 125, 85, 0.08);
  3046. }
  3047. .chartAreaP {
  3048. fill: rgba(180, 140, 70, 0.08);
  3049. }
  3050. .chartAreaK {
  3051. fill: rgba(84, 130, 110, 0.08);
  3052. }
  3053. /* 曲线样式(柔和趋势线) */
  3054. .chartPathN {
  3055. fill: none;
  3056. stroke-width: 2.5;
  3057. stroke-opacity: 0.7;
  3058. stroke-linecap: round;
  3059. stroke-linejoin: round;
  3060. }
  3061. .chartPathP {
  3062. fill: none;
  3063. stroke-width: 2.5;
  3064. stroke-opacity: 0.7;
  3065. stroke-linecap: round;
  3066. stroke-linejoin: round;
  3067. }
  3068. .chartPathK {
  3069. fill: none;
  3070. stroke-width: 2.5;
  3071. stroke-opacity: 0.7;
  3072. stroke-linecap: round;
  3073. stroke-linejoin: round;
  3074. }
  3075. /* 数据点样式(小而柔和) */
  3076. .chartDotN {
  3077. fill: rgba(47, 125, 85, 0.85);
  3078. }
  3079. .chartDotP {
  3080. fill: rgba(180, 140, 70, 0.85);
  3081. }
  3082. .chartDotK {
  3083. fill: rgba(84, 130, 110, 0.85);
  3084. }
  3085. .chartLabels {
  3086. position: absolute;
  3087. bottom: 0;
  3088. left: 0;
  3089. right: 0;
  3090. display: flex;
  3091. justify-content: space-between;
  3092. }
  3093. .chartLabels text {
  3094. font-size: 18rpx;
  3095. color: rgba(84, 106, 93, 0.4);
  3096. }
  3097. .chartLabels .label-hidden {
  3098. visibility: hidden;
  3099. }
  3100. .environmentChartLegend {
  3101. display: flex;
  3102. justify-content: center;
  3103. gap: 40rpx;
  3104. }
  3105. .legendItem {
  3106. display: flex;
  3107. align-items: center;
  3108. gap: 10rpx;
  3109. }
  3110. .legendDot {
  3111. width: 8rpx;
  3112. height: 8rpx;
  3113. border-radius: 50%;
  3114. }
  3115. .legendN {
  3116. background: rgba(47, 125, 85, 0.65);
  3117. }
  3118. .legendP {
  3119. background: rgba(180, 140, 70, 0.65);
  3120. }
  3121. .legendK {
  3122. background: rgba(84, 130, 110, 0.65);
  3123. }
  3124. .legendItem text {
  3125. font-size: 22rpx;
  3126. color: rgba(84, 106, 93, 0.55);
  3127. }
  3128. /* 环境摘要项 */
  3129. .environmentGrid {
  3130. display: grid;
  3131. grid-template-columns: repeat(2, minmax(0, 1fr));
  3132. gap: 16rpx;
  3133. }
  3134. .environmentItem {
  3135. display: flex;
  3136. flex-direction: column;
  3137. gap: 6rpx;
  3138. padding: 20rpx;
  3139. border-radius: 14rpx;
  3140. background: rgba(39, 113, 76, 0.04);
  3141. border: 1rpx solid rgba(39, 113, 76, 0.08);
  3142. }
  3143. .environmentLabel {
  3144. font-size: 18rpx;
  3145. color: rgba(84, 106, 93, 0.45);
  3146. }
  3147. .environmentValue {
  3148. font-size: 26rpx;
  3149. font-weight: 500;
  3150. color: rgba(27, 41, 33, 0.8);
  3151. line-height: 1.2;
  3152. }
  3153. .environmentStatus {
  3154. font-size: 18rpx;
  3155. color: rgba(47, 125, 85, 0.55);
  3156. }
  3157. /* ================================================
  3158. 微动效:让页面"活起来"
  3159. ================================================ */
  3160. /* Hero 进入:上浮 + 淡入 */
  3161. @keyframes heroEnter {
  3162. 0% {
  3163. opacity: 0;
  3164. transform: translateY(28rpx);
  3165. }
  3166. 100% {
  3167. opacity: 1;
  3168. transform: translateY(0);
  3169. }
  3170. }
  3171. .heroCard {
  3172. animation: heroEnter 0.6s cubic-bezier(0.22, 0.78, 0.35, 1) both;
  3173. }
  3174. /* 卡片依次入场:延迟递增,制造节奏感 */
  3175. @keyframes cardEnter {
  3176. 0% {
  3177. opacity: 0;
  3178. transform: translateY(20rpx);
  3179. }
  3180. 100% {
  3181. opacity: 1;
  3182. transform: translateY(0);
  3183. }
  3184. }
  3185. /* 商品面板:稍晚于 Hero */
  3186. .heroInfoPanel {
  3187. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.15s both;
  3188. }
  3189. /* 检测结论卡 */
  3190. .cardConclusion {
  3191. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.2s both;
  3192. }
  3193. /* 农场卡 */
  3194. .cardFarm {
  3195. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.25s both;
  3196. }
  3197. /* 批次状态卡(不存在/已下线) */
  3198. .cardBatchState {
  3199. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.2s both;
  3200. }
  3201. /* 凭证卡 */
  3202. .cardCredential {
  3203. animation: cardEnter 0.5s cubic-bezier(0.22, 0.78, 0.35, 1) 0.45s both;
  3204. }
  3205. /* ============================
  3206. 检测报告横向卡片列表
  3207. ============================ */
  3208. .reportCardList {
  3209. width: 100%;
  3210. overflow-x: auto;
  3211. overflow-y: hidden;
  3212. -webkit-overflow-scrolling: touch;
  3213. white-space: nowrap;
  3214. }
  3215. .reportCardList::-webkit-scrollbar {
  3216. display: none;
  3217. }
  3218. .reportCardTrack {
  3219. display: inline-flex;
  3220. flex-wrap: nowrap;
  3221. align-items: stretch;
  3222. gap: 16rpx;
  3223. padding: 6rpx 4rpx 10rpx;
  3224. /* 关键:让子项不受 flex 压缩,自然撑开形成横向溢出 */
  3225. width: max-content;
  3226. }
  3227. /* 单张报告卡片 */
  3228. .reportCard {
  3229. flex-shrink: 0;
  3230. width: 220rpx;
  3231. background: #FAFBF9;
  3232. border: 1rpx solid rgba(39, 75, 57, 0.09);
  3233. border-radius: 14rpx;
  3234. padding: 12rpx 12rpx 10rpx;
  3235. display: flex;
  3236. flex-direction: column;
  3237. align-items: stretch;
  3238. box-shadow: 0 2rpx 8rpx rgba(39, 75, 57, 0.04);
  3239. }
  3240. /* 缩略图(带页数角标覆盖层) */
  3241. .reportCardThumb {
  3242. position: relative;
  3243. width: 100%;
  3244. height: 196rpx;
  3245. background: rgba(39, 75, 57, 0.03);
  3246. border-radius: 10rpx;
  3247. overflow: hidden;
  3248. display: flex;
  3249. align-items: center;
  3250. justify-content: center;
  3251. margin-bottom: 10rpx;
  3252. }
  3253. .reportCardThumbImg {
  3254. width: 100%;
  3255. height: 100%;
  3256. }
  3257. .reportCardThumbEmpty {
  3258. width: 100%;
  3259. height: 100%;
  3260. display: flex;
  3261. align-items: center;
  3262. justify-content: center;
  3263. }
  3264. .reportCardThumbEmptyText {
  3265. font-size: 18rpx;
  3266. color: rgba(39, 75, 57, 0.3);
  3267. }
  3268. /* 页数角标:绝对定位在缩略图右下角 */
  3269. .reportCardPages {
  3270. position: absolute;
  3271. bottom: 8rpx;
  3272. right: 8rpx;
  3273. font-size: 15rpx;
  3274. color: rgba(39, 75, 57, 0.65);
  3275. background: rgba(250, 251, 249, 0.88);
  3276. border: 1rpx solid rgba(39, 75, 57, 0.1);
  3277. border-radius: 6rpx;
  3278. padding: 2rpx 8rpx;
  3279. line-height: 1.4;
  3280. }
  3281. /* 报告元信息 */
  3282. .reportCardMeta {
  3283. flex: 1;
  3284. margin-bottom: 6rpx;
  3285. }
  3286. .reportCardRow {
  3287. display: flex;
  3288. justify-content: space-between;
  3289. align-items: baseline;
  3290. gap: 4rpx;
  3291. margin-bottom: 4rpx;
  3292. }
  3293. .reportCardLabel {
  3294. font-size: 16rpx;
  3295. color: rgba(84, 106, 93, 0.6);
  3296. flex-shrink: 0;
  3297. }
  3298. .reportCardValue {
  3299. font-size: 16rpx;
  3300. color: rgba(68, 82, 72, 0.85);
  3301. font-weight: 400;
  3302. text-align: right;
  3303. word-break: break-all;
  3304. }
  3305. .reportCardValueNo {
  3306. font-size: 14rpx;
  3307. color: rgba(68, 82, 72, 0.72);
  3308. }
  3309. /* 点击提示 */
  3310. .reportCardHint {
  3311. font-size: 14rpx;
  3312. color: rgba(39, 75, 57, 0.3);
  3313. text-align: center;
  3314. margin-top: auto;
  3315. }
  3316. /* 卡片触摸反馈:阴影增强(模拟按压感) */
  3317. .card:active {
  3318. transition: box-shadow 0.15s ease, transform 0.15s ease;
  3319. }
  3320. /* 触摸时轻微缩小,增加真实感 */
  3321. .card:active:not(.heroInfoPanel) {
  3322. transform: scale(0.99);
  3323. }
  3324. .sectionHeader {
  3325. display: flex;
  3326. align-items: center;
  3327. justify-content: space-between;
  3328. gap: 18rpx;
  3329. margin-bottom: 20rpx;
  3330. }
  3331. .sectionHeaderLeft {
  3332. display: flex;
  3333. flex-direction: column;
  3334. gap: 10rpx;
  3335. position: relative;
  3336. padding-bottom: 8rpx;
  3337. }
  3338. .sectionHeaderLeft::after {
  3339. content: '';
  3340. position: absolute;
  3341. left: 0;
  3342. bottom: 0;
  3343. width: 78rpx;
  3344. height: 2rpx;
  3345. border-radius: 999rpx;
  3346. background: linear-gradient(90deg, rgba(46, 82, 63, 0.3), rgba(203, 176, 128, 0.26), rgba(46, 82, 63, 0));
  3347. pointer-events: none;
  3348. }
  3349. .sectionEn {
  3350. font-size: 15rpx;
  3351. font-weight: 500;
  3352. letter-spacing: 0.24em;
  3353. text-transform: uppercase;
  3354. color: rgba(84, 106, 93, 0.76);
  3355. }
  3356. .sectionTitle {
  3357. font-size: 26rpx;
  3358. font-weight: 600;
  3359. color: rgba(60, 72, 64, 0.72);
  3360. }
  3361. .statusBadge {
  3362. font-size: 18rpx;
  3363. font-weight: 600;
  3364. padding: 9rpx 15rpx;
  3365. border-radius: 999rpx;
  3366. white-space: nowrap;
  3367. border: 1rpx solid transparent;
  3368. box-shadow: 0 1rpx 0 rgba(255, 255, 255, 0.34) inset;
  3369. }
  3370. .statusBadge.ok {
  3371. color: #1d5d40;
  3372. background: rgba(39, 113, 76, 0.12);
  3373. border-color: rgba(39, 113, 76, 0.2);
  3374. }
  3375. .statusBadge.wait {
  3376. color: #715726;
  3377. background: rgba(203, 171, 112, 0.2);
  3378. border-color: rgba(203, 171, 112, 0.26);
  3379. }
  3380. .statusBadge.warning {
  3381. color: #8a5e22;
  3382. background: rgba(214, 174, 95, 0.22);
  3383. border-color: rgba(214, 174, 95, 0.28);
  3384. }
  3385. .statusBadge.muted {
  3386. color: #677069;
  3387. background: rgba(126, 137, 128, 0.14);
  3388. border-color: rgba(126, 137, 128, 0.2);
  3389. }
  3390. /* =============================================
  3391. 商品信息面板专用信任认证徽章:强化图标主视觉、文字辅助
  3392. ============================================= */
  3393. /* 整体:认证章风格,低饱和细边框,无交互感 */
  3394. .trustBadge {
  3395. display: inline-flex;
  3396. align-items: center;
  3397. gap: 7rpx;
  3398. padding: 9rpx 18rpx 9rpx 15rpx;
  3399. border-radius: 999rpx;
  3400. border: 1rpx solid rgba(39, 113, 76, 0.22);
  3401. background: rgba(39, 113, 76, 0.06);
  3402. box-shadow:
  3403. 0 2rpx 6rpx rgba(39, 113, 76, 0.06),
  3404. 0 1rpx 0 rgba(255, 255, 255, 0.55) inset;
  3405. white-space: nowrap;
  3406. cursor: default;
  3407. pointer-events: none;
  3408. user-select: none;
  3409. }
  3410. /* 双圆环认证图标:20×20 viewBox,图标为第一视觉焦点 */
  3411. .trustBadgeIcon {
  3412. width: 30rpx;
  3413. height: 30rpx;
  3414. flex-shrink: 0;
  3415. vertical-align: middle;
  3416. display: inline-block;
  3417. }
  3418. /* 文案:品牌深绿,字重略降,视觉权重低于图标 */
  3419. .trustBadgeText {
  3420. font-size: 18rpx;
  3421. font-weight: 400;
  3422. letter-spacing: 0.05em;
  3423. color: rgba(27, 71, 42, 0.68);
  3424. }
  3425. .kv {
  3426. display: flex;
  3427. flex-direction: column;
  3428. gap: 16rpx;
  3429. }
  3430. .kvRow {
  3431. display: flex;
  3432. align-items: baseline;
  3433. justify-content: space-between;
  3434. gap: 16rpx;
  3435. }
  3436. .kvKey {
  3437. font-size: 22rpx;
  3438. font-weight: 480;
  3439. color: rgba(54, 68, 58, 0.62);
  3440. }
  3441. .kvVal {
  3442. font-size: 23rpx;
  3443. font-weight: 400;
  3444. text-align: right;
  3445. color: rgba(27, 41, 33, 0.92);
  3446. }
  3447. /* 农场主体:左图右文,右栏与图片垂直居中,名称/地址成组 */
  3448. .farmBody {
  3449. display: flex;
  3450. align-items: center;
  3451. gap: 24rpx;
  3452. margin-bottom: 18rpx;
  3453. }
  3454. .farmImageWrap {
  3455. flex-shrink: 0;
  3456. width: 180rpx;
  3457. height: 136rpx;
  3458. border-radius: 22rpx;
  3459. overflow: hidden;
  3460. position: relative;
  3461. box-shadow:
  3462. 0 12rpx 28rpx rgba(24, 41, 30, 0.14),
  3463. 0 2rpx 0 rgba(255, 255, 255, 0.3) inset;
  3464. }
  3465. .farmImage {
  3466. width: 100%;
  3467. height: 100%;
  3468. display: block;
  3469. background: linear-gradient(160deg, rgba(234, 245, 240, 0.9), rgba(220, 238, 228, 0.85));
  3470. }
  3471. /* 图片暗角效果:增强真实场景感 */
  3472. .farmImageVignette {
  3473. position: absolute;
  3474. top: 0;
  3475. left: 0;
  3476. width: 100%;
  3477. height: 100%;
  3478. border-radius: 22rpx;
  3479. background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(24, 41, 30, 0.12) 100%);
  3480. pointer-events: none;
  3481. }
  3482. .farmMeta {
  3483. flex: 1;
  3484. display: flex;
  3485. flex-direction: column;
  3486. justify-content: center;
  3487. min-width: 0;
  3488. gap: 10rpx;
  3489. }
  3490. .farmName {
  3491. font-size: 30rpx;
  3492. font-weight: 600;
  3493. line-height: 1.4;
  3494. letter-spacing: 0.01em;
  3495. color: rgba(27, 41, 33, 0.94);
  3496. }
  3497. /* 农场地址:普通文本样式,弱于标题;多行时图标与首行对齐 */
  3498. .farmLocation {
  3499. display: flex;
  3500. align-items: flex-start;
  3501. gap: 8rpx;
  3502. margin-top: 8rpx;
  3503. }
  3504. /* 轻量标签:真实种植、可追溯来源 */
  3505. .farmTags {
  3506. display: flex;
  3507. flex-wrap: wrap;
  3508. gap: 8rpx;
  3509. margin-top: 6rpx;
  3510. }
  3511. .farmTag {
  3512. padding: 4rpx 12rpx;
  3513. font-size: 18rpx;
  3514. font-weight: 400;
  3515. color: rgba(39, 113, 76, 0.85);
  3516. background: rgba(39, 113, 76, 0.08);
  3517. border-radius: 8rpx;
  3518. line-height: 1.4;
  3519. letter-spacing: 0.01em;
  3520. }
  3521. /* 定位小图标:略弱、与首行文字视觉对齐 */
  3522. .locationIcon {
  3523. width: 18rpx;
  3524. height: 18rpx;
  3525. flex-shrink: 0;
  3526. margin-top: 6rpx;
  3527. opacity: 0.42;
  3528. }
  3529. .locationText {
  3530. flex: 1;
  3531. min-width: 0;
  3532. font-size: 21rpx;
  3533. font-weight: 400;
  3534. color: rgba(84, 106, 93, 0.82);
  3535. line-height: 1.55;
  3536. letter-spacing: 0.02em;
  3537. }
  3538. /* 农场介绍:融入主体,使用分隔线区分,与商品简介风格统一 */
  3539. .farmIntro {
  3540. display: flex;
  3541. flex-direction: column;
  3542. gap: 10rpx;
  3543. padding-top: 18rpx;
  3544. border-top: 1rpx solid rgba(39, 75, 57, 0.06);
  3545. font-size: 23rpx;
  3546. line-height: 2;
  3547. color: rgba(54, 68, 58, 0.76);
  3548. }
  3549. /* 原始农场简介 */
  3550. .farmIntroOrigin {
  3551. font-size: 23rpx;
  3552. line-height: 2;
  3553. color: rgba(54, 68, 58, 0.76);
  3554. }
  3555. .emptyText {
  3556. margin-top: 10rpx;
  3557. font-size: 24rpx;
  3558. line-height: 1.62;
  3559. color: rgba(16, 24, 19, 0.72);
  3560. }
  3561. .btnRow {
  3562. margin-top: 22rpx;
  3563. }
  3564. /* 合格证紧凑缩略图 */
  3565. /* ============================
  3566. 合格证:信息摘要 + 缩略图一体化布局
  3567. ============================ */
  3568. .certSummary {
  3569. display: flex;
  3570. align-items: flex-start;
  3571. gap: 24rpx;
  3572. }
  3573. .certSummaryInfo {
  3574. flex: 1;
  3575. display: flex;
  3576. flex-direction: column;
  3577. gap: 14rpx;
  3578. min-width: 0;
  3579. }
  3580. .certSummaryRow {
  3581. display: flex;
  3582. flex-direction: column;
  3583. gap: 2rpx;
  3584. }
  3585. .certSummaryLabel {
  3586. font-size: 20rpx;
  3587. font-weight: 500;
  3588. color: rgba(39, 75, 57, 0.55);
  3589. letter-spacing: 0.02em;
  3590. }
  3591. .certSummaryValue {
  3592. font-size: 23rpx;
  3593. font-weight: 400;
  3594. color: rgba(27, 41, 33, 0.8);
  3595. line-height: 1.4;
  3596. }
  3597. .certThumbContainer {
  3598. flex: 0 0 auto;
  3599. display: flex;
  3600. flex-direction: column;
  3601. align-items: center;
  3602. gap: 6rpx;
  3603. }
  3604. .certThumbContainer .certThumbWrap {
  3605. width: 100rpx;
  3606. height: 136rpx;
  3607. border-radius: 10rpx;
  3608. overflow: hidden;
  3609. background: #fff;
  3610. border: 1rpx solid rgba(200, 180, 140, 0.18);
  3611. box-shadow: 0 2rpx 8rpx rgba(30, 36, 26, 0.05);
  3612. }
  3613. .certThumbContainer .certThumbImage {
  3614. width: 100%;
  3615. height: 100%;
  3616. display: block;
  3617. }
  3618. .certPreviewHint {
  3619. font-size: 15rpx;
  3620. line-height: 1.2;
  3621. color: rgba(39, 75, 57, 0.38);
  3622. letter-spacing: 0.01em;
  3623. }
  3624. .certPendingHint {
  3625. flex: 1;
  3626. display: flex;
  3627. align-items: center;
  3628. padding: 12rpx 0;
  3629. }
  3630. .certPendingText {
  3631. font-size: 21rpx;
  3632. color: rgba(39, 75, 57, 0.5);
  3633. line-height: 1.5;
  3634. }
  3635. /* 旧样式保留但隐藏(兼容其他模块) */
  3636. .certPreviewCompact {
  3637. display: flex;
  3638. flex-direction: column;
  3639. align-items: center;
  3640. margin-top: 24rpx;
  3641. }
  3642. .docPlaceholder {
  3643. margin-top: 16rpx;
  3644. padding: 20rpx;
  3645. border-radius: 26rpx;
  3646. background: linear-gradient(160deg, rgba(244, 237, 224, 0.82), rgba(237, 244, 235, 0.72));
  3647. border: 1rpx solid rgba(201, 171, 120, 0.22);
  3648. }
  3649. .docPlaceholderTitle {
  3650. display: block;
  3651. margin-bottom: 12rpx;
  3652. font-size: 22rpx;
  3653. font-weight: 650;
  3654. color: rgba(35, 93, 64, 0.92);
  3655. }
  3656. .docPlaceholderText {
  3657. display: block;
  3658. font-size: 22rpx;
  3659. line-height: 1.75;
  3660. color: rgba(59, 71, 62, 0.82);
  3661. }
  3662. .docBlock {
  3663. margin-top: 14rpx;
  3664. padding: 18rpx;
  3665. border-radius: 22rpx;
  3666. background: rgba(255, 255, 255, 0.46);
  3667. }
  3668. .docBlock:first-of-type {
  3669. margin-top: 4rpx;
  3670. }
  3671. .docTitle {
  3672. display: block;
  3673. margin-bottom: 10rpx;
  3674. font-size: 22rpx;
  3675. font-weight: 600;
  3676. color: rgba(45, 87, 64, 0.84);
  3677. }
  3678. .docText {
  3679. font-size: 22rpx;
  3680. line-height: 1.8;
  3681. color: rgba(64, 75, 67, 0.8);
  3682. }
  3683. .cardCredential .certSummary {
  3684. margin-top: 4rpx;
  3685. }
  3686. /* 安心收口文案 */
  3687. .pageEndHint {
  3688. padding: 28rpx 32rpx 20rpx;
  3689. text-align: center;
  3690. }
  3691. .pageEndHint text {
  3692. font-size: 20rpx;
  3693. font-weight: 400;
  3694. line-height: 1.65;
  3695. color: rgba(88, 100, 92, 0.45);
  3696. letter-spacing: 0.03em;
  3697. }
  3698. .footerDivider {
  3699. display: block;
  3700. height: 1rpx;
  3701. margin: 0 36rpx 20rpx;
  3702. background: rgba(39, 75, 57, 0.1);
  3703. }
  3704. /* 微信小店复购引导 - 轻量品牌入口 */
  3705. .rebuyGuide {
  3706. width: 560rpx;
  3707. max-width: calc(100% - 128rpx);
  3708. margin: 26rpx auto 36rpx;
  3709. display: flex;
  3710. flex-direction: row;
  3711. align-items: center;
  3712. justify-content: space-between;
  3713. gap: 32rpx;
  3714. }
  3715. .rebuyGuideLeft {
  3716. flex: 1;
  3717. min-width: 0;
  3718. display: flex;
  3719. flex-direction: column;
  3720. gap: 6rpx;
  3721. }
  3722. .rebuyGuideBrandRow {
  3723. display: flex;
  3724. flex-direction: row;
  3725. align-items: center;
  3726. gap: 12rpx;
  3727. }
  3728. .rebuyGuideLogo {
  3729. width: 28rpx;
  3730. height: 28rpx;
  3731. border-radius: 50%;
  3732. }
  3733. .rebuyGuideTitle {
  3734. font-size: 21rpx;
  3735. font-weight: 500;
  3736. color: rgba(39, 75, 57, 0.6);
  3737. letter-spacing: 0.05em;
  3738. }
  3739. .rebuyGuideText {
  3740. font-size: 19rpx;
  3741. font-weight: 400;
  3742. color: rgba(39, 75, 57, 0.35);
  3743. line-height: 1.6;
  3744. margin-top: 10rpx;
  3745. }
  3746. .rebuyGuideBtn {
  3747. flex-shrink: 0;
  3748. padding: 6rpx 16rpx;
  3749. background: rgba(39, 75, 57, 0.05);
  3750. border-radius: 32rpx;
  3751. }
  3752. .rebuyGuideBtn text {
  3753. font-size: 19rpx;
  3754. color: rgba(39, 75, 57, 0.55);
  3755. font-weight: 400;
  3756. letter-spacing: 0.02em;
  3757. }
  3758. .rebuyGuideBtn:active {
  3759. background: rgba(39, 75, 57, 0.1);
  3760. }
  3761. /* 底部柔和收口渐变 */
  3762. .footerFade {
  3763. position: relative;
  3764. height: 1rpx;
  3765. margin: 0 100rpx;
  3766. background: linear-gradient(90deg,
  3767. transparent 0%,
  3768. rgba(39, 75, 57, 0.1) 30%,
  3769. rgba(39, 75, 57, 0.14) 50%,
  3770. rgba(39, 75, 57, 0.1) 70%,
  3771. transparent 100%
  3772. );
  3773. }
  3774. .footerFade::before {
  3775. content: '';
  3776. position: absolute;
  3777. top: 0;
  3778. left: 50%;
  3779. transform: translateX(-50%);
  3780. width: 50%;
  3781. height: 32rpx;
  3782. background: radial-gradient(ellipse at 50% 100%, rgba(39, 75, 57, 0.04), transparent 70%);
  3783. }
  3784. /* 轻量页脚 */
  3785. .traceFooter {
  3786. padding: 20rpx 32rpx 64rpx;
  3787. display: flex;
  3788. flex-direction: column;
  3789. align-items: center;
  3790. gap: 10rpx;
  3791. }
  3792. .traceFooterHint {
  3793. font-size: 19rpx;
  3794. font-weight: 400;
  3795. color: rgba(88, 100, 92, 0.4);
  3796. letter-spacing: 0.04em;
  3797. }
  3798. .traceFooterPhone {
  3799. display: flex;
  3800. align-items: center;
  3801. gap: 6rpx;
  3802. padding: 6rpx 14rpx;
  3803. border-radius: 6rpx;
  3804. transition: opacity 0.2s ease;
  3805. }
  3806. .traceFooterPhone:active {
  3807. opacity: 0.55;
  3808. }
  3809. .traceFooterPhoneIcon {
  3810. width: 20rpx;
  3811. height: 20rpx;
  3812. opacity: 0.45;
  3813. }
  3814. .traceFooterPhoneNum {
  3815. font-size: 21rpx;
  3816. font-weight: 400;
  3817. color: rgba(39, 75, 57, 0.52);
  3818. letter-spacing: 0.04em;
  3819. }
  3820. .traceFooterBrand {
  3821. font-size: 16rpx;
  3822. font-weight: 400;
  3823. letter-spacing: 0.1em;
  3824. color: rgba(88, 100, 92, 0.26);
  3825. margin-top: 6rpx;
  3826. }
  3827. /* 视频预览区域 */
  3828. .video-section {
  3829. /* margin: 0 30rpx 20rpx; */
  3830. position: relative;
  3831. z-index: 1;
  3832. }
  3833. .video-container {
  3834. position: relative;
  3835. width: 100%;
  3836. height: 420rpx;
  3837. background-color: #000000;
  3838. border-radius: 16rpx;
  3839. overflow: hidden;
  3840. box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.1);
  3841. transition: all 0.3s ease;
  3842. }
  3843. .video-container.fullscreen-mode {
  3844. position: fixed;
  3845. top: 0;
  3846. left: 0;
  3847. width: 100vw;
  3848. height: 100vh;
  3849. margin: 0;
  3850. z-index: 9999;
  3851. border-radius: 0;
  3852. }
  3853. .video-container.fullscreen-mode .video-controls {
  3854. padding: 30rpx;
  3855. }
  3856. .video-container.fullscreen-mode .top-controls,
  3857. .video-container.fullscreen-mode .bottom-controls {
  3858. opacity: 0;
  3859. transition: opacity 0.3s ease;
  3860. }
  3861. .video-container.fullscreen-mode:hover .top-controls,
  3862. .video-container.fullscreen-mode:hover .bottom-controls {
  3863. opacity: 1;
  3864. }
  3865. .video-player,
  3866. .video-placeholder {
  3867. width: 100%;
  3868. height: 100%;
  3869. object-fit: contain;
  3870. }
  3871. /* 微信小程序video组件样式 */
  3872. #myVideo {
  3873. width: 100%;
  3874. height: 100%;
  3875. background-color: #000000;
  3876. }
  3877. /* App端video组件样式 */
  3878. /* #ifdef APP-PLUS || APP-HARMONY */
  3879. #appVideo {
  3880. width: 100%;
  3881. height: 100%;
  3882. background-color: #000000;
  3883. }
  3884. /* #endif */
  3885. .h5-video-wrapper {
  3886. width: 100%;
  3887. height: 100%;
  3888. }
  3889. /* App端视频播放器样式优化 */
  3890. /* #ifdef APP-PLUS || APP-HARMONY */
  3891. #appVideoPlayer {
  3892. width: 100%;
  3893. height: 100%;
  3894. background-color: #000000;
  3895. }
  3896. /* #endif */
  3897. .video-controls {
  3898. position: absolute;
  3899. top: 0;
  3900. left: 0;
  3901. width: 100%;
  3902. height: 100%;
  3903. display: flex;
  3904. flex-direction: column;
  3905. justify-content: space-between;
  3906. padding: 20rpx;
  3907. box-sizing: border-box;
  3908. background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.3) 100%);
  3909. }
  3910. .control-row {
  3911. display: flex;
  3912. justify-content: space-between;
  3913. align-items: center;
  3914. width: 100%;
  3915. }
  3916. .top-controls {
  3917. height: 80rpx;
  3918. }
  3919. .center-controls {
  3920. height: 120rpx;
  3921. justify-content: center;
  3922. align-items: center;
  3923. }
  3924. .bottom-controls {
  3925. height: 80rpx;
  3926. }
  3927. /* 信号指示器(轻量状态提示) */
  3928. .signal-indicator {
  3929. display: flex;
  3930. align-items: center;
  3931. color: rgba(200, 215, 205, 0.7);
  3932. font-size: 18rpx;
  3933. background-color: rgba(30, 55, 42, 0.5);
  3934. padding: 4rpx 10rpx;
  3935. border-radius: 16rpx;
  3936. opacity: 0.65;
  3937. }
  3938. .signal-subtle {
  3939. opacity: 0.55;
  3940. }
  3941. .signal-indicator image {
  3942. margin-right: 4rpx;
  3943. opacity: 0.7;
  3944. }
  3945. .signal-text {
  3946. font-weight: 400;
  3947. letter-spacing: 0.02em;
  3948. }
  3949. /* 全屏按钮(轻量透明图标按钮) */
  3950. .fullscreen-button {
  3951. position: absolute;
  3952. top: 12rpx;
  3953. right: 16rpx;
  3954. width: 44rpx;
  3955. height: 44rpx;
  3956. display: flex;
  3957. align-items: center;
  3958. justify-content: center;
  3959. color: rgba(235, 245, 240, 0.75);
  3960. background-color: transparent;
  3961. border: none;
  3962. border-radius: 0;
  3963. transition: all 0.2s;
  3964. z-index: 7;
  3965. }
  3966. .fullscreen-button:active {
  3967. color: rgba(235, 245, 240, 0.95);
  3968. transform: scale(0.92);
  3969. }
  3970. /* 实时在线状态标签(固定在右上角,全屏按钮左侧) */
  3971. .video-fixed-status {
  3972. position: absolute;
  3973. top: 24rpx;
  3974. right: 30rpx;
  3975. z-index: 6;
  3976. display: flex;
  3977. align-items: center;
  3978. }
  3979. .video-time {
  3980. color: #FFFFFF;
  3981. font-size: 26rpx;
  3982. background-color: rgba(0, 0, 0, 0.4);
  3983. padding: 6rpx 16rpx;
  3984. border-radius: 20rpx;
  3985. font-weight: 400;
  3986. }
  3987. /* 播放按钮(精致品牌风格,更柔和) */
  3988. .play-button {
  3989. width: 88rpx;
  3990. height: 88rpx;
  3991. border-radius: 50%;
  3992. background: rgba(255, 255, 255, 0.1);
  3993. backdrop-filter: blur(6px);
  3994. -webkit-backdrop-filter: blur(6px);
  3995. display: flex;
  3996. align-items: center;
  3997. justify-content: center;
  3998. border: 1rpx solid rgba(255, 255, 255, 0.2);
  3999. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.15), inset 0 1rpx 0 rgba(255, 255, 255, 0.08);
  4000. transition: all 0.25s ease;
  4001. }
  4002. .play-button:active {
  4003. transform: scale(0.94);
  4004. background: rgba(255, 255, 255, 0.16);
  4005. }
  4006. /* 播放按钮内部图标(柔和米白) */
  4007. .play-btn-circle {
  4008. width: 54rpx;
  4009. height: 54rpx;
  4010. border-radius: 50%;
  4011. background: linear-gradient(135deg, rgba(250, 250, 248, 0.92) 0%, rgba(242, 245, 240, 0.88) 100%);
  4012. display: flex;
  4013. align-items: center;
  4014. justify-content: center;
  4015. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12);
  4016. }
  4017. /* CSS 三角形播放图标(柔和深绿灰) */
  4018. .play-btn-icon {
  4019. width: 0;
  4020. height: 0;
  4021. border-style: solid;
  4022. border-width: 10rpx 0 10rpx 17rpx;
  4023. border-color: transparent transparent transparent rgba(45, 70, 55, 0.82);
  4024. margin-left: 3rpx;
  4025. }
  4026. .center-button-container {
  4027. width: 100%;
  4028. height: 100%;
  4029. display: flex;
  4030. align-items: center;
  4031. justify-content: center;
  4032. }
  4033. .pause-icon {
  4034. width: 80rpx;
  4035. height: 80rpx;
  4036. border-radius: 50%;
  4037. background-color: rgba(0, 0, 0, 0.5);
  4038. display: flex;
  4039. align-items: center;
  4040. justify-content: center;
  4041. opacity: 0;
  4042. transition: opacity 0.3s;
  4043. }
  4044. .center-button-container:active .pause-icon {
  4045. opacity: 1;
  4046. background-color: rgba(76, 175, 80, 0.7);
  4047. }
  4048. </style>