detail.vue 105 KB

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