detail.vue 101 KB

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