{"version":3,"sources":["../../../src/components/Editor/Upload.js"],"names":["App","props","state","previewVisible","previewImage","loading","handleCancel","bind","handlePreview","handleChange","customRequest","handleCloseClick","onImgLoad","app","sOssSts","onRef","setState","file","url","thumbUrl","fileList","onChangeFileList","info","onProgress","percent","reader","FileReader","readAsDataURL","onloadend","UploadToOss","oss","DRIVER_LICENSE_PATH","then","onSuccess","data","onUpload","path","name","uid","catch","msg","e","message","ERROR_DEFAULT","showError","error","onError","response","index","newFileList","splice","maxUpload","multiple","uploadButton","intl","get","showPreviewIcon","showRemoveIcon","length","map","left","top","Math","floor","width","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;AACA;;;;AACA;;;;;;;;;;IAEMA,G;;;AACJ,eAAYC,KAAZ,EAAmB;AAAA;;AAAA,0GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,sBAAgB,KADL;AAEXC,oBAAc,EAFH;AAGXC,eAAS;AAHE,KAAb;AAKA,UAAKC,YAAL,GAAoB,MAAKA,YAAL,CAAkBC,IAAlB,OAApB;AACA,UAAKC,aAAL,GAAqB,MAAKA,aAAL,CAAmBD,IAAnB,OAArB;AACA,UAAKE,YAAL,GAAoB,MAAKA,YAAL,CAAkBF,IAAlB,OAApB;AACA,UAAKG,aAAL,GAAqB,MAAKA,aAAL,CAAmBH,IAAnB,OAArB;AACA,UAAKI,gBAAL,GAAwB,MAAKA,gBAAL,CAAsBJ,IAAtB,OAAxB;AACA,UAAKK,SAAL,GAAiB,MAAKA,SAAL,CAAeL,IAAf,OAAjB;AAZiB;AAalB;;;;wCAEmB;AAClB,WAAKN,KAAL,CAAWY,GAAX,CAAeC,OAAf;AACA,UAAI,KAAKb,KAAL,CAAWc,KAAf,EAAsB;AACpB,aAAKd,KAAL,CAAWc,KAAX,CAAiB,IAAjB;AACD;AACF;;;gCAEW;AACV,WAAKC,QAAL,CAAc;AACZX,iBAAS;AADG,OAAd;A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AAT,GAAc,GAAd,GAAoB,EAA7B,OADK;AAELa,mBAAQC,KAAKC,KAAL,CAAWf,QAAQ,CAAnB,IAAwB,GAAxB,GAA8B,EAAtC;AAFK;AAJT,YADF;AAWD,SAZA,CAbH;AA0BE;AAAA;AAAA;AACE,2BAAc,oBADhB;AAEE,qBAAS7C,cAFX;AAGE,oBAAQ,IAHV;AAIE,sBAAU,KAAKG;AAJjB;AAME;AAAA;AAAA,cAAM,UAAU,KAAKJ,KAAL,CAAWG,OAA3B;AACE;AACE,mBAAI,QADN;AAEE,qBAAO,EAAE2D,OAAO,MAAT,EAFT;AAGE,mBAAK5D,YAHP;AAIE,sBAAQ,KAAKQ,SAJf;AAKE,uBAAS,KAAKA;AALhB;AADF;AANF;AA1BF,OADF;AA6CD;;;;EApIeqD,gBAAMC,S;;kBAuIT,uBAAQlE,GAAR,C","file":"Upload.js","sourcesContent":["import React from \"react\";\nimport { Upload, Icon, Modal, message, Spin } from \"antd\";\nimport intl from \"react-intl-universal\";\nimport { DRIVER_LICENSE_PATH, ERROR_DEFAULT } from \"../../constant\";\nimport Comment from \"../../Comment\";\nimport \"./Upload.css\";\n\nclass App extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n previewVisible: false,\n previewImage: \"\",\n loading: false\n };\n this.handleCancel = this.handleCancel.bind(this);\n this.handlePreview = this.handlePreview.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.customRequest = this.customRequest.bind(this);\n this.handleCloseClick = this.handleCloseClick.bind(this);\n this.onImgLoad = this.onImgLoad.bind(this);\n }\n\n componentDidMount() {\n this.props.app.sOssSts();\n if (this.props.onRef) {\n this.props.onRef(this);\n }\n }\n\n onImgLoad() {\n this.setState({\n loading: false\n });\n }\n\n handleCancel() {\n this.setState({ previewVisible: false });\n }\n\n handlePreview(file) {\n this.setState({\n previewImage: file.url || file.thumbUrl,\n previewVisible: true\n });\n }\n\n handleChange({ fileList }) {\n this.props.onChangeFileList(fileList);\n }\n\n customRequest(info) {\n const { file } = info;\n info.onProgress({ percent: 10 });\n let reader = new FileReader();\n reader.readAsDataURL(info.file);\n reader.onloadend = () => {\n info.onProgress({ percent: 20 });\n // DRIVER_LICENSE_PATH oss 的存储路径位置\n this.props.app\n .UploadToOss(this.props.app.oss, DRIVER_LICENSE_PATH, file)\n .then(data => {\n info.onProgress({ percent: 100 });\n info.onSuccess(data);\n this.props.onUpload({ path: data.name, uid: file.uid });\n })\n .catch(e => {\n const msg = e.message || ERROR_DEFAULT;\n if (this.props.showError) {\n message.error(msg);\n }\n if (this.props.onError) {\n this.props.onError(msg, { response: e.response });\n }\n info.onError(e);\n });\n };\n }\n\n handleCloseClick(index) {\n let newFileList = this.props.fileList;\n newFileList.splice(index, 1);\n this.props.onChangeFileList(newFileList);\n }\n\n render() {\n const { previewVisible, previewImage } = this.state;\n const { fileList, maxUpload, multiple } = this.props;\n const uploadButton = (\n