dev_forum
杨树明 5 years ago
parent b3cdc99433
commit 38fd3e6db2

@ -26,8 +26,8 @@ class Fileslistitem extends Component{
}) })
this.props.Settingtypes(discussMessage.id) this.props.Settingtypes(discussMessage.id)
} }
showfiles=()=>{ showfiles=(value)=>{
debugger
let {discussMessage,coursesId}=this.props let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id let file_id=discussMessage.id
let url="/files/"+file_id+"/histories.json" let url="/files/"+file_id+"/histories.json"
@ -42,10 +42,8 @@ class Fileslistitem extends Component{
let link = document.createElement('a'); let link = document.createElement('a');
document.body.appendChild(link); document.body.appendChild(link);
link.href = result.data.url; link.href = result.data.url;
let filesname=escape(result.data.title)
debugger
console.log(filesname) console.log(filesname)
link.download = unescape(filesname); link.download = value;
//兼容火狐浏览器 //兼容火狐浏览器
let evt = document.createEvent("MouseEvents"); let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false); evt.initEvent("click", false, false);
@ -208,13 +206,13 @@ class Fileslistitem extends Component{
{ {
this.props.isAdmin ? <a this.props.isAdmin ? <a
// href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"} // href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"}
onClick={this.showfiles} onClick={()=>this.showfiles(discussMessage.title)}
title={discussMessage.title} title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> : "" className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> : ""
} }
{ {
this.props.isStudent? <a this.props.isStudent? <a
onClick={this.showfiles} onClick={()=>this.showfiles(discussMessage.title)}
title={discussMessage.title} title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> :"" className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> :""
} }

Loading…
Cancel
Save