Commit ef0f1e5a by kyle

initialTime赋值问题

parent c69fffff
......@@ -59,7 +59,7 @@
type:Object
},
fileId:{
type: String
type: Number
}
},
data() {
......
......@@ -6,45 +6,26 @@
"dependencies": {
"echarts": {
"version": "5.4.1",
"resolved": "https://registry.npmmirror.com/echarts/-/echarts-5.4.1.tgz",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.1.tgz",
"integrity": "sha512-9ltS3M2JB0w2EhcYjCdmtrJ+6haZcW6acBolMGIuf01Hql1yrIV01L1aRj7jsaaIULJslEP9Z3vKlEmnJaWJVQ==",
"requires": {
"tslib": "2.3.0",
"zrender": "5.4.1"
}
},
"merge-images": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/merge-images/-/merge-images-1.2.0.tgz",
"integrity": "sha512-hEGvgnTdXr08uzGvEArxRsKpy7WmozM73YaSi4s5IYF4LxrhANpqfHaz9CgBZ5+0+s2NsjPnPdStz3aCc0Yulw=="
},
"nanoid": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-4.0.0.tgz",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.0.tgz",
"integrity": "sha512-IgBP8piMxe/gf73RTQx7hmnhwz0aaEXYakvqZyE302IXW3HyVNhdNGC+O2MwMAVhLEnvXlvKtGbtJf6wvHihCg=="
},
"signature_pad": {
"version": "3.0.0-beta.4",
"resolved": "https://registry.npmmirror.com/signature_pad/-/signature_pad-3.0.0-beta.4.tgz",
"integrity": "sha512-cOf2NhVuTiuNqe2X/ycEmizvCDXk0DoemhsEpnkcGnA4kS5iJYTCqZ9As7tFBbsch45Q1EdX61833+6sjJ8rrw=="
},
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
},
"vue-signature-pad": {
"version": "3.0.2",
"resolved": "https://registry.npmmirror.com/vue-signature-pad/-/vue-signature-pad-3.0.2.tgz",
"integrity": "sha512-o25o+lROfCmzASS2+fU8ZV801kV+D4/02zkZ+ez3NKeiUmbxW7kwlUf5oKQkvA+l7Ou9xGsGLsirBLch3jyX8A==",
"requires": {
"merge-images": "^1.1.0",
"signature_pad": "^3.0.0-beta.3"
}
},
"zrender": {
"version": "5.4.1",
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.4.1.tgz",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.1.tgz",
"integrity": "sha512-M4Z05BHWtajY2241EmMPHglDQAJ1UyHQcYsxDNzD9XLSkPDqMq4bB28v9Pb4mvHnVQ0GxyTklZ/69xCFP6RXBA==",
"requires": {
"tslib": "2.3.0"
......
......@@ -22,21 +22,17 @@
<!-- 课程banner图 -->
<!-- v-show="!sliceshare" -->
<view class="courseBannerBox" v-if="!sliceshare">
<template v-if="isRenderVideo">
<view >
<video id="myVideo" :src="courseInfo.filePathOss" :initial-time="videoPlaybackInfo.maxViewTime"
object-fit="contain" class="videoBox" :poster="courseInfo.fileFirstImage"
:title="courseInfo.fileTitle" @loadedmetadata="loadedmetadata" @play="playVideo" @pause="pause"
@ended="ended" @timeupdate="timeupdate"></video>
</view>
</template>
<video v-if="isRenderVideo" id="myVideo" :src="courseInfo.filePathOss" :initial-time="initialTimev"
object-fit="contain" class="videoBox" :poster="courseInfo.fileFirstImage"
:title="courseInfo.fileTitle" @loadedmetadata="loadedmetadata" @play="playVideo" @pause="pause"
@ended="ended" @timeupdate="timeupdate" style="width: 100vw;height: 320rpx;"></video>
</view>
<!-- 课程详情图 -->
<view class="courseTitleContent">
<view class="courseTitle">
<view class="" style="width: 70%;">
<h4>{{courseInfo.fileTitle}}</h4>
<h4>{{courseInfo.fileTitle}}---{{videoPlaybackInfo.viewTime}}---{{initialTimev}}</h4>
</view>
<view class="shareF">
<view class="awakenApp" @click="jumpapp()" v-if="coursesharing == 1">
......@@ -176,6 +172,7 @@
shareCode: null,
sharelogin: false,
startTime: '',
initialTimev:0
};
},
methods: {
......@@ -340,7 +337,6 @@
'cffp_userId'),
packFileId: this.courseInfo.packFileId
}).then(res => {
console.log(res, 1551)
if (res['success']) {
this.courseInfo = res['data']['data'];
this.lecturerId = res['data']['data']['fileLecturerId'];
......@@ -377,7 +373,7 @@
secondsTransferPipe(value) {
return dataHandling.secondsTransferPipe(value)
},
play(item) {
async play(item) {
if (this.courseInfo.status == 1) {
// 不可播放
uni.showToast({
......@@ -386,6 +382,7 @@
duration: 2000
});
} else {
await this.saveVideoPlayback();
this.playbackId = null;
this.fileId = item.fileId;
this.courseInfo.packFileId = item.packFileId;
......@@ -400,14 +397,18 @@
userId: this.userId,
fileId: this.fileId,
packFileId: this.courseInfo.packFileId,
totalTime: Math.floor(this.totalTime * 100) / 100,
viewTime: Math.floor(this.viewTime * 100) / 100,
totalTime: Math.floor(this.totalTime),
viewTime: Math.floor(this.viewTime),
playbackStatus: this.viewTime >= this.totalTime ? '2' : '1'
}
api.saveVideoPlayback(param).then(res => {
if (res['success']) {
this.playbackId = res['data']['id'];
}
return new Promise((resolve,reject)=>{
api.saveVideoPlayback(param).then(res => {
if (res['success']) {
this.playbackId = res['data']['id'];
resolve()
console.log('执行保存了===========',param.viewTime)
}
})
})
},
findVideoPlayback() {
......@@ -419,9 +420,13 @@
packFileId: this.courseInfo.packFileId,
}
api.findVideoPlayback(param).then(res => {
this.isRenderVideo = true;
if (res['success']) {
this.videoPlaybackInfo = res['data']
this.videoPlaybackInfo = res['data'];
this.initialTimev = this.videoPlaybackInfo.viewTime;
this.isRenderVideo = true;
this.$forceUpdate();
}else{
this.isRenderVideo = true;
}
})
},
......@@ -429,12 +434,14 @@
this.totalTime = e.detail.duration;
},
playVideo(e) {
if(this.videoPlaybackInfo.viewTime >= this.videoPlaybackInfo.totalTime){
this.videoPlaybackInfo.viewTime = 0;
}
// 开始/继续播放
if (this.courseInfo.status === 2) {
if (this.timer) {
clearInterval(this.timer)
}
this.saveVideoPlayback();
this.timer = setInterval(() => {
this.saveVideoPlayback()
}, 20 * 1000)
......@@ -546,6 +553,7 @@
this.videoContext = uni.createVideoContext('myVideo');
},
onUnload() {
this.saveVideoPlayback();
if (this.timer) {
clearInterval(this.timer)
}
......@@ -558,20 +566,10 @@
padding: 0;
}
.courseBannerBox {
// min-height: 300rpx;
// margin-top: 20rpx;
background-color: #ebebeb;
display: flex;
justify-content: center;
z-index: 1;
.videoBox {
width: 100vw;
// width: 100%;
// max-width: 100%;
min-height: 320rpx;
height: 100%;
}
}
.courseTitleContent {
height: 150rpx;
......
......@@ -27,9 +27,9 @@ export default{
},
// 秒转换成时分秒
secondsTransferPipe(value:number){
const h = Math.floor(value / 3600) > 0 ? Math.floor(value / 3600) : '00';
const m = Math.floor(value % 3600 / 60) > 0 ? Math.floor(value % 3600 / 60) : '00';
const s = Math.floor(value % 60) > 0 ? Math.floor(value % 60) : '00';
const h = Math.floor(value / 3600) > 0 ? (Math.floor(value / 3600) <= 9 ? '0' + Math.floor(value / 3600) : Math.floor(value / 3600)): '00';
const m = Math.floor(value % 3600 / 60) > 0 ? (Math.floor(value % 3600 / 60)<=9 ? '0'+Math.floor(value % 3600 / 60):Math.floor(value % 3600 / 60)) : '00';
const s = Math.floor(value % 60) > 0 ? (Math.floor(value % 60) <=9 ? '0'+Math.floor(value % 60) : Math.floor(value % 60)) : '00';
return h + ':' + m + ':' + s;
},
// 日期格式化
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment