photo-create-legacy.0305e566.js 10 KB

1
  1. !function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function t(t){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?e(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t,n,a,r,o,i){try{var c=e[o](i),s=c.value}catch(u){return void n(u)}c.done?t(s):Promise.resolve(s).then(a,r)}function r(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function c(e){a(i,r,o,c,s,"next",e)}function s(e){a(i,r,o,c,s,"throw",e)}c(void 0)}))}}System.register(["./index-legacy.c1f63540.js","./photo.module-legacy.43141335.js","./index-legacy.7e71b67e.js","./index-legacy.3d6462c3.js","./index-legacy.45603cb6.js","./index-legacy.ff6bf1d9.js","./index-legacy.cd65292c.js","./use-tab-status-legacy.77a01b2b.js","./index-legacy.8a8e9c42.js","./index-legacy.ffbb8461.js","./ImagePreview-legacy.ec069a7f.js","./index-legacy.49ab1c78.js","./index-legacy.45d07924.js","./function-call-legacy.f2346a20.js"],(function(e){"use strict";var n,a,o,i,c,s,u,l,p,d,f,h,m,g,v,b,y,w,k,x,S,P,j,I;return{setters:[function(e){n=e.d,a=e.ah,o=e.ag,i=e.r,c=e.$,s=e.c,u=e.aj,l=e.B,p=e.q,d=e.ak,f=e.P,h=e.o,m=e.m,g=e.b9,v=e.bj,b=e.bp,y=e.bz,w=e.bA},function(e){k=e.s},function(e){x=e.O},function(e){S=e.L},function(e){P=e.F},function(e){j=e.A},function(e){I=e.U},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){e("default",n({name:"phone",props:{height:{type:[String,Number],default:"auto"}},setup:function(e){var n=a(),O=o(),R=i({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=function(){var e=r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,R.photoName){e.next=5;break}return h("请输入相册名称"),R.status=!0,e.abrupt("return");case 5:if("add"!==R.selectType){e.next=13;break}return e.next=8,m.post("/api-school/orchestraPhotoAlbum/save",{data:{orchestraId:n.query.orchestraId,name:R.photoName,parentId:n.query.parentId}});case 8:R.status=!1,R.photoName=null,L(),e.next=18;break;case 13:return e.next=15,m.post("/api-school/orchestraPhotoAlbum/update",{data:{id:R.selectItem.id,orchestraId:n.query.orchestraId,parentId:n.query.parentId,name:R.photoName}});case 15:R.status=!1,R.photoName=null,L();case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(0);case 22:case"end":return e.stop()}}),e,null,[[0,20]])})));return function(){return e.apply(this,arguments)}}(),L=function(){R.params.page=1,R.list=[],R.listState.dataShow=!0,R.listState.loading=!1,R.listState.finished=!1,N()},N=function(){var e=r(regeneratorRuntime.mark((function e(){var a,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!R.isLoading){e.next=3;break}return e.abrupt("return");case 3:return R.isLoading=!0,e.next=6,m.post("/api-school/orchestraPhotoAlbum/page",{data:t(t({},R.params),{},{orchestraId:n.query.orchestraId,parentId:n.query.parentId})});case 6:if(a=e.sent,R.listState.loading=!1,r=a.data||{},!(R.list.length>0&&1===r.current)){e.next=11;break}return e.abrupt("return");case 11:o=r.rows||[],R.list=R.list.concat(o),R.listState.finished=r.current>=r.pages,R.params.page=r.current+1,R.listState.dataShow=R.list.length>0,R.isLoading=!1,e.next=24;break;case 19:e.prev=19,e.t0=e.catch(0),R.listState.dataShow=!1,R.listState.finished=!0,R.isLoading=!1;case 24:case"end":return e.stop()}}),e,null,[[0,19]])})));return function(){return e.apply(this,arguments)}}(),T=function(){var e=r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:R.photoName=R.selectItem.name,R.status=!0;case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_=function(){var e=r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:g({message:"您确认删除该相册吗?"}).then(r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.post("/api-school/orchestraPhotoAlbum/remove",{requestType:"form",data:{id:R.selectItem.id}});case 3:L(),e.next=8;break;case 6:e.prev=6,e.t0=e.catch(0);case 8:case"end":return e.stop()}}),e,null,[[0,6]])}))));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();c((function(){N()}));var q=function(e){return!!(e.size/1024/1024<5)||(h("上传文件大小不能超过 5MB"),!1)},U=function(e,t){return!0},A=function(){var e=r(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t.status="uploading",t.message="上传中...",e.next=5,D(t);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),v();case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n){return e.apply(this,arguments)}}(),D=function(){var e=r(regeneratorRuntime.mark((function e(t){var n,a,r,o,i,c,s,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,console.log(t,"files"),n=t.file,"/api-school/open/getUploadSign",a=n.name||"",r="/orchestra/"+(a&&a.replace(/ /gi,"_")),o=(new Date).getTime()+r,e.next=9,m.post("/api-school/open/getUploadSign",{data:{filename:r,bucketName:R.bucket,postData:{filename:r,acl:"public-read",key:o,unknowValueField:[]}}});case 9:for(u in i=e.sent,b({message:"加载中...",forbidClick:!0,loadingType:"spinner",duration:0}),c={policy:i.data.policy,signature:i.data.signature,key:o,KSSAccessKeyId:i.data.kssAccessKeyId,acl:"public-read",name:r},s=new FormData,c)s.append(u,c[u]);return s.append("file",n,r),e.next=17,y(w(R.bucket),{method:"POST",data:s});case 17:l=w(R.bucket)+o,v(),t.src=l,t.status="done",e.next=27;break;case 23:e.prev=23,e.t0=e.catch(0),t.status="failed",console.log(e.t0,"uploadFile");case 27:case"end":return e.stop()}}),e,null,[[0,23]])})));return function(t){return e.apply(this,arguments)}}(),F=function(){var e=r(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(R.fileList.length<=0)){e.next=4;break}return h("请上传照片"),e.abrupt("return");case 4:return t=R.fileList.map((function(e){return e.src})),console.log(t,"onSubmitPhoto"),e.next=8,m.post("/api-school/orchestraPhoto/save",{data:{orchestraId:n.query.orchestraId,orchestraPhotoAlbumId:n.query.parentId,fileUrl:t.join(",")}});case 8:R.showPhoto=!1,R.fileList=[],R.params.page=1,R.list=[],R.listState.dataShow=!0,R.listState.loading=!1,R.listState.finished=!1,N(),e.next=20;break;case 18:e.prev=18,e.t0=e.catch(0);case 20:case"end":return e.stop()}}),e,null,[[0,18]])})));return function(){return e.apply(this,arguments)}}();return function(){return s("div",{class:!R.listState.dataShow&&"emptyRootContainer"},[s(x,{position:"top"},{default:function(){return[s(u,{title:"创建相册"},null),s("div",{class:k.btnGroup},[s(l,{icon:"plus",block:!0,class:k.addPhone,onClick:function(){R.photoName="",R.status=!0,R.selectType="add"}},{default:function(){return[p("新建相册")]}}),s(l,{icon:"plus",block:!0,class:k.addPhone,onClick:function(){return R.showPhoto=!0}},{default:function(){return[p("上传照片")]}})])]}}),s("div",{class:k.phone},[R.listState.dataShow?s(S,{finished:R.listState.finished,finishedText:" ",onLoad:N,immediateCheck:!1,class:k.informationGroup},{default:function(){return[s("div",{class:k.phoneContainer},[R.list.map((function(e){return s("div",{class:k.item,onClick:function(){return function(e){sessionStorage.setItem("orchestra-detail-tab","photo"),O.push({path:"/photo-detail",query:{photoId:e.id,name:e.name}})}(e)}},[s("i",{class:k.more,onClick:function(t){t.stopPropagation(),R.oPopover=!0,R.selectItem=e,R.selectType="update"}},null),s("div",{class:k.img,style:e.coverUrl?{backgroundImage:"url(".concat(e.coverUrl,")"),backgroundSize:"cover"}:""},null),s("p",{class:[k.name,"van-ellipsis"]},[e.name]),s("p",{class:k.num},[e.photoCount,p("张")])])}))])]}}):s(d,{btnStatus:!1,tips:"暂无相册"},null),s(f,{show:R.status,"onUpdate:show":function(e){return R.status=e},round:!0,style:{width:"80%"}},{default:function(){return[s("div",{class:k.container},[s("div",{class:k.dialogTitle},[s("i",null,null),"add"===R.selectType?"新建相册":"重命名相册"]),s(P,{class:k.phoneName,modelValue:R.photoName,"onUpdate:modelValue":function(e){return R.photoName=e},placeholder:"请输入相册名称",maxlength:15},null),s("div",{class:["van-hairline--top van-dialog__footer"]},[s(l,{onClick:function(){return R.status=!1},class:["van-button van-button--default van-button--large van-dialog__cancel"]},{default:function(){return[p("取消")]}}),s(l,{onClick:C,class:["van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"]},{default:function(){return[p("确认")]}})])])]}}),s(j,{cancelText:"取消",show:R.oPopover,"onUpdate:show":function(e){return R.oPopover=e},closeOnClickAction:!0,actions:[{name:"重命名",callback:function(){return T()}},{name:"删除",color:"#F44541",callback:function(){return _()}}]},null)]),s(f,{show:R.showPhoto,"onUpdate:show":function(e){return R.showPhoto=e},round:!0,style:{width:"92%"}},{default:function(){return[s("div",{class:k.container},[s("div",{class:k.dialogTitle},[s("i",null,null),p("上传照片")]),s("div",{class:k.photos},[s(I,{modelValue:R.fileList,"onUpdate:modelValue":function(e){return R.fileList=e},afterRead:A,beforeRead:q,beforeDelete:U,accept:"image/*",maxCount:9},null)]),s("div",{class:["van-hairline--top van-dialog__footer"]},[s(l,{onClick:function(){R.showPhoto=!1,R.fileList=[]},class:["van-button van-button--default van-button--large van-dialog__cancel"]},{default:function(){return[p("取消")]}}),s(l,{onClick:F,class:["van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"]},{default:function(){return[p("确认")]}})])])]}})])}}}))}}}))}();