如果你的项目需要接入文件预览项目,达到对docx、excel、ppt、jpg等文件的预览效果,那么通过在你的项目中加入下面的代码就可以
成功实现:
var url = 'http://127.0.0.1:8080/file/test.txt'; //要预览文件的访问地址
window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(base64Encode(url)));
新增多图片同时预览功能,接口如下:
var fileUrl =url1+"|"+"url2";//多文件使用“|”字符隔开
window.open('http://127.0.0.1:8012/picturesPreview?urls='+encodeURIComponent(base64Encode(fileUrl)));
下载文件接口
var urlPath = 'http://127.0.0.1:8080/file/test.txt'; //要下载文件的访问地址
var fileName = 'test.txt'; //文件名称(有的链接最后并不是文件名称才需要传,或者想下载的文件名),不传则取链接后的文件名,如果没有,则使用 时间戳.file
window.open('http://127.0.0.1:8012/downloadFile?fileName=fileName&urlPath='+encodeURIComponent(base64Encode(urlPath)));