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