|
|
|
@ -27,35 +27,42 @@ class Fileslistitem extends Component{
|
|
|
|
|
this.props.Settingtypes(discussMessage.id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showfiles=(value)=>{
|
|
|
|
|
let {discussMessage,coursesId}=this.props
|
|
|
|
|
let file_id=discussMessage.id
|
|
|
|
|
let url="/files/"+file_id+"/histories.json"
|
|
|
|
|
axios.get(url,{
|
|
|
|
|
params:{
|
|
|
|
|
course_id:coursesId
|
|
|
|
|
},
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
|
|
|
|
|
if(result.data.attachment_histories.length===0){
|
|
|
|
|
// if(result.data.is_pdf===true){
|
|
|
|
|
// this.props.ShowOnlinePdf(result.data.url)
|
|
|
|
|
// //预览pdf
|
|
|
|
|
// }else{
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
this.props.DownloadFileA(result.data.title,result.data.url)
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
Showoldfiles:true,
|
|
|
|
|
allfiles:result.data
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
showfiles=(list)=>{
|
|
|
|
|
if(list.is_history_file===false){
|
|
|
|
|
// this.props.DownloadFileA(list.title,list.url)
|
|
|
|
|
window.location.href=list.url;
|
|
|
|
|
}else{
|
|
|
|
|
let {discussMessage,coursesId}=this.props
|
|
|
|
|
let file_id=discussMessage.id
|
|
|
|
|
let url="/files/"+file_id+"/histories.json"
|
|
|
|
|
axios.get(url,{
|
|
|
|
|
params:{
|
|
|
|
|
course_id:coursesId
|
|
|
|
|
},
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
|
|
|
|
|
if(result.data.attachment_histories.length===0){
|
|
|
|
|
// if(result.data.is_pdf===true){
|
|
|
|
|
// this.props.ShowOnlinePdf(result.data.url)
|
|
|
|
|
// //预览pdf
|
|
|
|
|
// }else{
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// this.props.DownloadFileA(result.data.title,result.data.url)
|
|
|
|
|
window.location.href=list.url;
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
Showoldfiles:true,
|
|
|
|
|
allfiles:result.data
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closaoldfilesprops=()=>{
|
|
|
|
@ -191,13 +198,13 @@ class Fileslistitem extends Component{
|
|
|
|
|
{
|
|
|
|
|
this.props.isAdmin ? <a
|
|
|
|
|
// href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"}
|
|
|
|
|
onClick={()=>this.showfiles(discussMessage.title)}
|
|
|
|
|
onClick={()=>this.showfiles(discussMessage)}
|
|
|
|
|
title={discussMessage.title}
|
|
|
|
|
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> : ""
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
this.props.isStudent? <a
|
|
|
|
|
onClick={()=>this.showfiles(discussMessage.title)}
|
|
|
|
|
onClick={()=>this.showfiles(discussMessage)}
|
|
|
|
|
title={discussMessage.title}
|
|
|
|
|
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> :""
|
|
|
|
|
}
|
|
|
|
@ -207,7 +214,7 @@ class Fileslistitem extends Component{
|
|
|
|
|
discussMessage.is_lock === true ?
|
|
|
|
|
<span className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</span>
|
|
|
|
|
:<a
|
|
|
|
|
onClick={()=>this.showfiles(discussMessage.title)}
|
|
|
|
|
onClick={()=>this.showfiles(discussMessage)}
|
|
|
|
|
title={discussMessage.title}
|
|
|
|
|
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>:""
|
|
|
|
|
}
|
|
|
|
|