1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4307bb30","chunk-fd9ad2ee","chunk-2fbef56b","chunk-2d21b4e6"],{1490:function(e,t,r){"use strict";var n=r("382f"),a=r.n(n);a.a},"2d5d":function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));r("c19f"),r("ace4"),r("b0c0"),r("d3b7"),r("ac1f"),r("1276"),r("5cc6"),r("9a8c"),r("a975"),r("735e"),r("c1ac"),r("d139"),r("3a7b"),r("d5d6"),r("82f8"),r("e91f"),r("60bd"),r("5f96"),r("3280"),r("3fcc"),r("ca91"),r("25a1"),r("cd26"),r("3c5d"),r("2954"),r("649e"),r("219c"),r("170b"),r("b39a"),r("72f7");var n=r("d4ec"),a=r("bee2"),i=function(){function e(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1920;Object(n["a"])(this,e),this.file=t,this.fileSize=r,this.maxWH=a}return Object(a["a"])(e,[{key:"compress",value:function(){var e=this,t=this.file.type,r=this.file.size/1024;return new Promise((function(n){var a=new FileReader;a.readAsDataURL(e.file),a.onload=function(){var i=document.createElement("canvas"),o=document.createElement("img");o.src=a.result,o.onload=function(){var a=i.getContext("2d"),c=e.dWH(o.width,o.height,e.maxWH);i.width=c.width,i.height=c.height,a.clearRect(0,0,i.width,i.height),a.drawImage(o,0,0,i.width,i.height);var u=i.toDataURL(t,.9),s=e.fileSizeKB(u);s>e.fileSize&&console.log("图片尺寸太大!"+r+" >> "+s);var f=e.dataURLtoBlob(u,t),l=new File([f],e.file.name);n(l)}}}))}},{key:"dWH",value:function(e,t,r){var n={width:e,height:t};return Math.max(e,t)>r?e>t?(n.width=r,n.height=Math.round(t*(r/e)),n):(n.height=r,n.width=Math.round(e*(r/t)),n):n}},{key:"fileSizeKB",value:function(e){var t=0;return t=Math.round(3*e.split(",")[1].length/4/1024),t}},{key:"dataURLtoBlob",value:function(e,t){for(var r=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],a=new ArrayBuffer(r.length),i=new Uint8Array(a),o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return t&&(n=t),new Blob([a],{type:n,lastModifiedDate:new Date})}}]),e}()},"382f":function(e,t,r){},"3bbe":function(e,t,r){var n=r("861d");e.exports=function(e){if(!n(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},"3f8c":function(e,t){e.exports={}},"44d2":function(e,t,r){var n=r("b622"),a=r("7c73"),i=r("9bf2"),o=n("unscopables"),c=Array.prototype;void 0==c[o]&&i.f(c,o,{configurable:!0,value:a(null)}),e.exports=function(e){c[o][e]=!0}},5899:function(e,t){e.exports="\t\n\v\f\r \u2028\u2029\ufeff"},"58a8":function(e,t,r){var n=r("1d80"),a=r("5899"),i="["+a+"]",o=RegExp("^"+i+i+"*"),c=RegExp(i+i+"*$"),u=function(e){return function(t){var r=String(n(t));return 1&e&&(r=r.replace(o,"")),2&e&&(r=r.replace(c,"")),r}};e.exports={start:u(1),end:u(2),trim:u(3)}},"5e11":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"upload-container"},[r("el-upload",{staticClass:"image-uploader",attrs:{action:e.path+"/fileUploadAndDownload/upload",headers:{"x-token":e.token},multiple:!1,"show-file-list":!1,drag:"img"==e.type,"on-success":e.handleImageSuccess,"before-upload":e.beforeImageUpload}},["img"==e.type?r("i",{staticClass:"el-icon-upload"}):e._e(),"img"==e.type?r("div",{staticClass:"el-upload__text"},[e.placeholder?r("span",[r("em",[e._v(e._s(e.placeholder))])]):r("span",[e._v(" 拖动或"),r("em",[e._v("点击上传")])])]):r("el-button",{attrs:{size:"small",type:e.type}},[e._v(" "+e._s(e.placeholder))]),"img"==e.type?r("div",{directives:[{name:"show",rawName:"v-show",value:e.imageUrl.length>1,expression:"imageUrl.length>1"}],staticClass:"image-preview"},[r("div",{staticClass:"image-preview-wrapper"},[r("img",{attrs:{src:e.imageUrl,alt:""}}),r("div",{staticClass:"image-preview-action"},[r("i",{staticClass:"el-icon-upload"})])])]):e._e()],1)],1)},a=[],i=(r("a9e3"),r("5530")),o=r("5880"),c=r("2d5d"),u="/api",s={name:"upload-image",model:{prop:"imageUrl",event:"change"},props:{imageUrl:{type:String,default:""},type:{type:String,default:"img"},placeholder:{type:String,default:""},fileSize:{type:Number,default:2048},maxWH:{type:Number,default:1920}},data:function(){return{path:u}},computed:Object(i["a"])({},Object(o["mapGetters"])("user",["userInfo","token"])),methods:{beforeImageUpload:function(e){var t=e.size/1024<this.fileSize;if(!t){var r=new c["default"](e,this.fileSize,this.maxWH);return r.compress()}return t},rmImage:function(){this.$emit("rmImage")},handleImageSuccess:function(e){var t=e.data;t.file&&this.$emit("change",t.file.url)}}},f=s,l=(r("1490"),r("2877")),d=Object(l["a"])(f,n,a,!1,null,"bdd76c28",null);t["default"]=d.exports},"7dd0":function(e,t,r){"use strict";var n=r("23e7"),a=r("9ed3"),i=r("e163"),o=r("d2bb"),c=r("d44e"),u=r("9112"),s=r("6eeb"),f=r("b622"),l=r("c430"),d=r("3f8c"),p=r("ae93"),h=p.IteratorPrototype,v=p.BUGGY_SAFARI_ITERATORS,g=f("iterator"),b="keys",y="values",m="entries",w=function(){return this};e.exports=function(e,t,r,f,p,I,_){a(r,t,f);var A,x,O,k=function(e){if(e===p&&U)return U;if(!v&&e in N)return N[e];switch(e){case b:return function(){return new r(this,e)};case y:return function(){return new r(this,e)};case m:return function(){return new r(this,e)}}return function(){return new r(this)}},S=t+" Iterator",E=!1,N=e.prototype,R=N[g]||N["@@iterator"]||p&&N[p],U=!v&&R||k(p),C="Array"==t&&N.entries||R;if(C&&(A=i(C.call(new e)),h!==Object.prototype&&A.next&&(l||i(A)===h||(o?o(A,h):"function"!=typeof A[g]&&u(A,g,w)),c(A,S,!0,!0),l&&(d[S]=w))),p==y&&R&&R.name!==y&&(E=!0,U=function(){return R.call(this)}),l&&!_||N[g]===U||u(N,g,U),d[t]=U,p)if(x={values:k(y),keys:I?U:k(b),entries:k(m)},_)for(O in x)(v||E||!(O in N))&&s(N,O,x[O]);else n({target:t,proto:!0,forced:v||E},x);return x}},"9ed3":function(e,t,r){"use strict";var n=r("ae93").IteratorPrototype,a=r("7c73"),i=r("5c6c"),o=r("d44e"),c=r("3f8c"),u=function(){return this};e.exports=function(e,t,r){var s=t+" Iterator";return e.prototype=a(n,{next:i(1,r)}),o(e,s,!1,!0),c[s]=u,e}},a9e3:function(e,t,r){"use strict";var n=r("83ab"),a=r("da84"),i=r("94ca"),o=r("6eeb"),c=r("5135"),u=r("c6b6"),s=r("7156"),f=r("c04e"),l=r("d039"),d=r("7c73"),p=r("241c").f,h=r("06cf").f,v=r("9bf2").f,g=r("58a8").trim,b="Number",y=a[b],m=y.prototype,w=u(d(m))==b,I=function(e){var t,r,n,a,i,o,c,u,s=f(e,!1);if("string"==typeof s&&s.length>2)if(s=g(s),t=s.charCodeAt(0),43===t||45===t){if(r=s.charCodeAt(2),88===r||120===r)return NaN}else if(48===t){switch(s.charCodeAt(1)){case 66:case 98:n=2,a=49;break;case 79:case 111:n=8,a=55;break;default:return+s}for(i=s.slice(2),o=i.length,c=0;c<o;c++)if(u=i.charCodeAt(c),u<48||u>a)return NaN;return parseInt(i,n)}return+s};if(i(b,!y(" 0o1")||!y("0b1")||y("+0x1"))){for(var _,A=function(e){var t=arguments.length<1?0:e,r=this;return r instanceof A&&(w?l((function(){m.valueOf.call(r)})):u(r)!=b)?s(new y(I(t)),r,A):I(t)},x=n?p(y):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),O=0;x.length>O;O++)c(y,_=x[O])&&!c(A,_)&&v(A,_,h(y,_));A.prototype=m,m.constructor=A,o(a,b,A)}},ae93:function(e,t,r){"use strict";var n,a,i,o=r("e163"),c=r("9112"),u=r("5135"),s=r("b622"),f=r("c430"),l=s("iterator"),d=!1,p=function(){return this};[].keys&&(i=[].keys(),"next"in i?(a=o(o(i)),a!==Object.prototype&&(n=a)):d=!0),void 0==n&&(n={}),f||u(n,l)||c(n,l,p),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},bee2:function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}r.d(t,"a",(function(){return a}))},c19f:function(e,t,r){"use strict";var n=r("23e7"),a=r("da84"),i=r("621a"),o=r("2626"),c="ArrayBuffer",u=i[c],s=a[c];n({global:!0,forced:s!==u},{ArrayBuffer:u}),o(c)},d2bb:function(e,t,r){var n=r("825a"),a=r("3bbe");e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,e.call(r,[]),t=r instanceof Array}catch(i){}return function(r,i){return n(r),a(i),t?e.call(r,i):r.__proto__=i,r}}():void 0)},d4ec:function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.d(t,"a",(function(){return n}))},e163:function(e,t,r){var n=r("5135"),a=r("7b0b"),i=r("f772"),o=r("e177"),c=i("IE_PROTO"),u=Object.prototype;e.exports=o?Object.getPrototypeOf:function(e){return e=a(e),n(e,c)?e[c]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?u:null}},e177:function(e,t,r){var n=r("d039");e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},e260:function(e,t,r){"use strict";var n=r("fc6a"),a=r("44d2"),i=r("3f8c"),o=r("69f3"),c=r("7dd0"),u="Array Iterator",s=o.set,f=o.getterFor(u);e.exports=c(Array,"Array",(function(e,t){s(this,{type:u,target:n(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),i.Arguments=i.Array,a("keys"),a("values"),a("entries")}}]);
|