detail.vue 99 KB

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