| | |
| | | |
| | | if (item.selectType == "document" || item.selectType == "pdf") { |
| | | // freeFile |
| | | console.log(item); |
| | | const fileLink = item.file ? |
| | | app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file : app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.freeFile |
| | | console.log(fileLink, "fileLink"); |
| | |
| | | // 单次下载允许的最大文件为 200MB |
| | | wx.downloadFile({ |
| | | url: fileLink, |
| | | filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, |
| | | success: function (res) { |
| | | console.log(res, "wx.downloadFile success res"); |
| | | if (res.statusCode != 200) { |
| | |
| | | return false; |
| | | } |
| | | var Path = res.tempFilePath; //返回的文件临时地址,用于后面打开本地预览所用 |
| | | let data = res.filePath; |
| | | wx.openDocument({ |
| | | filePath: Path, |
| | | filePath: data, |
| | | showMenu: true, |
| | | success: function (res) { |
| | | console.log("打开成功"); |