|
|
@ -31,6 +31,10 @@ class Fileslistitem extends Component{
|
|
|
|
let newvalue=Base64.encode(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:{
|
|
|
@ -39,21 +43,15 @@ class Fileslistitem extends Component{
|
|
|
|
}).then((result)=>{
|
|
|
|
}).then((result)=>{
|
|
|
|
|
|
|
|
|
|
|
|
if(result.data.attachment_histories.length===0){
|
|
|
|
if(result.data.attachment_histories.length===0){
|
|
|
|
|
|
|
|
|
|
|
|
let link = document.createElement('a');
|
|
|
|
|
|
|
|
document.body.appendChild(link);
|
|
|
|
|
|
|
|
link.href = result.data.url;
|
|
|
|
link.href = result.data.url;
|
|
|
|
console.log(newvalue)
|
|
|
|
link.style.display = 'none';
|
|
|
|
// link.download = Base64.decode(newvalue);
|
|
|
|
document.body.appendChild(link);
|
|
|
|
|
|
|
|
link.click();
|
|
|
|
//兼容火狐浏览器
|
|
|
|
//兼容火狐浏览器
|
|
|
|
// let evt = document.createEvent("MouseEvents");
|
|
|
|
// let evt = document.createEvent("MouseEvents");
|
|
|
|
// evt.initEvent("click", false, false);
|
|
|
|
// evt.initEvent("click", false, false);
|
|
|
|
// link.dispatchEvent(evt);
|
|
|
|
// link.dispatchEvent(evt);
|
|
|
|
// document.body.removeChild(link);
|
|
|
|
// document.body.removeChild(link);
|
|
|
|
link.style.display = 'none';
|
|
|
|
|
|
|
|
link.setAttribute('download',result.data.title);
|
|
|
|
|
|
|
|
document.body.appendChild(link);
|
|
|
|
|
|
|
|
link.click();
|
|
|
|
|
|
|
|
// // window.location.href=result.data.url;
|
|
|
|
// // window.location.href=result.data.url;
|
|
|
|
// let url = window.URL.createObjectURL(new Blob([result.data.url]));
|
|
|
|
// let url = window.URL.createObjectURL(new Blob([result.data.url]));
|
|
|
|
// let link = document.createElement('a');
|
|
|
|
// let link = document.createElement('a');
|
|
|
|