import{d as m,R as p,c as s,be as v,ah as y,r as b,D as I,$ as U,aj as S,bH as k,ak as L,al as D,m as R,g as O,bj as P,p as E,bl as V,bm as C}from"./index.27735e87.js";import{s as r}from"./index.module.98478511.js";import{O as W}from"./index.71a5f9d3.js";import{O as B}from"./index.8c4977a2.js";import{I as K}from"./index.2b399755.js";import{L as Q}from"./index.ebf6ccaa.js";import"./index.18f2dec1.js";import"./index.d02ae1ba.js";import"./ImagePreview.a54a3be5.js";import"./index.d691a7aa.js";import"./index.06a07328.js";import"./use-tab-status.d6e8df54.js";const T="_imgWrap_12n2v_1";var x={imgWrap:T},j=m({name:"o-image",props:{src:{type:String,default:""}},setup(n){const i=p(!0);return()=>s("div",{class:x.imageWrap,style:i.value?"":{backgroundImage:`url(${n.src})`,backgroundSize:"cover"}},[s(v,{name:"van-fade"},{default:()=>[i.value&&s("img",{style:{display:"none"},src:n.src,onLoad:()=>{i.value=!1}},null)]})])}}),H="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAAdtJREFUWEftlz1LHVEQhp/XQhDB4B8QUwpptEgQEUSJQiBgbWNnaiGVJCio2GmttemDghDBD0gRRFCsLIP5AbkkECIWjvfAWVkPZ3dddwuL3ereOfPx3HfmsHNFxcfMRoAvgAEzkn5USakqwS7WzA6AcZ9nvw00VSVnHUBnwKCHOJX0ugFKK2BmjUK5I9EoVHRjGoUahYoUKDpvZujZKWRmfcBnoAWsSPpb5tVhZj3AJ6AXWJb0K+9HysyG21vEIvAT+CjpX1AwvV6cAFOS/iQ+eTNkZi+Ab8Ab738oaSLI3w2sAy/b9iUH5ED6vdOCpLUcBdzRA6gsoAiMiz2XNBTkXwBWve3KAblNL3m2JH0IAsaAPaArZb+HigFlwPwH3kk6DvJvAnOJrRDIOZrZJPA1BgUcpRc04G3QJpfCwUxL2g/nx8zKAxVAuRl45QtdANepmcmF8XmfBpQDdQt0eKD050KYykA5ULGbnNmmyjMU6XtsptJuj4KpRaGkasagP6pNtSsUQO0Cnd52A7yP3aZYT2tVKAU1DWz77+6f605W8Zj9yde+TJEyvg1QkVqNQlUVugS+FyWp+XwUGEhyhm/7mmuVT+eAfvv1snx0/REtBzQLbDwDKLezz98BDz9rT/lZTVUAAAAASUVORK5CYII=";function J(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!D(n)}var te=m({name:"photo-detail",props:{orchestraId:{type:String,default:""}},setup(n){const i=y();console.log("\u{1F680} ~ route",i);const e=b({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 R.post(`${O.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=I(()=>e.list.map(a=>a.fileUrl)),u=p(),f=a=>{e.downIndex=e.startPosition=a,e.imgShow=!0},A=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")},h=async()=>{const a=c.value[e.downIndex];if(e.downLoading||!a)return;const t=P({message:"\u4FDD\u5B58\u4E2D",duration:0}),o=document.createElement("img");o.crossOrigin="anonymous",o.onload=async()=>{var g;const w=A(o);try{const l=await E({api:"savePicture",content:{base64:w}});((g=l==null?void 0:l.content)==null?void 0:g.status)==="success"?V("\u5DF2\u4FDD\u5B58\u5230\u76F8\u518C"):C("\u4FDD\u5B58\u5931\u8D25")}catch{}t.close(),e.downLoading=!1},o.src=a+`?v=${Date.now()}`};return U(()=>{d(),document.title=i.query.name||""}),()=>{let a;return s("div",null,[s(W,{onGetHeight:t=>{document.documentElement.style.setProperty("--header-height",t+"px")}},{default:()=>[s(S,null,null)]}),s(B,{modelValue:e.refreshing,onRefresh:()=>{e.refreshing=!0,d()}},{default:()=>[s("div",{class:r.phoneListDetailWrap},[s(Q,{loadingText:" ",finished:e.finished,finishedText:" ",onLoad:d,immediateCheck:!1},{default:()=>[s("div",{class:r.phoneListDetail},[s(k,{name:"van-fade"},J(a=e.list.map((t,o)=>s("div",{key:`index-${o}`,class:r.gridItem,onClick:()=>f(o)},[s(j,{class:r.gridImg,src:t.fileUrl},null)])))?a:{default:()=>[a]}),!e.loading&&!e.list.length&&s(L,{key:"OEmpty1",btnStatus:!1,tips:"\u6682\u65E0\u7167\u7247"},null)])]})])]}),s(K,{ref:u,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:()=>h()},[s("img",{src:H},null)])})])}}});export{te as default};
