dev_new_shixunsrepository
杨树明 5 years ago
parent e49ad4f2d6
commit d191f0b817

@ -29,17 +29,19 @@ class RepositoryAddFileupload_files extends Component {
}
handleChange = (info) => {
if (info.file.status === 'done') {
console.log(info)
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,
})
return
if(info.file.response){
if(info.file.response.status===-1) {
notification.open({
message: '提示',
description: info.file.response.message,
})
return
}
}
fileList = fileList.slice(-2);
@ -74,9 +76,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
}})
@ -247,7 +257,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 +288,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>
)
}

@ -85,21 +85,20 @@ class Repositoryfile extends Component{
})
if(paths===""&&type==="tree"){
newpath=newpath+"/";
newpath=newpath;
paths="";
if(main.length===0){
ary.push({val:"根目录/",path:""},{val:newpath,path:paths+newpath})
ary.push({val:"根目录",path:""},{val:"/"+newpath,path:paths+newpath});
}else{
ary.push({val:newpath,path:paths+newpath})
ary.push({val:"/"+newpath,path:paths+newpath});
}
}else if(paths!=""&&type==="tree"){
newpath=newpath+"/";
ary.push({val:newpath,path:paths+newpath})
newpath=paths+"/"+newpath;
ary.push({val:"/"+newpath,path:paths+newpath});
}
axios.post(url,{
path: paths+newpath
path: newpath
}).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
@ -138,7 +137,7 @@ class Repositoryfile extends Component{
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
console.log('Received values of form: ', values);
let paths=path+values.name;
let paths=path+"/"+values.name;
axios.post(url,{
path: paths,
secret_repository:flag===false?undefined:flag,

Loading…
Cancel
Save