detail.vue 111 KB

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