detail.vue 99 KB

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