diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js index 307d3d449..dc7b945a4 100644 --- a/src/forge/Newfile/UserSubmitComponent.js +++ b/src/forge/Newfile/UserSubmitComponent.js @@ -69,9 +69,13 @@ class UserSubmitComponent extends Component { // 提交变更 subMitFrom = () => { - const { filepath, content, editor_type , checkName , onEmpty} = this.props; + const { filepath, content, editor_type , checkName , onEmpty , checkContent} = this.props; const { branch, projectsId , owner } = this.props.match.params; const { submitType, filename , empty } = this.state; + if(editor_type==="upload" && checkContent && !content){ + checkContent(true); + return; + } if(!filename || empty){ onEmpty ? onEmpty(true) : this.onEmpty(true); onEmpty && window.scrollTo(0,0); diff --git a/src/forge/Newfile/index.css b/src/forge/Newfile/index.css index 60156a348..001d08ed1 100644 --- a/src/forge/Newfile/index.css +++ b/src/forge/Newfile/index.css @@ -105,4 +105,7 @@ padding-bottom: 20px; width: 100%; display: inline-block; +} +.upload-file-repo.red .ant-upload{ + border-color: red; } \ No newline at end of file diff --git a/src/forge/Newfile/upload_file.js b/src/forge/Newfile/upload_file.js index e95f7cbb1..a7e9d43c2 100644 --- a/src/forge/Newfile/upload_file.js +++ b/src/forge/Newfile/upload_file.js @@ -12,6 +12,7 @@ class UploadFile extends Component { filename: "", fileList: undefined, attachment_clean: true, + contentEmpty:false }; } @@ -37,9 +38,19 @@ class UploadFile extends Component { this.setState({ filename: fileList.fileName, editorValue: fileList.fileContent, + contentEmpty:fileList.fileContent?false:true }); }; + checkContent=(flag)=>{ + this.setState({ + contentEmpty:flag + }) + if(flag){ + window.scrollTo(0,120); + } + } + changeName=(value)=>{ this.setState({ filename:value @@ -48,7 +59,7 @@ class UploadFile extends Component { render() { const { pathname } = this.props.location; - const { filename, editorValue, attachment_clean } = this.state; + const { filename, editorValue, attachment_clean , contentEmpty } = this.state; const urlroot = pathname.split("uploadfile/")[1]; const file_path = urlroot ? `/${urlroot}/` :"/"; return ( @@ -57,7 +68,7 @@ class UploadFile extends Component {
上传文件
-请上传文件
}