import{d as m,R as u,c as s,b5 as y,ah as v,r as E,y as k,$ as I,aj as b,bE as S,ak as P,al as O,m as C,g as x,bp as L,p as B,bC as D,bD as U}from"./index.d1dca38b.js";import{s as r}from"./index.module.ccd53496.js";import{O as z}from"./index.3aa1e6eb.js";import{O as T}from"./index.ef6c32f1.js";import{I as j}from"./index.aeb16825.js";import{L as R}from"./index.876ff047.js";import"./ImagePreview.f958365a.js";import"./index.c324c166.js";import"./index.6c52b1a0.js";import"./use-tab-status.03ea8dd0.js";const V="_imgWrap_12n2v_1";var F={imgWrap:V},H=m({name:"o-image",props:{src:{type:String,default:""}},setup(n){const i=u(!0);return()=>s("div",{class:F.imageWrap,style:i.value?"":{backgroundImage:`url(${n.src})`,backgroundSize:"cover"}},[s(y,{name:"van-fade"},{default:()=>[i.value&&s("img",{style:{display:"none"},src:n.src,onLoad:()=>{i.value=!1}},null)]})])}}),M="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAetJREFUWEftlz1OAzEQhd8EboH4KamT3AEQDQ0kIISoEiquEOcKFAgoEQI2aSjhEJuWmizHgB20PwHHu+s4u04kJKfdmXmfn2ccm2Dpx/32Pji8ASgEcYd6gzcbpclGkagG91ufYKyl9T5IeFs2alsBZCFqwPu3BBSS8FYcoKkDzkFTp4rinIPOwQoOuHOwgnlxqnPQOWjigDuoZ7nE4ngXFN7FccyXJAYvco6pgyyODkB0ldSpdUg8vc7Spnq9vkNEt4k2d0ejUeYmzP3WGIz1pBh/gWqn1Hv2JsVNALnfboHDB4BW0/MjoJ63oQI2m809Zo55iKhLjUZjDEzEMfZ9f1NNmgbMQs4CzMAlB1wuoMITRIAsA/m+nzkb460Bhr+rV5zUAebCRbsAHKqtEpVVeYwAY8/ULZIgwdvDvCu/LkduEdmg0oB6SJyB6VESCkF0MtVzBf2rtlMlQC3kpPkTxRDgsKgldJNbGbAYUiebnfyiaCuA80Gaw1UakrwV5w+BHDkfnHVAvZPzwy0E8A+Soymupf7FU1x0lCx8SHK3W7TPAb5Ov12Q8O51IAsfkjLiJjnWpthErEyMAyzjmrX/4qriJvn/f4tNVrnMmMx9cJniJlrqld8kZ5kxAUmPlPRRtEx9rVYQPZp+ANi5nail81YsAAAAAElFTkSuQmCC";function Q(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!O(n)}var _=m({name:"photo-detail",props:{orchestraId:{type:String,default:""}},setup(n){const i=v();console.log("\u{1F680} ~ route",i);const e=E({downLoading:!1,downIndex:0,refreshing:!1,loading:!1,finished:!1,pages:{page:1,rows:20},list:[],startPosition:0,imgShow:!1}),d=async()=>{var a;if(!e.loading){e.loading=!0,e.refreshing&&(e.list=[],e.pages.page=1);try{const t=await C.post(`${x.platformApi}/orchestraPhoto/page`,{data:{...e.pages,orchestraPhotoAlbumId:i.query.photoId}});Array.isArray((a=t==null?void 0:t.data)==null?void 0:a.rows)?(e.list=e.list.concat(t.data.rows),e.pages.page=t.data.current+1,e.finished=!t.data.next):e.finished=!0}catch{e.finished=!0}e.refreshing=!1,e.loading=!1}},c=k(()=>e.list.map(a=>a.fileUrl)),p=u(),f=a=>{e.downIndex=e.startPosition=a,e.imgShow=!0},h=a=>{const t=document.createElement("canvas");t.width=a.width,t.height=a.height;const o=t.getContext("2d");return o==null||o.drawImage(a,0,0,t.width,t.height),t.toDataURL("image/png")},A=async()=>{const a=c.value[e.downIndex];if(e.downLoading||!a)return;const t=L({message:"\u4FDD\u5B58\u4E2D",duration:0}),o=document.createElement("img");o.crossOrigin="anonymous",o.onload=async()=>{var g;const w=h(o);try{const l=await B({api:"savePicture",content:{base64:w}});((g=l==null?void 0:l.content)==null?void 0:g.status)==="success"?D("\u4FDD\u5B58\u6210\u529F"):U("\u4FDD\u5B58\u5931\u8D25")}catch{}t.close(),e.downLoading=!1},o.src=a+`?v=${Date.now()}`};return I(()=>{d(),document.title=i.query.name||""}),()=>{let a;return s("div",null,[s(z,{onGetHeight:t=>{document.documentElement.style.setProperty("--header-height",t+"px")}},{default:()=>[s(b,null,null)]}),s(T,{modelValue:e.refreshing,onRefresh:()=>{e.refreshing=!0,d()}},{default:()=>[s("div",{class:r.phoneListDetailWrap},[s(R,{loadingText:" ",finished:e.finished,finishedText:" ",onLoad:d,immediateCheck:!1},{default:()=>[s("div",{class:r.phoneListDetail},[s(S,{name:"van-fade"},Q(a=e.list.map((t,o)=>s("div",{key:`index-${o}`,class:r.gridItem,onClick:()=>f(o)},[s(H,{class:r.gridImg,src:t.fileUrl},null)])))?a:{default:()=>[a]}),!e.loading&&!e.list.length&&s(P,{key:"OEmpty1",btnStatus:!1,tips:"\u6682\u65E0\u7167\u7247"},null)])]})])]}),s(j,{ref:p,show:e.imgShow,"onUpdate:show":t=>e.imgShow=t,startPosition:e.startPosition,images:c.value,onChange:t=>e.downIndex=t},{cover:()=>s("div",{class:r.downBtn,onClick:()=>A()},[s("img",{src:M},null)])})])}}});export{_ as default};
