webpackjsonp([53],{"4qsn":function(e,i,t){"use strict";object.defineproperty(i,"__esmodule",{value:!0});var n=t("vudn"),o=t.n(n);for(var s in n)"default"!==s&&function(e){t.d(i,e,function(){return n[e]})}(s);var r=t("ekwc"),l=!1;var a=function(e){l||t("pj10")},u=t("x4nt")(o.a,r.a,!1,a,null,null);u.options.__file="pages/projects/components/shop-image-upload.vue",i.default=u.exports},ekwc:function(e,i,t){"use strict";var n=function(){var e=this,i=e.$createelement,t=e._self._c||i;return t("div",{staticclass:"mod-shop-img-upload"},[t("el-dialog",{attrs:{"close-on-click-modal":!1,visible:e.visible,"show-close":!0},on:{"update:visible":function(i){e.visible=i}}},[t("span",{attrs:{slot:"title"},slot:"title"},[t("span",{staticstyle:{"font-size":"18px"}},[e._v("\n "+e._s(e.shopname)+"门店图片\n "),t("span",{staticstyle:{color:"red","font-size":"12px"}},[e._v("\n 同一门店,请至少上传3张门店图\n ")])])]),t("el-upload",{ref:"shop-img-upload",attrs:{multiple:"",accept:".jpg, .jpeg, .png",action:e.uploadbaseurl,"list-type":"picture-card","file-list":e.openfilelist,"on-exceed":e.handleexceed,"on-preview":e.handlepicturecardpreview,"on-remove":e.handleremove,"on-success":e.handlesuccess,"before-upload":e.beforeimgupload}},[t("i",{staticclass:"el-icon-plus"}),t("div",{staticclass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[e._v("\n 只能上传jpg/png文件,且不超过5m\n ")])]),t("div",{staticclass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(i){e.visible=!1}}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary",disabled:e.uploading||e.submitloading},on:{click:e.handlesubmit}},[e._v("\n 确认\n ")])],1)],1),t("el-dialog",{attrs:{visible:e.imgviewvisible,fullscreen:"","append-to-body":""},on:{"update:visible":function(i){e.imgviewvisible=i}}},[t("img",{attrs:{width:"100%",src:e.imgviewurl,alt:""}})])],1)};n._withstripped=!0;var o={render:n,staticrenderfns:[]};i.a=o},ihpb:function(e,i,t){"use strict";i.__esmodule=!0;var n,o=t("kfhr"),s=(n=o)&&n.__esmodule?n:{default:n};i.default=function(e){if(array.isarray(e)){for(var i=0,t=array(e.length);i1?arguments[1]:void 0,m=void 0!==g,v=0,b=d(p);if(m&&(g=n(g,h>2?arguments[2]:void 0,2)),void 0==b||c==array&&l(b))for(t=new c(i=a(p.length));i>v;v++)u(t,v,m?g(p[v],v):p[v]);else for(f=b.call(p),t=new c;!(o=f.next()).done;v++)u(t,v,m?r(f,g,[o.value,v],!0):o.value);return t.length=v,t}})},"b+xt":function(e,i,t){t("atqf"),t("kbgy"),e.exports=t("lnjp").array.from},glw1:function(e,i,t){"use strict";var n=t("vqwq"),o=t("tukw");e.exports=function(e,i,t){i in e?n.f(e,i,o(0,t)):e[i]=t}},hul5:function(e,i,t){(e.exports=t("utlt")(!1)).push([e.i,".tip-num{color:red;font-weight:700}.mod-shop-img-upload .el-dialog__headerbtn{width:auto}.mod-shop-img-upload .el-button{padding:0}",""])},kfhr:function(e,i,t){e.exports={default:t("b+xt"),__esmodule:!0}},pj10:function(e,i,t){var n=t("hul5");"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);t("fiqi")("4c4420b4",n,!1,{sourcemap:!1})},vudn:function(e,i,t){"use strict";object.defineproperty(i,"__esmodule",{value:!0});var n=l(t("ihpb")),o=l(t("4yfn")),s=t("9rma"),r=l(t("psvj"));function l(e){return e&&e.__esmodule?e:{default:e}}i.default={data:function(){return{shopname:"",visible:!1,imgviewvisible:!1,imgviewurl:"",uploadbaseurl:r.default.uploadbaseurl+"/apps",preshopid:"",openfilelist:[],fileids:[],form:{openfiles:[]},uploading:!1,submitloading:!1}},components:{},methods:(0,o.default)({},(0,s.mapactions)({saveopenimage:"project/saveopenimage",getopenimage:"project/getopenimage"}),{init:function(e){var i=this;this.visible=!0,this.$nexttick(function(){i.preshopid=e.proshopid||"-1",i.shopname=e.proshopname||"";var t=i.transfilelist(e.openfiles||[]);i.openfilelist=[].concat((0,n.default)(t)),i.form.openfiles=[].concat((0,n.default)(t)),i.dosetuploadershow()})},transfilelist:function(){var e=[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).foreach(function(i){e.push({name:i.filename||"图片",url:r.default.downloadbaseurl+"/"+(i.filepath||i.filename),fileid:i.fileid,filename:i.filename,filepath:i.filepath||i.filename,proshopid:i.proshopid})}),e},dosetuploadershow:function(){var e=this;this.$nexttick(function(){e.uploading=!1;var i=e.form.openfiles.length>=5?"none":"",t=e.$refs["shop-img-upload"];if(t&&t.$el.childnodes){var n=null;t.$el.childnodes.foreach(function(e){"el-upload el-upload--picture-card"==e.classname&&(n=e)}),n&&(n.style.display=i)}})},handleexceed:function(e,i){},handlepicturecardpreview:function(e){console.log("handlepicturecardpreview file:",e),this.imgviewurl=e.url,this.imgviewvisible=!0},handlesubmit:function(){var e=this,i=this.preshopid;console.log("handlesubmit filelist:",this.openfilelist);var t=[];this.form.openfiles.foreach(function(e){e.fileid&&t.push(e.fileid)}),t.length<3?this.$message.error("开店图片至少成功上传3张,请检查!"):(this.submitloading=!0,this.saveopenimage({proshopid:i,fileids:t}).then(function(i){e.visible=!1,e.$message.success("操作成功!"),e.$emit("afterimageuploadsuccessed"),e.submitloading=!1}).catch(function(i){console.log("handlesubmit err:",i),e.submitloading=!1}))},handlesuccess:function(e,i,t){if(e&&e.returntargets&&e.returntargets.length>0){var n=e.returntargets[0],o={fileid:n.fileid,filepath:n.filename,name:n.filerawname,url:r.default.downloadbaseurl+"/"+n.filename};this.form.openfiles.push(o),this.dosetuploadershow()}else{this.$message.error(e&&e.message||"抱歉,文件上传失败!");var s=t.findindex(function(e){if(e.hasownproperty("response"))return 200!==number(e.response.code)});-1!==s&&t.splice(s,1)}},handleremove:function(e,i){if(e.fileid){var t=i.findindex(function(i){return i.fileid===e.fileid});-1!==t&&i.splice(t,1),this.form.openfiles=this.form.openfiles.filter(function(i){return i.fileid!==e.fileid})}else if(e.response&&e.response.returntargets&&e.response.returntargets.length>0){var n=e.response.returntargets[0].fileid,o=i.findindex(function(e){if(e.response&&e.response.returntargets&&e.response.returntargets.length>0){var i=e.response.returntargets[0].fileid;return n===i}return!1});-1!==o&&i.splice(o,1),this.form.openfiles=this.form.openfiles.filter(function(e){return e.fileid!==n})}this.dosetuploadershow()},handlepreview:function(e){this.imgviewurl=e.url,this.imgviewvisible=!0},beforeimgupload:function(e){var i=["image/jpeg","image/png","image/gif"].includes(e.type.tolowercase()),t=e.size/1024/1024<=5;return i||this.$message.error("上传图片只能是 jpg/gif/png 格式!"),t||this.$message.error("上传图片单张大小不能超过 5m!"),i&&t}})}}});