1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
|
(this.webpackJsonp=this.webpackJsonp||[]).push([[83],{"2nZx":function(e,t,n){},AySf:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=p(n("CtXQ")),a=p(n("2/Rp")),r=p(n("8z0m")),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();n("2oDE"),n("L/Qf"),n("7W5+");var c=n("q1tI"),s=p(c),u=n("sYIF"),f=p(n("vDqi"));function p(e){return e&&e.__esModule?e:{default:e}}var d=r.default.Dragger,m=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.componentDidMount=function(){n.checkInitFile()},n.componentDidUpdate=function(e){e&&e.fileList!==n.props.fileList&&n.checkInitFile()},n.checkInitFile=function(){var e=n.props.fileList;e&&e.length>0&&n.setState({fileList:(0,u.appendFileSizeToUploadFileAll)(e)})},n.onAttachmentRemove=function(e){if(!e.percent||100===e.percent)return n.deleteAttachment(e),!1},n.deleteAttachment=function(e){var t="/attachments/"+(e.response?e.response.id:e.uid)+".json";f.default.delete(t,{}).then((function(t){t.data&&(0===t.data.status?(n.setState((function(t){var n=t.fileList.indexOf(e),o=t.fileList.slice();return o.splice(n,1),{fileList:o}})),n.fileIdList(n.state.fileList)):n.props.showNotification(t.data.message))})).catch((function(e){console.log(e)}))},n.handleChange=function(e){var t=n.props.changeIsComplete;t&&t(!0);var o=e.file;if(o&&!o.type&&!n.checkFile(o.name))return;if("uploading"===e.file.status||"done"===e.file.status||"removed"===e.file.status){var a=e.fileList;n.setState({fileList:(0,u.appendFileSizeToUploadFileAll)(a)}),n.fileIdList(a)}},n.fileIdList=function(e){var t=[];e&&e.length>0&&e.map((function(e){return t.push(e.response&&(e.response.id||e.response.data&&e.response.data.id))})),t&&n.props.load&&n.props.load(t)},n.checkFile=function(e){for(var t=[".rar",".iso",".flv",".rmvb",".mmf",".ape",".vsdx",".msi",".md"],n=!1,o=0;o<t.length;o++){if(n=new RegExp("(.+(?=["+t[o]+"]$))").test(e))return n}return!1},n.beforeUpload=function(e){if(e&&!e.type&&!n.checkFile(e.name))return void n.props.showNotification("暂不支持此格式文件的上传!");var t=n.props.size,o=e.size/1024/1024<t;return o||n.props.showNotification("文件大小必须小于"+t+"MB!"),o},n.state={fileList:void 0},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),l(t,[{key:"render",value:function(){var e=this.props,t=e.isComplete,n=e.icon,l=e.btn,c=e.className,f=e.size,p=e.actionUrl,m=this.state.fileList,v={name:"file",fileList:!0===t?m:void 0,action:p||""+(0,u.getUploadActionUrl)(),onChange:this.handleChange,onRemove:this.onAttachmentRemove,beforeUpload:this.beforeUpload};return l?s.default.createElement(r.default,i({},v,{className:c}),s.default.createElement(a.default,{type:"default"},"上传文件"),s.default.createElement("span",{className:"ml10 color-grey-9"},"(你可以上传小于",s.default.createElement("span",{className:"color-red"},f,"MB"),"的文件)")):s.default.createElement(d,i({},v,{className:c}),n||s.default.createElement(o.default,{type:"inbox"}),s.default.createElement("p",{className:"ant-upload-text font-16 color-grey-3"},"拖动文件或点击此处上传"))}}]),t}(c.Component);t.default=m},B3S4:function(e,t,n){"use strict";Object.definePropert
|