1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-fd9ad2ee","chunk-2fbef56b","chunk-2d21b4e6"],{"2d5d":function(t,e,r){"use strict";r.r(e),r.d(e,"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"),o=r("bee2"),i=function(){function t(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1920;Object(n["a"])(this,t),this.file=e,this.fileSize=r,this.maxWH=o}return Object(o["a"])(t,[{key:"compress",value:function(){var t=this,e=this.file.type,r=this.file.size/1024;return new Promise((function(n){var o=new FileReader;o.readAsDataURL(t.file),o.onload=function(){var i=document.createElement("canvas"),a=document.createElement("img");a.src=o.result,a.onload=function(){var o=i.getContext("2d"),c=t.dWH(a.width,a.height,t.maxWH);i.width=c.width,i.height=c.height,o.clearRect(0,0,i.width,i.height),o.drawImage(a,0,0,i.width,i.height);var u=i.toDataURL(e,.9),f=t.fileSizeKB(u);f>t.fileSize&&console.log("图片尺寸太大!"+r+" >> "+f);var s=t.dataURLtoBlob(u,e),d=new File([s],t.file.name);n(d)}}}))}},{key:"dWH",value:function(t,e,r){var n={width:t,height:e};return Math.max(t,e)>r?t>e?(n.width=r,n.height=Math.round(e*(r/t)),n):(n.height=r,n.width=Math.round(t*(r/e)),n):n}},{key:"fileSizeKB",value:function(t){var e=0;return e=Math.round(3*t.split(",")[1].length/4/1024),e}},{key:"dataURLtoBlob",value:function(t,e){for(var r=atob(t.split(",")[1]),n=t.split(",")[0].split(":")[1].split(";")[0],o=new ArrayBuffer(r.length),i=new Uint8Array(o),a=0;a<r.length;a++)i[a]=r.charCodeAt(a);return e&&(n=e),new Blob([o],{type:n,lastModifiedDate:new Date})}}]),t}()},"3bbe":function(t,e,r){var n=r("861d");t.exports=function(t){if(!n(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},"3f8c":function(t,e){t.exports={}},"44d2":function(t,e,r){var n=r("b622"),o=r("7c73"),i=r("9bf2"),a=n("unscopables"),c=Array.prototype;void 0==c[a]&&i.f(c,a,{configurable:!0,value:o(null)}),t.exports=function(t){c[a][t]=!0}},"7dd0":function(t,e,r){"use strict";var n=r("23e7"),o=r("9ed3"),i=r("e163"),a=r("d2bb"),c=r("d44e"),u=r("9112"),f=r("6eeb"),s=r("b622"),d=r("c430"),l=r("3f8c"),p=r("ae93"),h=p.IteratorPrototype,b=p.BUGGY_SAFARI_ITERATORS,y=s("iterator"),v="keys",w="values",g="entries",A=function(){return this};t.exports=function(t,e,r,s,p,O,x){o(r,e,s);var k,_,m,R=function(t){if(t===p&&S)return S;if(!b&&t in B)return B[t];switch(t){case v:return function(){return new r(this,t)};case w:return function(){return new r(this,t)};case g:return function(){return new r(this,t)}}return function(){return new r(this)}},j=e+" Iterator",I=!1,B=t.prototype,P=B[y]||B["@@iterator"]||p&&B[p],S=!b&&P||R(p),E="Array"==e&&B.entries||P;if(E&&(k=i(E.call(new t)),h!==Object.prototype&&k.next&&(d||i(k)===h||(a?a(k,h):"function"!=typeof k[y]&&u(k,y,A)),c(k,j,!0,!0),d&&(l[j]=A))),p==w&&P&&P.name!==w&&(I=!0,S=function(){return P.call(this)}),d&&!x||B[y]===S||u(B,y,S),l[e]=S,p)if(_={values:R(w),keys:O?S:R(v),entries:R(g)},x)for(m in _)(b||I||!(m in B))&&f(B,m,_[m]);else n({target:e,proto:!0,forced:b||I},_);return _}},"9ed3":function(t,e,r){"use strict";var n=r("ae93").IteratorPrototype,o=r("7c73"),i=r("5c6c"),a=r("d44e"),c=r("3f8c"),u=function(){return this};t.exports=function(t,e,r){var f=e+" Iterator";return t.prototype=o(n,{next:i(1,r)}),a(t,f,!1,!0),c[f]=u,t}},ae93:function(t,e,r){"use strict";var n,o,i,a=r("e163"),c=r("9112"),u=r("5135"),f=r("b622"),s=r("c430"),d=f("iterator"),l=!1,p=function(){return this};[].keys&&(i=[].keys(),"next"in i?(o=a(a(i)),o!==Object.prototype&&(n=o)):l=!0),void 0==n&&(n={}),s||u(n,d)||c(n,d,p),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:l}},bee2:function(t,e,r){"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}r.d(e,"a",(function(){return o}))},c19f:function(t,e,r){"use strict";var n=r("23e7"),o=r("da84"),i=r("621a"),a=r("2626"),c="ArrayBuffer",u=i[c],f=o[c];n({global:!0,forced:f!==u},{ArrayBuffer:u}),a(c)},d2bb:function(t,e,r){var n=r("825a"),o=r("3bbe");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,t.call(r,[]),e=r instanceof Array}catch(i){}return function(r,i){return n(r),o(i),e?t.call(r,i):r.__proto__=i,r}}():void 0)},d4ec:function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",(function(){return n}))},e163:function(t,e,r){var n=r("5135"),o=r("7b0b"),i=r("f772"),a=r("e177"),c=i("IE_PROTO"),u=Object.prototype;t.exports=a?Object.getPrototypeOf:function(t){return t=o(t),n(t,c)?t[c]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},e177:function(t,e,r){var n=r("d039");t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},e260:function(t,e,r){"use strict";var n=r("fc6a"),o=r("44d2"),i=r("3f8c"),a=r("69f3"),c=r("7dd0"),u="Array Iterator",f=a.set,s=a.getterFor(u);t.exports=c(Array,"Array",(function(t,e){f(this,{type:u,target:n(t),index:0,kind:e})}),(function(){var t=s(this),e=t.target,r=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")}}]);
|