(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0398cdaf"],{"3ada":function(e,t,i){"use strict";i("c2c2")},"6b45":function(e,t,i){"use strict";i.r(t);var a=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("el-upload",e._b({class:{hide:e.fileList.length>=e.limit},attrs:{action:e.api+"upload",data:e.data,"list-type":"picture-card",headers:e.headers,"on-preview":e.handlePictureCardPreview,"on-remove":e.handleRemove,"on-success":e.uploadSuccess,"on-exceed":e.limitAlert,"file-list":e.fileList,limit:e.limit,multiple:!0,drag:!0}},"el-upload",e.$attrs,!1),[i("i",{staticClass:"el-icon-plus"})]),i("el-dialog",{attrs:{visible:e.dialogVisible,"append-to-body":!0},on:{"update:visible":function(t){e.dialogVisible=t}}},[i("img",{attrs:{width:"100%",src:e.dialogImageUrl,alt:""}})])],1)},n=[],l=i("53ca"),r=(i("d81d"),i("b0c0"),i("e9f5"),i("ab43"),i("a9e3"),i("d3b7"),i("ac1f"),i("5319"),i("5f87")),u={name:"UploadImage",model:{prop:"value",event:"update"},props:{data:{type:Object,default:function(){return{}}},value:{type:[Array,String],default:function(){return[]}},limit:{type:Number,default:100},api:{type:String,default:window.global.baseURL}},data:function(){return{init:!0,dialogVisible:!1,dialogImageUrl:"",fileList:[],renderFileList:[],allPicList:[],headers:{Authorization:Object(r["a"])()}}},watch:{value:{handler:function(e){var t=this;e&&(this.fileList=e instanceof Array?e.map((function(e){return{name:"object"===Object(l["a"])(e)?e.name:e,url:t.formatImgUrl("object"===Object(l["a"])(e)?e.name:e)}})):[{name:e,url:this.formatImgUrl(e)}])},immediate:!0}},created:function(){},methods:{formatImgUrl:function(e){if(e)return String(e).indexOf("http")>-1?e:(0!==String(e).indexOf("/")&&(e="/"+e),this.api+e)},limitAlert:function(){this.$message({message:"最多只能上传"+this.limit+"张图片",type:"warning"})},handlePictureCardPreview:function(e){this.dialogImageUrl=e.url,this.dialogVisible=!0},judgeUrlValue:function(e){return e.response?e.response.data.url:e.url},removeHost:function(e){return e.replace(this.api,"")},uploadSuccess:function(e,t,i){var a=this;console.log("🚀 图片上传成功：",e,t,i),this.allPicList=i.map((function(e){return{name:e.name,url:a.judgeUrlValue(e)}}));var n=i.map((function(e){return a.removeHost(a.judgeUrlValue(e))}));this.$emit("update",n)},handleRemove:function(e,t){var i=this;this.allPicList=t.map((function(e){return{name:e.name,url:i.judgeUrlValue(e)}})),this.$emit("update",t.map((function(e){return i.removeHost(i.judgeUrlValue(e))})))}}},o=u,s=(i("3ada"),i("2877")),c=Object(s["a"])(o,a,n,!1,null,null,null);t["default"]=c.exports},c2c2:function(e,t,i){}}]);