1 |
- System.register(["./index-legacy.eb062188.js","./photo.module-legacy.43141335.js","./index-legacy.ad813f4d.js","./index-legacy.fad72574.js","./index-legacy.3a3e070a.js","./index-legacy.8c254533.js","./index-legacy.bd6987bf.js","./use-tab-status-legacy.91417466.js","./index-legacy.918b8c74.js","./index-legacy.b7c35e0c.js","./ImagePreview-legacy.747d0051.js","./index-legacy.fab451f1.js","./index-legacy.fecc738b.js","./function-call-legacy.0bd16987.js"],(function(t){"use strict";var a,e,o,s,n,l,i,c,d,r,u,h,p,f,m,g,y,b,v,w,S,k,I,P;return{setters:[function(t){a=t.d,e=t.ah,o=t.ag,s=t.r,n=t.$,l=t.c,i=t.aj,c=t.B,d=t.q,r=t.ak,u=t.P,h=t.o,p=t.m,f=t.bd,m=t.bj,g=t.bv,y=t.bD,b=t.bE},function(t){v=t.s},function(t){w=t.O},function(t){S=t.L},function(t){k=t.F},function(t){I=t.A},function(t){P=t.U},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){t("default",a({name:"phone",props:{height:{type:[String,Number],default:"auto"}},setup(t){const a=e(),j=o(),x=s({oPopover:!1,showPhoto:!1,status:!1,isLoading:!1,photoName:null,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{page:1,rows:20},selectItem:{},selectType:"add",fileList:[],bucket:"gyt"}),C=async()=>{try{if(!x.photoName)return h("请输入相册名称"),void(x.status=!0);"add"===x.selectType?(await p.post("/api-school/orchestraPhotoAlbum/save",{data:{orchestraId:a.query.orchestraId,name:x.photoName,parentId:a.query.parentId}}),x.status=!1,x.photoName=null,L()):(await p.post("/api-school/orchestraPhotoAlbum/update",{data:{id:x.selectItem.id,orchestraId:a.query.orchestraId,parentId:a.query.parentId,name:x.photoName}}),x.status=!1,x.photoName=null,L())}catch{}},L=()=>{x.params.page=1,x.list=[],x.listState.dataShow=!0,x.listState.loading=!1,x.listState.finished=!1,N()},N=async()=>{try{if(x.isLoading)return;x.isLoading=!0;const t=await p.post("/api-school/orchestraPhotoAlbum/page",{data:{...x.params,orchestraId:a.query.orchestraId,parentId:a.query.parentId}});x.listState.loading=!1;const e=t.data||{};if(x.list.length>0&&1===e.current)return;const o=e.rows||[];x.list=x.list.concat(o),x.listState.finished=e.current>=e.pages,x.params.page=e.current+1,x.listState.dataShow=x.list.length>0,x.isLoading=!1}catch{x.listState.dataShow=!1,x.listState.finished=!0,x.isLoading=!1}};n((()=>{N()}));const T=t=>!!(t.size/1024/1024<5)||(h("上传文件大小不能超过 5MB"),!1),_=(t,a)=>!0,q=async(t,a)=>{try{t.status="uploading",t.message="上传中...",await U(t)}catch(e){m()}},U=async t=>{try{console.log(t,"files");const a=t.file,e="/api-school/open/getUploadSign",o=a.name||"",s="/orchestra/"+(o&&o.replace(/ /gi,"_")),n=(new Date).getTime()+s,l=await p.post(e,{data:{filename:s,bucketName:x.bucket,postData:{filename:s,acl:"public-read",key:n,unknowValueField:[]}}});g({message:"加载中...",forbidClick:!0,loadingType:"spinner",duration:0});const i={policy:l.data.policy,signature:l.data.signature,key:n,KSSAccessKeyId:l.data.kssAccessKeyId,acl:"public-read",name:s},c=new FormData;for(const t in i)c.append(t,i[t]);c.append("file",a,s),await y(b(x.bucket),{method:"POST",data:c});const d=b(x.bucket)+n;m(),t.src=d,t.status="done"}catch(a){t.status="failed",console.log(a,"uploadFile")}},A=async()=>{try{if(x.fileList.length<=0)return void h("请上传照片");const t=x.fileList.map((t=>t.src));console.log(t,"onSubmitPhoto"),await p.post("/api-school/orchestraPhoto/save",{data:{orchestraId:a.query.orchestraId,orchestraPhotoAlbumId:a.query.parentId,fileUrl:t.join(",")}}),x.showPhoto=!1,x.fileList=[],x.params.page=1,x.list=[],x.listState.dataShow=!0,x.listState.loading=!1,x.listState.finished=!1,N()}catch{}};return()=>l("div",{class:!x.listState.dataShow&&"emptyRootContainer"},[l(w,{position:"top"},{default:()=>[l(i,{title:"创建相册"},null),l("div",{class:v.btnGroup},[l(c,{icon:"plus",block:!0,class:v.addPhone,onClick:()=>{x.photoName="",x.status=!0,x.selectType="add"}},{default:()=>[d("新建相册")]}),l(c,{icon:"plus",block:!0,class:v.addPhone,onClick:()=>x.showPhoto=!0},{default:()=>[d("上传照片")]})])]}),l("div",{class:v.phone},[x.listState.dataShow?l(S,{finished:x.listState.finished,finishedText:" ",onLoad:N,immediateCheck:!1,class:v.informationGroup},{default:()=>[l("div",{class:v.phoneContainer},[x.list.map((t=>l("div",{class:v.item,onClick:()=>(t=>{sessionStorage.setItem("orchestra-detail-tab","photo"),j.push({path:"/photo-detail",query:{photoId:t.id,name:t.name}})})(t)},[l("i",{class:v.more,onClick:a=>{a.stopPropagation(),x.oPopover=!0,x.selectItem=t,x.selectType="update"}},null),l("div",{class:v.img,style:t.coverUrl?{backgroundImage:`url(${t.coverUrl})`,backgroundSize:"cover"}:""},null),l("p",{class:[v.name,"van-ellipsis"]},[t.name]),l("p",{class:v.num},[t.photoCount,d("张")])])))])]}):l(r,{btnStatus:!1,tips:"暂无相册"},null),l(u,{show:x.status,"onUpdate:show":t=>x.status=t,round:!0,style:{width:"80%"}},{default:()=>[l("div",{class:v.container},[l("div",{class:v.dialogTitle},[l("i",null,null),"add"===x.selectType?"新建相册":"重命名相册"]),l(k,{class:v.phoneName,modelValue:x.photoName,"onUpdate:modelValue":t=>x.photoName=t,placeholder:"请输入相册名称",maxlength:15},null),l("div",{class:["van-hairline--top van-dialog__footer"]},[l(c,{onClick:()=>x.status=!1,class:["van-button van-button--default van-button--large van-dialog__cancel"]},{default:()=>[d("取消")]}),l(c,{onClick:C,class:["van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"]},{default:()=>[d("确认")]})])])]}),l(I,{cancelText:"取消",show:x.oPopover,"onUpdate:show":t=>x.oPopover=t,closeOnClickAction:!0,actions:[{name:"重命名",callback:()=>(async()=>{x.photoName=x.selectItem.name,x.status=!0})()},{name:"删除",color:"#F44541",callback:()=>(async()=>{f({message:"您确认删除该相册吗?"}).then((async()=>{try{await p.post("/api-school/orchestraPhotoAlbum/remove",{requestType:"form",data:{id:x.selectItem.id}}),L()}catch{}}))})()}]},null)]),l(u,{show:x.showPhoto,"onUpdate:show":t=>x.showPhoto=t,round:!0,style:{width:"92%"}},{default:()=>[l("div",{class:v.container},[l("div",{class:v.dialogTitle},[l("i",null,null),d("上传照片")]),l("div",{class:v.photos},[l(P,{modelValue:x.fileList,"onUpdate:modelValue":t=>x.fileList=t,afterRead:q,beforeRead:T,beforeDelete:_,accept:"image/*",maxCount:9},null)]),l("div",{class:["van-hairline--top van-dialog__footer"]},[l(c,{onClick:()=>{x.showPhoto=!1,x.fileList=[]},class:["van-button van-button--default van-button--large van-dialog__cancel"]},{default:()=>[d("取消")]}),l(c,{onClick:A,class:["van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"]},{default:()=>[d("确认")]})])])]})])}}))}}}));
|