diff --git a/public/react/src/modules/moop_cases/CaseNew.js b/public/react/src/modules/moop_cases/CaseNew.js index 056733283..e855b5b71 100644 --- a/public/react/src/modules/moop_cases/CaseNew.js +++ b/public/react/src/modules/moop_cases/CaseNew.js @@ -40,6 +40,7 @@ class CaseNew extends Component{ imageUrl:undefined, loading: false, checkTag:false, + checkFile:false, coverID:undefined } } @@ -89,10 +90,12 @@ class CaseNew extends Component{ let contentFileList = info.fileList; this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList)}); let list = appendFileSizeToUploadFileAll(contentFileList); + let arr = list.map(item=>{ + return ( item.response && item.response.id ) + }) this.setState({ - filesID:list.map(item=>{ - return ( item.response && item.response.id ) - }) + filesID:arr, + checkFile:arr.length > 0 ? false : true }) console.log("fujian"); console.log(list.map(item=>{ @@ -165,7 +168,7 @@ class CaseNew extends Component{ let caseID = this.props.match.params.caseID; console.log(type); this.props.form.validateFieldsAndScroll((err, values) => { - let { casesTags } = this.state; + let { casesTags , filesID } = this.state; if(casesTags.length == 0){ $("html").animate({ scrollTop: $("#tagFormItem").offset().top - 100 }); this.setState({ @@ -173,6 +176,13 @@ class CaseNew extends Component{ }) return; } + if(filesID.length == 0){ + $("html").animate({ scrollTop: $("#fileFormItem").offset().top - 100 }); + this.setState({ + checkFile:true + }) + return; + } //const mdContnet = this.DescMdRef.current.getValue().trim(); console.log(values); let url = caseID ? `/libraries/${caseID}.json`: `/libraries.json`; @@ -235,7 +245,7 @@ class CaseNew extends Component{ render(){ let { caseID } = this.props.match.params; let { CaseDetail } = this.props; - let { casesTags , contentFileList , imageUrl , checkTag } = this.state; + let { casesTags , contentFileList , imageUrl , checkTag , checkFile } = this.state; const {getFieldDecorator} = this.props.form; @@ -363,11 +373,14 @@ class CaseNew extends Component{ watch={true} className="caseMessageMD" initValue={CaseDetail && CaseDetail.content}> )} -
上传附件
从我的电脑选择要上传的文档:按住CTRL可以上传多份文档。单个文件最大限制:150MB
封面图(上传尺寸:120*90 px)