From eb664330b2947de1c40721edbbefb70732213c9a Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 11 Apr 2023 17:43:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6-=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Newfile/UserSubmitComponent.js | 6 +++++- src/forge/Newfile/index.css | 3 +++ src/forge/Newfile/upload_file.js | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) 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 {
上传文件
-请上传文件
}