Commit ef0f1e5a by kyle

initialTime赋值问题

parent c69fffff
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
type:Object type:Object
}, },
fileId:{ fileId:{
type: String type: Number
} }
}, },
data() { data() {
......
...@@ -6,45 +6,26 @@ ...@@ -6,45 +6,26 @@
"dependencies": { "dependencies": {
"echarts": { "echarts": {
"version": "5.4.1", "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==", "integrity": "sha512-9ltS3M2JB0w2EhcYjCdmtrJ+6haZcW6acBolMGIuf01Hql1yrIV01L1aRj7jsaaIULJslEP9Z3vKlEmnJaWJVQ==",
"requires": { "requires": {
"tslib": "2.3.0", "tslib": "2.3.0",
"zrender": "5.4.1" "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": { "nanoid": {
"version": "4.0.0", "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==" "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": { "tslib": {
"version": "2.3.0", "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==" "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": { "zrender": {
"version": "5.4.1", "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==", "integrity": "sha512-M4Z05BHWtajY2241EmMPHglDQAJ1UyHQcYsxDNzD9XLSkPDqMq4bB28v9Pb4mvHnVQ0GxyTklZ/69xCFP6RXBA==",
"requires": { "requires": {
"tslib": "2.3.0" "tslib": "2.3.0"
......
...@@ -22,21 +22,17 @@ ...@@ -22,21 +22,17 @@
<!-- 课程banner图 --> <!-- 课程banner图 -->
<!-- v-show="!sliceshare" --> <!-- v-show="!sliceshare" -->
<view class="courseBannerBox" v-if="!sliceshare"> <view class="courseBannerBox" v-if="!sliceshare">
<template v-if="isRenderVideo"> <video v-if="isRenderVideo" id="myVideo" :src="courseInfo.filePathOss" :initial-time="initialTimev"
<view > object-fit="contain" class="videoBox" :poster="courseInfo.fileFirstImage"
<video id="myVideo" :src="courseInfo.filePathOss" :initial-time="videoPlaybackInfo.maxViewTime" :title="courseInfo.fileTitle" @loadedmetadata="loadedmetadata" @play="playVideo" @pause="pause"
object-fit="contain" class="videoBox" :poster="courseInfo.fileFirstImage" @ended="ended" @timeupdate="timeupdate" style="width: 100vw;height: 320rpx;"></video>
:title="courseInfo.fileTitle" @loadedmetadata="loadedmetadata" @play="playVideo" @pause="pause"
@ended="ended" @timeupdate="timeupdate"></video>
</view>
</template>
</view> </view>
<!-- 课程详情图 --> <!-- 课程详情图 -->
<view class="courseTitleContent"> <view class="courseTitleContent">
<view class="courseTitle"> <view class="courseTitle">
<view class="" style="width: 70%;"> <view class="" style="width: 70%;">
<h4>{{courseInfo.fileTitle}}</h4> <h4>{{courseInfo.fileTitle}}---{{videoPlaybackInfo.viewTime}}---{{initialTimev}}</h4>
</view> </view>
<view class="shareF"> <view class="shareF">
<view class="awakenApp" @click="jumpapp()" v-if="coursesharing == 1"> <view class="awakenApp" @click="jumpapp()" v-if="coursesharing == 1">
...@@ -176,6 +172,7 @@ ...@@ -176,6 +172,7 @@
shareCode: null, shareCode: null,
sharelogin: false, sharelogin: false,
startTime: '', startTime: '',
initialTimev:0
}; };
}, },
methods: { methods: {
...@@ -340,7 +337,6 @@ ...@@ -340,7 +337,6 @@
'cffp_userId'), 'cffp_userId'),
packFileId: this.courseInfo.packFileId packFileId: this.courseInfo.packFileId
}).then(res => { }).then(res => {
console.log(res, 1551)
if (res['success']) { if (res['success']) {
this.courseInfo = res['data']['data']; this.courseInfo = res['data']['data'];
this.lecturerId = res['data']['data']['fileLecturerId']; this.lecturerId = res['data']['data']['fileLecturerId'];
...@@ -377,7 +373,7 @@ ...@@ -377,7 +373,7 @@
secondsTransferPipe(value) { secondsTransferPipe(value) {
return dataHandling.secondsTransferPipe(value) return dataHandling.secondsTransferPipe(value)
}, },
play(item) { async play(item) {
if (this.courseInfo.status == 1) { if (this.courseInfo.status == 1) {
// 不可播放 // 不可播放
uni.showToast({ uni.showToast({
...@@ -386,6 +382,7 @@ ...@@ -386,6 +382,7 @@
duration: 2000 duration: 2000
}); });
} else { } else {
await this.saveVideoPlayback();
this.playbackId = null; this.playbackId = null;
this.fileId = item.fileId; this.fileId = item.fileId;
this.courseInfo.packFileId = item.packFileId; this.courseInfo.packFileId = item.packFileId;
...@@ -400,14 +397,18 @@ ...@@ -400,14 +397,18 @@
userId: this.userId, userId: this.userId,
fileId: this.fileId, fileId: this.fileId,
packFileId: this.courseInfo.packFileId, packFileId: this.courseInfo.packFileId,
totalTime: Math.floor(this.totalTime * 100) / 100, totalTime: Math.floor(this.totalTime),
viewTime: Math.floor(this.viewTime * 100) / 100, viewTime: Math.floor(this.viewTime),
playbackStatus: this.viewTime >= this.totalTime ? '2' : '1' playbackStatus: this.viewTime >= this.totalTime ? '2' : '1'
} }
api.saveVideoPlayback(param).then(res => { return new Promise((resolve,reject)=>{
if (res['success']) { api.saveVideoPlayback(param).then(res => {
this.playbackId = res['data']['id']; if (res['success']) {
} this.playbackId = res['data']['id'];
resolve()
console.log('执行保存了===========',param.viewTime)
}
})
}) })
}, },
findVideoPlayback() { findVideoPlayback() {
...@@ -419,9 +420,13 @@ ...@@ -419,9 +420,13 @@
packFileId: this.courseInfo.packFileId, packFileId: this.courseInfo.packFileId,
} }
api.findVideoPlayback(param).then(res => { api.findVideoPlayback(param).then(res => {
this.isRenderVideo = true;
if (res['success']) { 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 @@ ...@@ -429,12 +434,14 @@
this.totalTime = e.detail.duration; this.totalTime = e.detail.duration;
}, },
playVideo(e) { playVideo(e) {
if(this.videoPlaybackInfo.viewTime >= this.videoPlaybackInfo.totalTime){
this.videoPlaybackInfo.viewTime = 0;
}
// 开始/继续播放 // 开始/继续播放
if (this.courseInfo.status === 2) { if (this.courseInfo.status === 2) {
if (this.timer) { if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
} }
this.saveVideoPlayback();
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.saveVideoPlayback() this.saveVideoPlayback()
}, 20 * 1000) }, 20 * 1000)
...@@ -546,6 +553,7 @@ ...@@ -546,6 +553,7 @@
this.videoContext = uni.createVideoContext('myVideo'); this.videoContext = uni.createVideoContext('myVideo');
}, },
onUnload() { onUnload() {
this.saveVideoPlayback();
if (this.timer) { if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
} }
...@@ -558,20 +566,10 @@ ...@@ -558,20 +566,10 @@
padding: 0; padding: 0;
} }
.courseBannerBox { .courseBannerBox {
// min-height: 300rpx;
// margin-top: 20rpx;
background-color: #ebebeb; background-color: #ebebeb;
display: flex; display: flex;
justify-content: center; justify-content: center;
z-index: 1; z-index: 1;
.videoBox {
width: 100vw;
// width: 100%;
// max-width: 100%;
min-height: 320rpx;
height: 100%;
}
} }
.courseTitleContent { .courseTitleContent {
height: 150rpx; height: 150rpx;
......
...@@ -27,9 +27,9 @@ export default{ ...@@ -27,9 +27,9 @@ export default{
}, },
// 秒转换成时分秒 // 秒转换成时分秒
secondsTransferPipe(value:number){ secondsTransferPipe(value:number){
const h = Math.floor(value / 3600) > 0 ? Math.floor(value / 3600) : '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) : '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) : '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; 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