1 |
- import{d as F,ah as O,r as S,y as M,$ as K,c as a,aj as H,a5 as U,B as A,q as u,ak as Y,P as q,al as J,m as p,o as g,bj as v,bv as C,bD as z,bE as E,p as j,bG as G,bH as W,bx as Z}from"./index.5f7ffb46.js";import{O as y}from"./index.7790de2a.js";import{c as X}from"./icon-checkbox-default.a253b329.js";import{L as _}from"./index.9ef28852.js";import{C as $}from"./index.d979c853.js";import{C as tt}from"./index.13900508.js";import{U as et}from"./index.36e5ddaf.js";import{I as ot}from"./index.4f3f29e9.js";import"./use-tab-status.69b57a37.js";import"./Checker.40bdbb46.js";import"./index.276a5d68.js";import"./function-call.aca3a7bc.js";import"./ImagePreview.289405c5.js";import"./index.99e0cf1f.js";const at="_phoneDetail_7n32f_1",st="_addPhone_7n32f_7",nt="_phoneContainer_7n32f_15",it="_item_7n32f_21",ct="_img_7n32f_25",lt="_itemBorder_7n32f_39",rt="_checkboxHide_7n32f_60",dt="_iconChecked_7n32f_63",ut="_dialogTitle_7n32f_71",ht="_photos_7n32f_87",At="_downBtn_7n32f_90";var n={phoneDetail:at,addPhone:st,phoneContainer:nt,item:it,img:ct,itemBorder:lt,checkboxHide:rt,iconChecked:dt,dialogTitle:ut,photos:ht,downBtn:At},pt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABB9JREFUaEPtWU1oXFUU/s6b28SQpq1FaFC0WlFBSszMfcyrVTELN0LdGVO60GzsSisWU7Ow5KkBsS0F/0BcVQKSVHFjoRsXUarxDe/MxFBcWNTYCFqQUh1cmN6ZK7fNjC/JzLyfNpMJzN29d8/5zvneOefec98lbPBBG9x/JCLQ39+/LZVKHQbwNIBdADoTfoh/AfwM4LNSqXRydnb2Slyc2AQcx3lQKXUWwF1xjYXIXxRCPOl53g9xcGMR6Ovr6xZCnCeiu+MYiSqrtZ5XSu2em5v7J6pOLAKZTGaEiI5FBU8ip7U+ks/nj0fVjUVASnkOwCMB8FNCiJc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prototype.toString.call(d)==="[object Object]"&&!J(d)}var It=F({name:"photo-detail",setup(){const d=O(),t=S({isEdit:!1,isLoading:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{page:1,rows:20},showPhoto:!1,bucket:"gyt",fileList:[],checkboxRefs:[],check:[]}),h=async()=>{try{if(t.isLoading)return;t.isLoading=!0;const o=await p.post("/api-school/orchestraPhoto/page",{data:{...t.params,orchestraPhotoAlbumId:d.query.photoId}});t.listState.loading=!1;const e=o.data||{};if(t.list.length>0&&e.current===1)return;const s=e.rows||[];t.list=t.list.concat(s),t.listState.finished=e.current>=e.pages,t.params.page=e.current+1,t.listState.dataShow=t.list.length>0,t.isLoading=!1}catch{t.listState.dataShow=!1,t.listState.finished=!0,t.isLoading=!1}},B=o=>o.size/1024/1024<5?!0:(g("\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 5MB"),!1),V=(o,e)=>!0,P=async(o,e)=>{try{o.status="uploading",o.message="\u4E0A\u4F20\u4E2D...",await L(o)}catch{v()}},L=async o=>{try{console.log(o,"files");const e=o.file,s="/api-school/open/getUploadSign",c=e.name||"",l="/orchestra/"+(c&&c.replace(/ /gi,"_")),r=new Date().getTime()+l,f=await p.post(s,{data:{filename:l,bucketName:t.bucket,postData:{filename:l,acl:"public-read",key:r,unknowValueField:[]}}});C({message:"\u52A0\u8F7D\u4E2D...",forbidClick:!0,loadingType:"spinner",duration:0});const k={policy:f.data.policy,signature:f.data.signature,key:r,KSSAccessKeyId:f.data.kssAccessKeyId,acl:"public-read",name:l},m=new FormData;for(const b in k)m.append(b,k[b]);m.append("file",e,l),await z(E(t.bucket),{method:"POST",data:m});const R=E(t.bucket)+r;v(),o.src=R,o.status="done"}catch(e){o.status="failed",console.log(e,"uploadFile")}},D=async()=>{try{if(t.fileList.length<=0){g("\u8BF7\u4E0A\u4F20\u7167\u7247");return}const o=t.fileList.map(e=>e.src);console.log(o,"onSubmitPhoto"),await p.post("/api-school/orchestraPhoto/save",{data:{orchestraPhotoAlbumId:d.query.photoId,fileUrl:o.join(",")}}),t.showPhoto=!1,t.fileList=[],t.params.page=1,t.list=[],t.listState.dataShow=!0,t.listState.loading=!1,t.listState.finished=!1,h()}catch{}},i=S({show:!1,startPosition:0,downIndex:0,downLoading:!1}),w=M(()=>t.list.map(o=>o.fileUrl)),I=o=>{const e=document.createElement("canvas");e.width=o.width,e.height=o.height;const s=e.getContext("2d");return s==null||s.drawImage(o,0,0,e.width,e.height),console.log(o,e),e.toDataURL("image/png")},T=async()=>{const o=w.value[i.downIndex];if(i.downLoading||!o)return;const e=C({message:"\u4FDD\u5B58\u4E2D",duration:0}),s=document.createElement("img");s.crossOrigin="anonymous",s.onload=async()=>{var l;const c=I(s);try{const r=await j({api:"savePicture",content:{base64:c}});((l=r==null?void 0:r.content)==null?void 0:l.status)==="success"?G("\u4FDD\u5B58\u6210\u529F"):W("\u4FDD\u5B58\u5931\u8D25")}catch{}e.close(),i.downLoading=!1},s.src=o+`?v=${Date.now()}`},x=o=>{i.downIndex=i.startPosition=o,i.show=!0},N=o=>{t.checkboxRefs[o].toggle()},Q=()=>{if(t.check.length<=0){g("\u8BF7\u9009\u62E9\u9700\u8981\u5220\u9664\u7684\u56FE\u7247");return}Z({title:"\u786E\u8BA4\u5220\u9664",message:"\u5220\u9664\u9009\u62E9\u7684\u7167\u7247",confirmButtonText:"\u786E\u8BA4",showCancelButton:!0}).then(async()=>{console.log(t.check,"check");try{await p.post("/api-school/orchestraPhoto/remove",{requestType:"form",data:{ids:t.check.join(",")}}),t.params.page=1,t.list=[],t.listState.dataShow=!0,t.listState.loading=!1,t.listState.finished=!1,h()}catch{}})};return K(()=>{h()}),()=>{let o;return a("div",{class:[n.phoneDetail,!t.listState.dataShow&&"emptyRootContainer"]},[a(y,{position:"top"},{default:()=>[a(H,{title:d.query.name||""},{right:()=>a(U,{name:pt,size:22,onClick:()=>t.isEdit=!t.isEdit},null)}),a("div",{style:{overflow:"hidden"}},[a(A,{icon:"plus",block:!0,class:n.addPhone,onClick:()=>t.showPhoto=!0},{default:()=>[u("\u4E0A\u4F20\u7167\u7247")]})])]}),t.listState.dataShow?a(_,{finished:t.listState.finished,finishedText:" ",onLoad:h,immediateCheck:!1},{default:()=>[a($,{class:n.phoneContainer,modelValue:t.check,"onUpdate:modelValue":e=>t.check=e},gt(o=t.list.map((e,s)=>a("div",{class:[n.item,t.check.includes(e.id)&&n.itemBorder],onClick:()=>{t.isEdit?N(e.id):x(s)}},[a(tt,{name:e.id,checkedColor:"#64a9ff",class:[n.checkbox,!t.isEdit&&n.checkboxHide],ref:c=>t.checkboxRefs[e.id]=c,onClick:c=>{c.stopPropagation()}},{icon:c=>a(U,{class:n.iconChecked,name:c.checked?ft:X},null)}),a("div",{class:n.img,style:e.fileUrl?{backgroundImage:`url(${e.fileUrl})`,backgroundSize:"cover"}:""},null)])))?o:{default:()=>[o]})]}):a(Y,{btnStatus:!1,tips:"\u6682\u65E0\u7167\u7247"},null),t.isEdit&&a(y,{position:"bottom"},{default:()=>[a("div",{class:"btnGroup"},[a(A,{block:!0,round:!0,type:"primary",onClick:Q},{default:()=>[u("\u5220\u9664")]})])]}),a(q,{show:t.showPhoto,"onUpdate:show":e=>t.showPhoto=e,round:!0,style:{width:"92%"}},{default:()=>[a("div",{class:n.container},[a("div",{class:n.dialogTitle},[a("i",null,null),u("\u4E0A\u4F20\u7167\u7247")]),a("div",{class:n.photos},[a(et,{modelValue:t.fileList,"onUpdate:modelValue":e=>t.fileList=e,afterRead:P,beforeRead:B,beforeDelete:V,accept:"image/*",maxCount:9},null)]),a("div",{class:["van-hairline--top van-dialog__footer"]},[a(A,{onClick:()=>{t.showPhoto=!1,t.fileList=[]},class:["van-button van-button--default van-button--large van-dialog__cancel"]},{default:()=>[u("\u53D6\u6D88")]}),a(A,{onClick:D,class:["van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"]},{default:()=>[u("\u786E\u8BA4")]})])])]}),a(ot,{show:i.show,"onUpdate:show":e=>i.show=e,startPosition:i.startPosition,images:w.value,onChange:e=>i.downIndex=e},{cover:()=>a("div",{class:n.downBtn,onClick:()=>T()},[a("img",{src:mt},null)])})])}}});export{It as default};
|