handleView(index) {
let row = this.fileList[index];
downLoadAttachment(row).then(response => {
console.log(response);
var pricode = response.data;
//配置文件配置的后台内网地址
let baseUrl = BASE.localUrl;
//预览图片时文件地址使用外网地址(域名)
if (['jpg', 'png', 'bmp', 'svg', 'gif', 'tif', 'jpeg'].indexOf(row.filetype.toLowerCase()) > -1) {
baseUrl = document.location.protocol + '//' + location.host + process.env.VUE_APP_BASE_API;
}
let url = baseUrl + '/system/attachment/downLoadFile?pricode=' + pricode + '&fullfilename=' + row.fileid + row.filename;
let filePreviewUrl = BASE.filePreviewUrl;
//若果是ceb文件,则使用ceb文件预览服务
if (row.filetype.toLowerCase() == 'ceb' || row.filetype.toLowerCase() == 'cebx') {
filePreviewUrl = BASE.fileCebPreviewUrl;
}
window.open(filePreviewUrl + encodeURIComponent(url));
});
},
js实现文件在线预览
最新推荐文章于 2024-04-16 11:28:53 发布