预览ppt适配安卓

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

@ -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)
// pptwebviewoffice
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) {

Loading…
Cancel
Save