dev_forum
杨树明 5 years ago
parent 6a75a6c56a
commit 32b94f640d

@ -28,13 +28,8 @@ class Fileslistitem extends Component{
this.props.Settingtypes(discussMessage.id)
}
showfiles=(value)=>{
let newvalue=Base64.encode(value)
let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id
let link = document.createElement('a');
document.body.appendChild(link);
link.download = Base64.decode(newvalue);
let url="/files/"+file_id+"/histories.json"
axios.get(url,{
params:{
@ -43,24 +38,17 @@ class Fileslistitem extends Component{
}).then((result)=>{
if(result.data.attachment_histories.length===0){
// link.href = result.data.url;
// link.style.display = 'none';
// document.body.appendChild(link);
// link.click();
//兼容火狐浏览器
// let evt = document.createEvent("MouseEvents");
// evt.initEvent("click", false, false);
// link.dispatchEvent(evt);
// document.body.removeChild(link);
// // window.location.href=result.data.url;
// let url = window.URL.createObjectURL(new Blob([result.data.url]));
// let link = document.createElement('a');
// link.style.display = 'none';
// link.href = url;
// link.setAttribute('download',result.data.title);
// document.body.appendChild(link);
// link.click();
window.open=result.data.url;
let link = document.createElement('a');
// link.href = window.URL.createObjectURL(new Blob([result.data.url]));
link.href = result.data.url;
link.download = result.data.title;
//兼容火狐浏览器
console.log(link)
document.body.appendChild(link);
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
link.dispatchEvent(evt);
document.body.removeChild(link);
}else{
this.setState({
Showoldfiles:true,

Loading…
Cancel
Save