photo-detail.ec8f5900.js 10 KB

1
  1. import{d as x,ah as N,r as m,y as Q,$ as R,c as a,aj as F,a5 as w,B as A,q as u,ak as O,P as M,al as K,m as p,o as g,bf as k,bq as b,bA as H,p as Y,bD as q,bE as J,bs as z}from"./index.332c7f08.js";import{O as S}from"./index.d7c1b6ac.js";import{c as j}from"./icon-checkbox-default.a253b329.js";import{U as W,g as G,o as Z}from"./oss-file-upload.e630303f.js";import{L as X}from"./index.b186dfda.js";import{C as _}from"./index.4b720f43.js";import{C as $}from"./index.2e331ab5.js";import{I as tt}from"./index.ee7951f5.js";import"./index.96a8db5e.js";import"./function-call.3db51140.js";import"./ImagePreview.e5b44a77.js";import"./index.1e2dfe6e.js";import"./use-tab-status.9d769af8.js";import"./Checker.1af5496e.js";const et="_phoneDetail_7n32f_1",ot="_addPhone_7n32f_7",at="_phoneContainer_7n32f_15",st="_item_7n32f_21",nt="_img_7n32f_25",it="_itemBorder_7n32f_39",ct="_checkboxHide_7n32f_60",lt="_iconChecked_7n32f_63",rt="_dialogTitle_7n32f_71",dt="_photos_7n32f_87",ut="_downBtn_7n32f_90";var n={phoneDetail:et,addPhone:ot,phoneContainer:at,item:st,img:nt,itemBorder:it,checkboxHide:ct,iconChecked:lt,dialogTitle:rt,photos:dt,downBtn:ut},ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABB9JREFUaEPtWU1oXFUU/s6b28SQpq1FaFC0WlFBSszMfcyrVTELN0LdGVO60GzsSisWU7Ow5KkBsS0F/0BcVQKSVHFjoRsXUarxDe/MxFBcWNTYCFqQUh1cmN6ZK7fNjC/JzLyfNpMJzN29d8/5zvneOefec98lbPBBG9x/JCLQ39+/LZVKHQbwNIBdADoTfoh/AfwM4LNSqXRydnb2Slyc2AQcx3lQKXUWwF1xjYXIXxRCPOl53g9xcGMR6Ovr6xZCnCeiu+MYiSqrtZ5XSu2em5v7J6pOLAKZTGaEiI5FBU8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FTkSuQmCC";function gt(d){return typeof d=="function"||Object.prototype.toString.call(d)==="[object Object]"&&!K(d)}var Lt=x({name:"photo-detail",setup(){const d=N(),t=m({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}},U=o=>o.size/1024/1024<5?!0:(g("\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 5MB"),!1),v=(o,e)=>!0,C=async(o,e)=>{try{o.status="uploading",o.message="\u4E0A\u4F20\u4E2D...",await E(o)}catch{k()}},E=async o=>{try{console.log(o,"files");const e=o.file,s=e.name||"",c="/orchestra/"+(s&&s.replace(/ /gi,"_")),l=new Date().getTime()+c,{data:r}=await G({filename:l,bucketName:t.bucket,postData:{filename:l,acl:"public-read",key:l,unknowValueField:[]}});b({message:"\u52A0\u8F7D\u4E2D...",forbidClick:!0,loadingType:"spinner",duration:0});const I={policy:r.policy,signature:r.signature,key:l,KSSAccessKeyId:r.kssAccessKeyId,acl:"public-read",name:l,file:e},T=await Z(H(t.bucket),I);k(),o.src=T,o.status="done"}catch(e){o.status="failed",console.log(e,"uploadFile")}},y=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=m({show:!1,startPosition:0,downIndex:0,downLoading:!1}),f=Q(()=>t.list.map(o=>o.fileUrl)),B=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")},V=async()=>{const o=f.value[i.downIndex];if(i.downLoading||!o)return;const e=b({message:"\u4FDD\u5B58\u4E2D",duration:0}),s=document.createElement("img");s.crossOrigin="anonymous",s.onload=async()=>{var l;const c=B(s);try{const r=await Y({api:"savePicture",content:{base64:c}});((l=r==null?void 0:r.content)==null?void 0:l.status)==="success"?q("\u4FDD\u5B58\u6210\u529F"):J("\u4FDD\u5B58\u5931\u8D25")}catch{}e.close(),i.downLoading=!1},s.src=o+`?v=${Date.now()}`},P=o=>{i.downIndex=i.startPosition=o,i.show=!0},L=o=>{t.checkboxRefs[o].toggle()},D=()=>{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 R(()=>{h()}),()=>{let o;return a("div",{class:[n.phoneDetail,!t.listState.dataShow&&"emptyRootContainer"]},[a(S,{position:"top"},{default:()=>[a(F,{title:d.query.name||""},{right:()=>a(w,{name:ht,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(X,{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?L(e.id):P(s)}},[a($,{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(w,{class:n.iconChecked,name:c.checked?At:j},null)}),a("div",{class:n.img,style:e.fileUrl?{backgroundImage:`url(${e.fileUrl})`,backgroundSize:"cover"}:""},null)])))?o:{default:()=>[o]})]}):a(O,{btnStatus:!1,tips:"\u6682\u65E0\u7167\u7247"},null),t.isEdit&&a(S,{position:"bottom"},{default:()=>[a("div",{class:"btnGroup"},[a(A,{block:!0,round:!0,type:"primary",onClick:D},{default:()=>[u("\u5220\u9664")]})])]}),a(M,{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(W,{modelValue:t.fileList,"onUpdate:modelValue":e=>t.fileList=e,afterRead:C,beforeRead:U,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:y,class:["van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"]},{default:()=>[u("\u786E\u8BA4")]})])])]}),a(tt,{show:i.show,"onUpdate:show":e=>i.show=e,startPosition:i.startPosition,images:f.value,onChange:e=>i.downIndex=e},{cover:()=>a("div",{class:n.downBtn,onClick:()=>V()},[a("img",{src:pt},null)])})])}}});export{Lt as default};