detail.vue 111 KB

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