wx.downloadFile的url?
wx.downloadFile的url直接写完整的可以下载打开,使用拼接的url返回的文件就不对了,下面这个是that.data.path打印的数据,这两个拼接是一样的,但为啥就不行呢?url: 'http://localhost:8080/mycode_war_exploded/upload/a29b135e291f481f8632b5478ed8dfa4.pdf', //这个就能打开
preview:function(){
var that = this;
wx.downloadFile({
url: uriUtils.BASE_URL_UPLOAD + that.data.path,
success: function (res) {
console.log(res);
var filePath = res.tempFilePath
console.log(filePath);
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log("打开文档成功")
console.log(res);
},
fail: function (res) {
console.log("fail");
console.log(res)
},
complete: function (res) {
console.log("complete");
console.log(res)
}
})
}
})
},