dev_new_shixunsrepository
杨树林 5 years ago
commit bbdf9a8f52

@ -37,18 +37,9 @@ class Listjihe extends Component {
//选用 //选用
Selectingpracticaltraining=(id)=>{ Selectingpracticaltraining=(id)=>{
let data={} let data={
if(this.props.exam_id===undefined){ item_ids:[id]
data={ }
item_ids:[id]
}
}else{
data={
item_ids:[id],
exam_id:this.props.exam_id
}
}
this.props.getitem_baskets(data); this.props.getitem_baskets(data);
} }
//撤销 //撤销
@ -193,8 +184,8 @@ class Listjihe extends Component {
{ {
items.choosed===true? items.choosed===true?
<p className="selectionss xiaoshou" onClick={()=>this.Selectingpracticaltrainings(items.id)}> <p className="selectionss xiaoshou" onClick={()=>this.Selectingpracticaltrainings(items.id)}>
<i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr5"></i> <i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span className="mr15 lh30">撤销</span></p> <span>撤销</span></p>
: :
items.item_type==="PROGRAM"? items.item_type==="PROGRAM"?
items.program_attr.status===0? items.program_attr.status===0?

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

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

Loading…
Cancel
Save