This commit is contained in:
caishi 2023-04-11 17:44:22 +08:00
commit b1fc81ba20
3 changed files with 23 additions and 3 deletions

View File

@ -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);

View File

@ -105,4 +105,7 @@
padding-bottom: 20px;
width: 100%;
display: inline-block;
}
.upload-file-repo.red .ant-upload{
border-color: red;
}

View File

@ -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 {
<p className="pb15 bor-bottom-greyE font-16 color-grey-3 mb20">
上传文件
</p>
<div className="upload-file-repo">
<div className={contentEmpty ? "upload-file-repo red" :"upload-file-repo"} style={{padding:"0px"}}>
<Upload
className="commentStyle"
isComplete={attachment_clean}
@ -75,6 +86,7 @@ class UploadFile extends Component {
{...this.props}
/>
</div>
<div style={{height:"20px",lineHeight:"5px"}}>{contentEmpty && <p className="color-red">请上传文件</p>}</div>
<div>
<UserSubmitComponent
{...this.props}
@ -85,6 +97,7 @@ class UploadFile extends Component {
editor_type={"upload"}
descName={`ADD file via upload`}
changeName={this.changeName}
checkContent={this.checkContent}
></UserSubmitComponent>
</div>
</div>