|
|
|
@ -39,12 +39,17 @@ class Fileslistitem extends Component{
|
|
|
|
|
|
|
|
|
|
if(result.data.attachment_histories.length===0){
|
|
|
|
|
if(result.data.is_pdf===true){
|
|
|
|
|
axios.get(result.data.url).then((result)=>{
|
|
|
|
|
var binaryData = [];
|
|
|
|
|
binaryData.push(result.data);
|
|
|
|
|
this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
|
|
|
|
|
window.open(this.url);
|
|
|
|
|
})
|
|
|
|
|
//预览pdf
|
|
|
|
|
axios({
|
|
|
|
|
method:'get',
|
|
|
|
|
url:result.data.url,
|
|
|
|
|
responseType: 'arraybuffer',
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
var binaryData = [];
|
|
|
|
|
binaryData.push(result.data);
|
|
|
|
|
this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
|
|
|
|
|
window.open(this.url);
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
let link = document.createElement('a');
|
|
|
|
|
document.body.appendChild(link);
|
|
|
|
|