案例文档必须上传

dev_hjm
caishi 6 years ago
parent f811769bf6
commit 39777f17ad

@ -40,6 +40,7 @@ class CaseNew extends Component{
imageUrl:undefined, imageUrl:undefined,
loading: false, loading: false,
checkTag:false, checkTag:false,
checkFile:false,
coverID:undefined coverID:undefined
} }
} }
@ -89,10 +90,12 @@ class CaseNew extends Component{
let contentFileList = info.fileList; let contentFileList = info.fileList;
this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList)}); this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList)});
let list = appendFileSizeToUploadFileAll(contentFileList); let list = appendFileSizeToUploadFileAll(contentFileList);
this.setState({ let arr = list.map(item=>{
filesID:list.map(item=>{
return ( item.response && item.response.id ) return ( item.response && item.response.id )
}) })
this.setState({
filesID:arr,
checkFile:arr.length > 0 ? false : true
}) })
console.log("fujian"); console.log("fujian");
console.log(list.map(item=>{ console.log(list.map(item=>{
@ -165,7 +168,7 @@ class CaseNew extends Component{
let caseID = this.props.match.params.caseID; let caseID = this.props.match.params.caseID;
console.log(type); console.log(type);
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
let { casesTags } = this.state; let { casesTags , filesID } = this.state;
if(casesTags.length == 0){ if(casesTags.length == 0){
$("html").animate({ scrollTop: $("#tagFormItem").offset().top - 100 }); $("html").animate({ scrollTop: $("#tagFormItem").offset().top - 100 });
this.setState({ this.setState({
@ -173,6 +176,13 @@ class CaseNew extends Component{
}) })
return; return;
} }
if(filesID.length == 0){
$("html").animate({ scrollTop: $("#fileFormItem").offset().top - 100 });
this.setState({
checkFile:true
})
return;
}
//const mdContnet = this.DescMdRef.current.getValue().trim(); //const mdContnet = this.DescMdRef.current.getValue().trim();
console.log(values); console.log(values);
let url = caseID ? `/libraries/${caseID}.json`: `/libraries.json`; let url = caseID ? `/libraries/${caseID}.json`: `/libraries.json`;
@ -235,7 +245,7 @@ class CaseNew extends Component{
render(){ render(){
let { caseID } = this.props.match.params; let { caseID } = this.props.match.params;
let { CaseDetail } = this.props; let { CaseDetail } = this.props;
let { casesTags , contentFileList , imageUrl , checkTag } = this.state; let { casesTags , contentFileList , imageUrl , checkTag , checkFile } = this.state;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
@ -363,11 +373,14 @@ class CaseNew extends Component{
watch={true} className="caseMessageMD" initValue={CaseDetail && CaseDetail.content}></TPMMDEditor> watch={true} className="caseMessageMD" initValue={CaseDetail && CaseDetail.content}></TPMMDEditor>
)} )}
</Form.Item> </Form.Item>
<div style={{marginLeft:"76px"}}> <div className={checkFile == true ? "clearfix mb20 pr has-error" : "clearfix mb20"} id="fileFormItem" style={{marginLeft:"76px"}}>
<Dragger {...uploadProps} className="librariesField upload_1"> <Dragger {...uploadProps} className="librariesField upload_1">
<p className="ant-upload-text color-blue font-18 mb20">上传附件</p> <p className="ant-upload-text color-blue font-18 mb20">上传附件</p>
<p className="ant-upload-text color-grey-c">从我的电脑选择要上传的文档按住CTRL可以上传多份文档单个文件最大限制150MB</p> <p className="ant-upload-text color-grey-c">从我的电脑选择要上传的文档按住CTRL可以上传多份文档单个文件最大限制150MB</p>
</Dragger> </Dragger>
{
checkFile && <div style={{left:"0px",bottom:"-21px"}} class="ant-form-explain">请先上传附件</div>
}
</div> </div>
<p className="lineh-25 mt20 mb10 clearfix"> <p className="lineh-25 mt20 mb10 clearfix">
<span className="upload_Title" style={{marginRight:"12px"}}>封面图</span><span class="color-grey-c fl lineh-35">120*90 px</span> <span className="upload_Title" style={{marginRight:"12px"}}>封面图</span><span class="color-grey-c fl lineh-35">120*90 px</span>

Loading…
Cancel
Save