|
|
import{_ as t}from"./u-navbar.CwZJfInl.js";import{ag as e,ah as s,ai as i,n as a,aj as n,ak as r,o,c as l,w as h,f as c,F as d,g as p,M as u,m,k as g,al as f,e as y,t as b,d as x,v,j as k,i as _,am as w,an as T,ao as $,ap as N,aq as L,ar as S,O,r as C,as as I,b as j,u as R}from"./index-DkGewvWo.js";import{o as A,r as z}from"./uni-app.es.Bo01BzMV.js";import{_ as B}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{c as E}from"./car.CcI8AEaV.js";import"./u-status-bar.DDNs5qwz.js";import"./u-icon.x7ElsZU9.js";var V={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};const q={isInline:function(t,e){return V[t]||-1!==(e||"").indexOf("display:inline")}},F=t=>{t.$wxs||(t.$wxs=[]),t.$wxs.push("handler"),t.mixins||(t.mixins=[]),t.mixins.push({beforeCreate(){this.handler=q}})},P={name:"node",options:{},data:()=>({ctrl:{}}),props:{name:String,attrs:{type:Object,default:()=>({})},childs:Array,opts:Array},components:{},mounted(){if(this.$nextTick((()=>{for(this.root=this.$parent;"u-parse"!==this.root.$options.name;this.root=this.root.$parent);})),this.opts[0]){let t;for(t=this.childs.length;t--&&"img"!==this.childs[t].name;);-1!==t&&(this.observer=e(this).relativeToViewport({top:500,bottom:500}),this.observer.observe("._img",(t=>{t.intersectionRatio&&(this.$set(this.ctrl,"load",1),this.observer.disconnect())})))}},beforeDestroy(){this.observer&&this.observer.disconnect()},methods:{play(t){if(this.root.$emit("play"),this.root.pauseVideo){let e=!1;const i=t.target.id;for(let t=this.root._videos.length;t--;)this.root._videos[t].id===i?e=!0:this.root._videos[t].pause();if(!e){const t=s(i,this);t.id=i,this.root.playbackRate&&t.playbackRate(this.root.playbackRate),this.root._videos.push(t)}}},imgTap(t){const e=this.childs[t.currentTarget.dataset.i];e.a?this.linkTap(e.a):e.attrs.ignore||(e.attrs.src=e.attrs.src||e.attrs["data-src"],this.root.$emit("imgTap",e.attrs),this.root.previewImg&&i({current:parseInt(e.attrs.i),urls:this.root.imgList}))},imgLongTap(t){},imgLoad(t){const e=t.currentTarget.dataset.i;(this.opts[1]&&!this.ctrl[e]||-1===this.ctrl[e])&&this.$set(this.ctrl,e,1),this.checkReady()},checkReady(){this.root.lazyLoad||(this.root._unloadimgs-=1,this.root._unloadimgs||setTimeout((()=>{this.root.getRect().then((t=>{this.root.$emit("ready",t)})).catch((()=>{this.root.$emit("ready",{})}))}),350))},linkTap(t){const e=t.currentTarget?this.childs[t.currentTarget.dataset.i]:{},s=e.attrs||t,i=s.href;this.root.$emit("linkTap",Object.assign({innerText:this.root.getText(e.children||[])},s)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch((()=>{})):i.split("?")[0].includes("://")?this.root.copyLink&&window.open(i):a({url:i,fail(){n({url:i,fail(){}})}}))},mediaError(t){const e=t.currentTarget.dataset.i,s=this.childs[e];if("video"===s.name||"audio"===s.name){let t=(this.ctrl[e]||0)+1;if(t>s.src.length&&(t=0),t<s.src.length)return void this.$set(this.ctrl,e,t)}else if("img"===s.name){if(this.opts[0]&&!this.ctrl.load)return;this.opts[2]&&this.$set(this.ctrl,e,-1),this.checkReady()}this.root&&this.root.$emit("error",{source:s.name,attrs:s.attrs})}}};F(P);const D=B(P,[["render",function(t,e,s,i,a,n){const $=v,N=k,L=r("node",!0),S=_,O=w,C=T;return o(),l(S,{id:s.attrs.id,class:g("_block _"+s.name+" "+s.attrs.class),style:u(s.attrs.style)},{default:h((()=>[(o(!0),c(d,null,p(s.childs,((i,r)=>(o(),c(d,{key:r},["img"===i.name&&!i.t&&(s.opts[1]&&!a.ctrl[r]||a.ctrl[r]<0)?(o(),l($,{key:0,class:"_img",style:u(i.attrs.style),src:a.ctrl[r]<0?s.opts[2]:s.opts[1],mode:"widthFix"},null,8,["style","src"])):m("",!0),"img"===i.name?(o(),c("img",{key:1,id:i.attrs.id,class:g("_img "+i.attrs.class),style:u((-1===a.ctrl[r]?"display:none;":"")+i.attrs.style),src:i.attrs.src||(a.ctrl.load?i.attrs["data-src"]:""),"data-i":r,onLoad:e[0]||(e[0]=(...t)=>n.imgLoad&&n.imgLoad(...t)),onError:e[1]||(e[1]=(...t)=>n.mediaError&&n.mediaError(...t)),onClick:e[2]||(e[2]=f(((...t)=>n.imgTap&&n.imgTap(...t)),["stop"])),onLongpress:e[3]||(e[3]=(...t)=>n.imgLongTap&&n.imgLongTap(...t))},null,46,["id","src","data-i"])):i.
|