You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/public/react/dist/static/js/77.29c32754.chunk.js

1 line
108 KiB

5 years ago
(this.webpackJsonph5=this.webpackJsonph5||[]).push([[77,7,15],{2341:function(e,t,n){"use strict";n.r(t);var r=n(8),i=n(7),o=n(10),a=n(9),l=n(11),s=n(0),u=n.n(s),c=n(6),f=n.n(c),d=(n(560),n(561)),p=(n(131),n(39)),h=(n(170),n(18)),m=(n(103),n(47)),v=(n(500),n(501)),y=n(4),g=(n(472),n(471)),b=n(174),_=n(28),F=window.$,w=g.a.Option,O=function(e){function t(e){var n;return Object(r.a)(this,t),(n=Object(o.a)(this,Object(a.a)(t).call(this,e))).initValue=function(e){n.setState({teacherList:e.data.teacher_list,topic_property_first:e.data.topic_property_first,topic_property_second:e.data.topic_property_second,topic_repeat:e.data.topic_repeat,topic_source:e.data.topic_source,topic_type:e.data.topic_type,addonAfter:parseInt(e.data.selected_data.name.length)}),n.props.form.setFieldsValue({tea_id:e.data.selected_data.tea_id,name:e.data.selected_data.name,city:[e.data.selected_data.province,e.data.selected_data.city],topic_type:e.data.selected_data.topic_type||void 0,topic_source:e.data.selected_data.topic_source||void 0,topic_property_first:e.data.selected_data.topic_property_first||void 0,topic_property_second:e.data.selected_data.topic_property_second||void 0,source_unit:e.data.selected_data.source_unit,topic_repeat:e.data.selected_data.topic_repeat||void 0}),n.mdRef.current.setValue(e.data.selected_data.description);var t=e.data.attachments.map((function(e){return{id:e.id,uid:e.id,name:e.title,url:e.url,status:"done"}}));n.setState({fileList:t,cityDefaultValue:[e.data.selected_data.province,e.data.selected_data.city]})},n.initNewInfo=function(e){n.setState({teacherList:e.data.teacher_list,topic_property_first:e.data.topic_property_first,topic_property_second:e.data.topic_property_second,topic_repeat:e.data.topic_repeat,topic_source:e.data.topic_source,topic_type:e.data.topic_type}),n.props.form.setFieldsValue({tea_id:n.props.current_user&&n.props.current_user.user_id})},n.handleChange=function(e){if("done"===e.file.status||"uploading"===e.file.status){var t=e.fileList;n.setState({fileList:t})}},n.onAttachmentRemove=function(e){return n.props.confirm({content:"\u786e\u5b9a\u8981\u5220\u9664\u8fd9\u4e2a\u9644\u4ef6\u5417?",onOk:function(){n.deleteAttachment(e)},onCancel:function(){}}),!1},n.deleteAttachment=function(e){var t=null==e.response?e.id:e.response.id,r="/attachments/".concat(t,".json");f.a.delete(r).then((function(t){t.data&&0==t.data.status&&n.setState((function(t){var n=t.fileList.indexOf(e),r=t.fileList.slice();return r.splice(n,1),{fileList:r}}))})).catch((function(e){}))},n.changeTopicName=function(e){n.setState({addonAfter:e.target.value.length})},n.handleSubmit=function(e){e.preventDefault();var t=n.props.topicId;n.props.form.validateFieldsAndScroll((function(e,r){if(e)F("html").animate({scrollTop:F("html").scrollTop()-100});else if(null!=t){var i=void 0;n.state.fileList&&(i=n.state.fileList.map((function(e){return e.response?e.response.id:e.id})));var o=Object(y.a)({},r,{province:null==r.city?"":r.city[0],city:null==r.city?"":r.city[1]});n.props.editSave&&n.props.editSave(o,i,t)}else{var a=void 0;n.state.fileList&&(a=n.state.fileList.map((function(e){return e.response.id})));var l=Object(y.a)({},r,{province:null==r.city?"":r.city[0],city:null==r.city?"":r.city[1]});n.props.newSubmit&&n.props.newSubmit(l,a,t)}}))},n.mdRef=u.a.createRef(),n.state={fileList:[],teacherList:[],topic_property_first:[],topic_property_second:[],topic_repeat:[],topic_source:[],topic_type:[],addonAfter:0,cityDefaultValue:void 0},n}return Object(l.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){var e=this,t=this.state,n=t.fileList,r=t.teacherList,i=t.topic_property_first,o=t.topic_property_second,a=t.topic_repeat,l=t.topic_source,s=t.topic_type,c=t.addonAfter,f=t.cityDefaultValue,y=this.props.form.getFieldDecorator,F={width:600,fileList:n,multiple:!0,action:"".concat(Object(_.Q)()),onChange:this.handleChange,onRemove:this.onAttachmentRemove,beforeUpload:function(t){var n=t.size/1024/1024<150;if(!n)return e.props.define({title:"\u63d0\u793a",content:"\u8be5\u6587\u4ef6\u65e0\u6cd5\u4e0a\u4f20\u3002\u8d85\u8fc7\u6587\u4ef6\u5927\u5c0f\u96