<template>
|
<view class="showhfive-box">
|
<web-view v-if="params.type == 0" :src="url"></web-view>
|
<video
|
id="myVideo"
|
class="showVideo"
|
v-if="params.type == 1"
|
:src="url"
|
controls
|
autoplay
|
page-gesture
|
:direction="0"
|
show-play-btn
|
show-center-play-btn
|
object-fit="fill"
|
enable-play-gesture
|
auto-pause-if-navigate
|
></video>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
url:'',
|
fileType:'', //类型
|
videoContext:'',
|
params: {
|
id:'',
|
userId:'',
|
name:'',
|
type:'',
|
time:''
|
},
|
startTime: '', //进入页面时间
|
endTime: '', //离开页面时间
|
lastTime:'', //停留时长
|
}
|
},
|
onLoad(options) {
|
console.log(options,'options------------')
|
this.params.type = options.fileType
|
// this.url = options.url
|
this.params.id = options.id
|
this.params.name = options.name
|
// this.url = 'https://media.w3.org/2010/05/sintel/trailer.mp4'
|
// this.url = 'https://hesuancj.cn:8889/show/showImg?result=1628039217322.mp4'
|
this.url = decodeURIComponent(options.url)
|
// console.log('this.url========',this.url)
|
// this.url = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
|
this.params.userId = this.getStore('userInfo').id
|
console.log('this.params.userId--------',this.params.userId)
|
|
},
|
onShow() {
|
let a = new Date()
|
this.startTime = a.getTime()
|
},
|
onHide() {
|
|
},
|
destroyed() {
|
let b = new Date()
|
this.endTime = b.getTime()
|
let c = (this.endTime - this.startTime) / 1000 / 60
|
this.params.time = Math.round(c)
|
console.log('mathTime----',this.params.time)
|
// let params = {
|
// id:
|
// }
|
console.log('this.params======this.params',this.params)
|
this.$u.api.studySave(this.params).then(res => {
|
console.log(res,'res------res')
|
})
|
},
|
mounted() {
|
|
}
|
}
|
</script>
|
|
|
<style lang="scss" scoped>
|
.showhfive-box{
|
width:100%;
|
height: 100%;
|
}
|
.showVideo{
|
width: 100%;
|
}
|
/deep/ .uni-video-bar.uni-video-bar-full {
|
z-index: 99;
|
}
|
</style>
|