|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import { Form , Upload , Input , notification, message } from 'antd';
|
|
|
|
|
import { Form , Upload , Input} from 'antd';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import { getupload_git_file } from 'educoder';
|
|
|
|
|
import Repositoryfile from './Repositoryfile';
|
|
|
|
@ -29,26 +29,29 @@ class RepositoryAddFileupload_files extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleChange = (info) => {
|
|
|
|
|
console.log(info)
|
|
|
|
|
|
|
|
|
|
if (info.file.status === 'done') {
|
|
|
|
|
if (info.file.status === 'done'||info.file.status === "uploading") {
|
|
|
|
|
|
|
|
|
|
let fileList = [...info.fileList];
|
|
|
|
|
|
|
|
|
|
if(info.file.response.status===-1){
|
|
|
|
|
notification.open({
|
|
|
|
|
message: '提示',
|
|
|
|
|
description:info.file.response.message,
|
|
|
|
|
})
|
|
|
|
|
if(info.file.response){
|
|
|
|
|
if(info.file.response.status===-1) {
|
|
|
|
|
this.props.showNotification(info.file.response.message)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fileList = fileList.slice(-2);
|
|
|
|
|
fileList = fileList.map(file => {
|
|
|
|
|
if (file.response) {
|
|
|
|
|
file.url = file.response.url;
|
|
|
|
|
if (file.response.status===0) {
|
|
|
|
|
this.props.showNotification("上传成功")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return file;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.setState({ fileList });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -57,10 +60,7 @@ class RepositoryAddFileupload_files extends Component {
|
|
|
|
|
let shixunId = this.props.match.params.shixunId;
|
|
|
|
|
let {message,filspath}=this.state;
|
|
|
|
|
if(message===""||message===undefined){
|
|
|
|
|
notification.open({
|
|
|
|
|
message: '提示',
|
|
|
|
|
description: '删除文件请先填写提交信息',
|
|
|
|
|
});
|
|
|
|
|
this.props.showNotification('删除文件请先填写提交信息');
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -74,9 +74,17 @@ class RepositoryAddFileupload_files extends Component {
|
|
|
|
|
if(matchpath.indexOf("secret_repository")>-1){
|
|
|
|
|
Repositoryflag =true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let newfilspath=filspath;
|
|
|
|
|
|
|
|
|
|
if(newfilspath===""){
|
|
|
|
|
newfilspath=info.name
|
|
|
|
|
}else{
|
|
|
|
|
newfilspath=filspath+"/"+info.name
|
|
|
|
|
}
|
|
|
|
|
const url = `/shixuns//${shixunId}/delete_git_file.json`;
|
|
|
|
|
axios.delete(url, { data: {
|
|
|
|
|
path:filspath+info.name,
|
|
|
|
|
path:newfilspath,
|
|
|
|
|
message:message,
|
|
|
|
|
secret_repository:Repositoryflag
|
|
|
|
|
}})
|
|
|
|
@ -167,10 +175,7 @@ class RepositoryAddFileupload_files extends Component {
|
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
|
let {message}=this.state;
|
|
|
|
|
if(message===""||message===undefined){
|
|
|
|
|
notification.open({
|
|
|
|
|
message: '提示',
|
|
|
|
|
description: '上传文件请先填写提交信息',
|
|
|
|
|
});
|
|
|
|
|
this.props.showNotification("上传文件请先填写提交信息")
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -247,7 +252,7 @@ class RepositoryAddFileupload_files extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p className="ant-form-item-label">
|
|
|
|
|
<div className={"color888 font-16"}>当前目录:{this.state.filspath===""?"./":this.state.filspath} <span className={"color-blue"} onClick={this.Selectfiledirectory}>选择文件目录</span></div>
|
|
|
|
|
<div className={"color888 font-16"}>当前目录:{this.state.filspath===""?"/":"/"+this.state.filspath} <span className={"color-blue"} onClick={this.Selectfiledirectory}>选择文件目录</span></div>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
{/*<div className="mt10 mb25 repoCMWrapper filecode">*/}
|
|
|
|
@ -278,7 +283,7 @@ class RepositoryAddFileupload_files extends Component {
|
|
|
|
|
</div>
|
|
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/${Repositoryflag}`}/>
|
|
|
|
|
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/${Repositoryflag}`} bottomvalue={"确定"}/>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|