预览ppt适配安卓

master
yujialong 2 months ago
parent 39a802c0bb
commit 756af153ea
  1. 49
      course/courseDetail/courseDetail.vue

@ -230,7 +230,6 @@
}, },
onShow() { onShow() {
const pages = getCurrentPages() const pages = getCurrentPages()
console.log(444,pages)
const { options } = pages[pages.length - 1] const { options } = pages[pages.length - 1]
this.cid = options.cid this.cid = options.cid
this.mallId = options.mallId this.mallId = options.mallId
@ -358,15 +357,47 @@
// //pdf // //pdf
handleFileType(row) { handleFileType(row) {
const type = row.fileType const type = row.fileType
if (this.$util.exts.video.includes(type)) { const platform = uni.getSystemInfoSync().platform
row.isVideo = true console.log(444, platform)
} else if (this.$util.exts.img.includes(type)) { // pptwebviewoffice
row.isPic = true if ((type === 'pptx' || type === 'ppt') && platform === 'android') {
} else if (this.$util.exts.doc.includes(type)) { this.curRow = {}
row.isDoc = true 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)) {
row.isPic = true
} else if (this.$util.exts.doc.includes(type)) {
row.isDoc = true
}
row.viewUrl = row.fileUrl
this.curRow = row
} }
row.viewUrl = row.fileUrl
this.curRow = row
}, },
// //
secClick(row) { secClick(row) {

Loading…
Cancel
Save