|
|
|
@ -230,7 +230,6 @@ |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
const pages = getCurrentPages() |
|
|
|
|
console.log(444,pages) |
|
|
|
|
const { options } = pages[pages.length - 1] |
|
|
|
|
this.cid = options.cid |
|
|
|
|
this.mallId = options.mallId |
|
|
|
@ -358,6 +357,37 @@ |
|
|
|
|
// 判断文件是图片/视频/pdf等 |
|
|
|
|
handleFileType(row) { |
|
|
|
|
const type = row.fileType |
|
|
|
|
const platform = uni.getSystemInfoSync().platform |
|
|
|
|
console.log(444, platform) |
|
|
|
|
// ppt安卓下没法用webview或者用微软的office服务预览(皆会没法显示),因此下载到本地查看 |
|
|
|
|
if ((type === 'pptx' || type === 'ppt') && platform === 'android') { |
|
|
|
|
this.curRow = {} |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true |
|
|
|
|
}) |
|
|
|
|
uni.downloadFile({ |
|
|
|
|
url: row.fileUrl, |
|
|
|
|
success: function(res) { |
|
|
|
|
console.log(11, res) |
|
|
|
|
// 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。 |
|
|
|
|
uni.openDocument({ |
|
|
|
|
filePath: res.tempFilePath, |
|
|
|
|
fileType: row.fileType, |
|
|
|
|
showMenu: true, // 允许出现分享功能 |
|
|
|
|
success: res => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
}, |
|
|
|
|
fail: openError => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
fail: function(err) { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
if (this.$util.exts.video.includes(type)) { |
|
|
|
|
row.isVideo = true |
|
|
|
|
} else if (this.$util.exts.img.includes(type)) { |
|
|
|
@ -367,6 +397,7 @@ |
|
|
|
|
} |
|
|
|
|
row.viewUrl = row.fileUrl |
|
|
|
|
this.curRow = row |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 预览文件 |
|
|
|
|
secClick(row) { |
|
|
|
|