(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-58a12740"],{"87a0":function(t,e,i){"use strict";i.r(e);var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"cl-upload"},[i("el-input",{attrs:{type:"hidden"},model:{value:t.value,callback:function(e){t.value=e},expression:"value"}}),t._l(t.list,(function(e,n){return i("el-upload",t._b({key:n,attrs:{accept:"image/*",headers:{token:t.token},name:"content","on-change":t.getFile,"auto-upload":!1,action:t.action,"show-file-list":!1,"on-error":t.onError,"before-upload":function(i){t.beforeUpload(i,e,n)}}},"el-upload",t.props,!1),[t._t("content",[i("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"item.loading"}],staticClass:"upload-wrap"},[e.url?i("img",{attrs:{src:t._f("check_prefix")(e.url),alt:""}}):i("i",{staticClass:"el-icon-plus avatar-uploader-icon"}),e.url?i("i",{staticClass:"el-icon-close",on:{click:function(e){return e.stopPropagation(),t.removeFile(n)}}}):t._e()])])],2)}))],2)},o=[],r=i("f374"),s=(i("403f"),i("297b"),i("37de"),i("22f9"),i("a9b5"),i("fdea"),i("476c"),i("c9b2"),i("7479"),i("5880")),l=i("51be"),a={props:{props:{type:Object,default:function(){return{}}},value:[Array,String],hostUrl:{default:""}},data:function(){var t=this.$service.common.upload();return{imgHostUrl:l["imgHostUrl"],action:t.url,list:[],index:0}},filters:{check_prefix:function(t){return t.includes("http")?t:l["imgHostUrl"]+t}},computed:Object(r["a"])({},Object(s["mapGetters"])(["token"])),watch:{value:function(){this.render()}},mounted:function(){this.render()},methods:{render:function(){var t=this.props.multiple,e=this.value;if(t){var i=[];i=e instanceof Array?e:(e||"").split(","),this.list=i.filter(Boolean).map((function(t){return{url:t,loading:!1}})),this.ajSize()}else this.list=[{url:e,loading:!1}]},callback:function(){this.ajSize(),this.$emit("input",this.list.filter((function(t){return t.url})).map((function(t){return t.url})).join(","))},ajSize:function(){var t=this.props["multiple-limit"],e=void 0===t?1:t;this.list.length<e&&this.list.unshift({})},beforeUpload:function(t,e,i){this.index=i,this.props&&this.props["before-upload"]&&this.props["before-upload"](t),e.loading=!0},onSuccess:function(t,e){var i=this.list[this.index],n=(t.url,t.smallUrl,t.shortUrl),o=this.props.multiple;i.loading=!1,o?i.url?i.url=n:this.list.push({url:n}):this.list=[{url:n}],this.callback(),console.log("this.props",this.props),this.props&&this.props["on-success"]&&this.props["on-success"](t,e)},onError:function(t,e,i){console.error("upload error",t),this.$message.error("图片上传失败"),this.loading=!1,this.props&&this.props["on-error"]&&this.props["on-error"](t,e,i)},removeFile:function(t){this.list.splice(t,1),this.callback()},getFile:function(t,e){var i=this;this.getBase64(t.raw).then((function(t){var e=null;e=i.hostUrl?function(){return i.$service.common[i.hostUrl]({content:t})}:function(){return i.$service.common.uploadImg({content:t})},e().then((function(t){console.log("subRes",t),i.onSuccess(t)}))}))},getBase64:function(t){return new Promise((function(e,i){var n=new FileReader,o="";n.readAsDataURL(t),n.onload=function(){o=n.result},n.onerror=function(t){i(t)},n.onloadend=function(){e(o)}}))}}},u=a,c=(i("f6cb"),i("5d22")),p=Object(c["a"])(u,n,o,!1,null,"27f252ef",null);e["default"]=p.exports},9690:function(t,e,i){},f6cb:function(t,e,i){"use strict";i("9690")}}]);