安卓预览ppt兼容完成

master
yujialong 3 months ago
parent 0b00d3e7a9
commit 19a72f3437
  1. 4
      apis/modules/course.js
  2. 44
      course/courseDetail/courseDetail.vue
  3. 2
      pages/index/index.vue

@ -63,4 +63,8 @@ export const getALinkToTheExperimentReport = reportId => {
export const getExamPaperReportUrl = data => {
return get(`exam/exam/paper/getExamPaperReportUrl`, data)
}
export const fileConversion = url => {
return get(`nakadai/nakadai/oss/fileConversion?pptUrl=${url}`)
}

@ -9,7 +9,8 @@
<!-- pdfwordexcelppt都用webview展示 -->
<view v-else-if="curRow.isDoc" class="webview-wrap">
<web-view class="webview" :webview-styles="webviewStyles" :fullscreen="false" :src="curRow.viewUrl" @click="hidePlayList"></web-view>
<!-- <web-view class="webview" :webview-styles="webviewStyles" :fullscreen="false" src="http://192.168.31.125:8097/#/previewPPT?src=https%3A%2F%2Fhuoran.oss-cn-shenzhen.aliyuncs.com%2F1725254394528.pptx" @click="hidePlayList"></web-view> -->
<!-- <web-view class="webview" :webview-styles="webviewStyles" :fullscreen="false" src="https://eduvessel.com/#/previewPPT" @click="hidePlayList"></web-view> -->
<!-- <web-view class="webview" :webview-styles="webviewStyles" :fullscreen="false" src="https://eduvessel.com/#/previewPPT?src=https%3A%2F%2Fhuoran.oss-cn-shenzhen.aliyuncs.com%2F1706689196136.pptx" @click="hidePlayList"></web-view> -->
<cover-view class="webview-mask" @click="closePreview">
<cover-image class="icon" src="https://eduvessel.com/images/occupationlab/close-gray.png" alt="" mode="widthFix" />
</cover-view>
@ -115,7 +116,7 @@
</template>
<script>
import { queryChaptersAndSubsections, detailsOfGoods, queryPracticeByStudent, queryAssessmentByStudent, getPlayAuth, playRecordSave, recordRecentUsage, getALinkToTheExperimentReport, getExamPaperReportUrl } from '@/apis/modules/course.js'
import { queryChaptersAndSubsections, detailsOfGoods, queryPracticeByStudent, queryAssessmentByStudent, getPlayAuth, playRecordSave, recordRecentUsage, getALinkToTheExperimentReport, getExamPaperReportUrl, fileConversion } from '@/apis/modules/course.js'
export default {
data() {
return {
@ -356,13 +357,41 @@
},
// //pdf
handleFileType(row) {
async handleFileType(row) {
const type = row.fileType
const platform = uni.getSystemInfoSync().platform
// pptwebviewofficeh5
if (type === 'pptx' || type === 'ppt') {
row.isDoc = true
row.viewUrl = 'https://eduvessel.com/#/previewPPT?src=' + row.fileUrl
this.curRow = row
if ((type === 'pptx' || type === 'ppt') && platform === 'android') {
// row.isDoc = true
// row.viewUrl = 'https://view.officeapps.live.com/op/view.aspx?src=' + row.fileUrl
// this.curRow = row
uni.showLoading({
title: '加载中',
mask: true
})
uni.downloadFile({
url: `http://192.168.31.51:9000/nakadai/nakadai/oss/fileConversion?pptUrl=${row.fileUrl}`,
success: function(res) {
console.log(11, res)
// doc, xls, ppt, pdf, docx, xlsx, pptx
uni.openDocument({
filePath: res.tempFilePath,
// fileType: row.fileType,
fileType: 'pdf',
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
@ -373,6 +402,7 @@
}
row.viewUrl = row.fileUrl
this.curRow = row
console.log(11, this.curRow)
}
if (!this.curRow.isVideo) this.videoFullScreen = false
},

@ -67,7 +67,7 @@
}
},
onShow() {
// uni.setStorageSync('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjQ2NzQ0LCJyblN0ciI6IktVcVR5eWtSbGlVQzF0dmRjdDRuR3dWaGVBaTJwQ2lMIiwiYWNjb3VudElkIjo0Njc0NCwidXNlcklkIjo0Njc0Mywic2Nob29sSWQiOjI4NDYsInVzZXJOYW1lIjoiYWMiLCJwbGF0Zm9ybUlkIjoiMSJ9.zo6L0AYyZA5yfMFovV9oGQHuFJgs936fa4bzyvpiK4Y')
// uni.setStorageSync('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjQ2NzQ0LCJyblN0ciI6InNibVM4UFREQTRjZDB4NDFURGJwNjFuTVZnSThtZHRRIiwiYWNjb3VudElkIjo0Njc0NCwidXNlcklkIjo0Njc0Mywic2Nob29sSWQiOjI4NDYsInVzZXJOYW1lIjoiYWMiLCJwbGF0Zm9ybUlkIjoiMSJ9.rtzgxV-vP_PvHVtdMbz9wSTakf4SgmawcX5Np19CZts')
this.$refs.realName.handleRealName()
this.getTab()
},

Loading…
Cancel
Save