dev_forum
杨树明 5 years ago
parent f38091a59a
commit f9a2d94709

@ -27,6 +27,17 @@ class Fileslistitem extends Component{
})
this.props.Settingtypes(discussMessage.id)
}
downloadfiles=(url,name)=>{
const aLink = document.createElement('a');
document.body.appendChild(aLink);
aLink.style.display='none';
aLink.download =name;
aLink.href = url;
aLink.click();
document.body.removeChild(aLink);
}
showfiles=(value)=>{
let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id
@ -38,17 +49,7 @@ class Fileslistitem extends Component{
}).then((result)=>{
if(result.data.attachment_histories.length===0){
const aLink = document.createElement('a');
document.body.appendChild(aLink);
aLink.style.display='none';
const objectUrl = window.URL.createObjectURL(result.data.url);
aLink.href = objectUrl;
aLink.download =result.data.title;
aLink.click();
document.body.removeChild(aLink);
this.downloadfiles(result.data.url,filesname)
}else{
this.setState({
Showoldfiles:true,

Loading…
Cancel
Save