This commit is contained in:
曹辉 2023-05-04 14:02:14 +08:00
parent 25860e2d18
commit ea7911bd77
4 changed files with 352 additions and 201 deletions

View File

@ -95,6 +95,8 @@
//
tobuy() {
var that = this
const nurseStationId = uni.getStorageSync('nurseStationId');
if (nurseStationId) {
if (this.list.trainingOrderAmount > 0) {
let objs = {
"openid": uni.getStorageSync('openid'),
@ -143,6 +145,14 @@
}
})
}
} else {
that.$refs.uToast.show({
title: '请您重新登录',
type: 'error',
duration: 1500,
url: "/pages/login/login"
})
}
},
}
}

View File

@ -1,6 +1,9 @@
<template>
<view class="app" v-if="list">
<image class="topimage" :src="baseurl + list.trainingItemPosterUrl" mode=""></image>
<image class="topimage" v-if='!videoshow' :src="baseurl + list.trainingItemPosterUrl" mode=""></image>
<video class="topimage" id="video" v-if="videoshow" :src="baseurl+videoitem.itemDirectoryUrl"
@timeupdate='videotimeupdate' :initial-time='videoitem.watchTime' @error='videoerror' :custom-cache="false"
@play='videoplays' @pause='videopause' @ended='videoended'></video>
<view class="title">
{{list.trainingItemTitle}}
</view>
@ -22,30 +25,45 @@
<view class="" v-if="trainingOrderStatus=='PAY'">
<view class="play" @tap='videoplay(item)'
:style="item.itemDirectoryWatchStatus=='NOT_WATCHED'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='NOT_WATCHED'">
v-if="item.itemDirectoryWatchStatus=='NOT_WATCHED'&&!item.videoshow">
开始播放
</view>
<view class="play"
:style="item.itemDirectoryWatchStatus=='NOT_WATCHED'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='NOT_WATCHED'&&item.videoshow">
播放中
</view>
<view class="play" @tap='videoplay(item)'
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #E3EAF5;color:#3D7DCA':''"
v-if="item.itemDirectoryWatchStatus=='WATCHED'">
v-if="item.itemDirectoryWatchStatus=='WATCHED'&&!item.videoshow">
继续播放
</view>
<view class="play"
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='WATCHED'&&item.videoshow">
播放中
</view>
<view class="play" @tap='videoplay(item)'
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #E6E6E6;color:#76777B':''"
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'">
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'&&!item.videoshow">
已看完
</view>
<view class="play"
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'&&item.videoshow">
播放中
</view>
</view>
<view class="play" v-else @tap='novideoplay'>
开始播放
</view>
</view>
</view>
<u-popup v-model="videoshow" mode="center" closeable @close='videoshowfalse'>
<!-- <u-popup v-model="videoshow" mode="center" closeable @close='videoshowfalse'>
<video id="video" v-if="videoshow" :src="baseurl+videoitem.itemDirectoryUrl" @timeupdate='videotimeupdate'
:initial-time='videoitem.watchTime' @error='videoerror' :custom-cache="false"
@play='videoplays'></video>
</u-popup>
</u-popup> -->
<u-toast ref="uToast" />
</view>
<view class="" v-else style="padding-top: 100rpx;">
@ -100,24 +118,41 @@
});
},
methods: {
//
videotimeupdate(e) {
//e.detail.currentTimee.detail.duration
this.videoitem.watchTime = e.detail.currentTime
},
//
videoshowfalse() {
//
videoended(e) {
this.videoContext.stop()
if (this.videoerroshow) {
if (this.videoitem.watchTime) {
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
}
insertTrainingItemWatchRecord(this.videoitem).then(res => {
this.videoitem.watchTime = 0
this.info();
this.videoshow = false
this.videoitem = {
watchTime: 0
}
this.info();
})
}
},
//
videotimeupdate(e) {
//e.detail.currentTimee.detail.duration
this.videoitem.watchTime = e.detail.currentTime
},
//
videopause() {
// if (this.videoerroshow) {
// if (this.videoitem.watchTime) {
// this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
// }
// insertTrainingItemWatchRecord(this.videoitem).then(res => {
// this.videoitem.watchTime = 0
// this.info();
// this.videoshow = false
// })
// }
},
//
videoerror(e) {
this.$refs.uToast.show({
@ -150,44 +185,76 @@
});
},
videoplay(item) {
if (this.videoContext) {
this.videoshow = false
this.videoContext.stop()
if (this.videoerroshow) {
if (this.videoitem.watchTime) {
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
}
insertTrainingItemWatchRecord(this.videoitem).then(res => {
this.videoitem.watchTime = 0
})
}
}
uni.showLoading({
title: '获取视频中'
});
setTimeout(el => {
this.info();
this.videoerroshow = true
if (item.itemDirectoryUrl) {
if (!item.watchTime) {
this.videoitem.watchTime = 0
}
this.videoitem = item
this.videoitem.trainingOrderId = this.list.trainingOrderId
this.videoitem.trainingItemId = this.list.trainingItemId
this.videoitem.nurseStationPersonId = this.nurseStationPersonId
this.videoitem.trainingItemTitle = this.list.trainingItemTitle
this.videoitem.nursePersonName = uni.getStorageSync('nursePersonName')
this.list.trainingOrderItemDirectoryVOList.forEach(e => {
e.videoshow = false
})
item.trainingOrderId = this.list.trainingOrderId
item.trainingItemId = this.list.trainingItemId
item.nurseStationPersonId = this.nurseStationPersonId
item.nursePersonName = uni.getStorageSync('nursePersonName')
item.trainingItemTitle = this.list.trainingItemTitle
if (item.itemDirectoryWatchStatus == 'WATCHED') {
getTrainingItemWatchRecord(this.videoitem.trainingOrderId, this.videoitem.trainingItemId, this
.videoitem
.trainingItemDirectoryId, this.videoitem.nurseStationPersonId).then(res => {
getTrainingItemWatchRecord(item.trainingOrderId, item.trainingItemId, item
.trainingItemDirectoryId, item.nurseStationPersonId).then(res => {
if (res.code == 200) {
if (res.data.watchTime) {
this.videoitem.watchTime = res.data.watchTime
this.videoitem.watchTime = this.formatsecond(this.videoitem.watchTime)
item.watchTime = res.data.watchTime
item.watchTime = this.formatsecond(item.watchTime)
}
}
})
}
this.videoitem = item
this.videoitem.videoshow = true
this.videoshow = true
this.videoContext = uni.createVideoContext('video', this)
uni.hideLoading();
} else {
this.$refs.uToast.show({
title: '暂无视频',
type: 'error',
duration: '2000'
})
uni.hideLoading();
}
}, 500)
},
info() {
selectTrainingOrderVideoDetails(this.trainingItemId, this.trainingOrderNo, this.trainingOrderDetailsId)
.then(
res => {
this.list = res.data
if (this.videoitem) {
this.list.trainingOrderItemDirectoryVOList.forEach(e => {
if (e.itemDirectoryCode == this.videoitem.itemDirectoryCode) {
e.videoshow = true
} else {
e.videoshow = false
}
})
}
})
},
//tabs

View File

@ -1,6 +1,9 @@
<template>
<view class="app" v-if="list">
<image class="topimage" :src="baseurl + list.trainingItemPosterUrl" mode=""></image>
<image class="topimage" v-if='!videoshow' :src="baseurl + list.trainingItemPosterUrl" mode=""></image>
<video class="topimage" id="video" v-if="videoshow" :src="baseurl+videoitem.itemDirectoryUrl"
@timeupdate='videotimeupdate' :initial-time='videoitem.watchTime' @error='videoerror' :custom-cache="false"
@play='videoplays' @pause='videopause' @ended='videoended'></video>
<view class="title">
{{list.trainingItemTitle}}
</view>
@ -25,27 +28,39 @@
<view class="" v-if="item.trainingOrderStatus=='PAY'">
<view class="play" @tap='videoplay(item)'
:style="item.itemDirectoryWatchStatus=='NOT_WATCHED'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='NOT_WATCHED'">
v-if="item.itemDirectoryWatchStatus=='NOT_WATCHED'&&!item.videoshow">
开始播放
</view>
<view class="play"
:style="item.itemDirectoryWatchStatus=='NOT_WATCHED'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='NOT_WATCHED'&&item.videoshow">
播放中
</view>
<view class="play" @tap='videoplay(item)'
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #E3EAF5;color:#3D7DCA':''"
v-if="item.itemDirectoryWatchStatus=='WATCHED'">
v-if="item.itemDirectoryWatchStatus=='WATCHED'&&!item.videoshow">
继续播放
</view>
<view class="play"
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='WATCHED'&&item.videoshow">
播放中
</view>
<view class="play" @tap='videoplay(item)'
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #E6E6E6;color:#76777B':''"
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'">
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'&&!item.videoshow">
已看完
</view>
<view class="play"
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #3D7DCA;color:#fff':''"
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'&&item.videoshow">
播放中
</view>
</view>
</view>
<u-popup v-model="videoshow" mode="center" closeable @close='videoshowfalse'>
<video id="video" v-if="videoshow" :src="baseurl+videoitem.itemDirectoryUrl" @timeupdate='videotimeupdate'
:initial-time='videoitem.watchTime' @error='videoerror' :custom-cache="false"
@play='videoplays'></video>
</u-popup>
</view>
<!-- <u-popup v-model="videoshow" mode="center" closeable @close='videoshowfalse'>
</u-popup> -->
<u-toast ref="uToast" />
</view>
<view class="" v-else style="padding-top: 100rpx;">
@ -76,6 +91,7 @@
videoitem: {
watchTime: 0,
}, //
videoContext: null,
videoerroshow: true,
};
},
@ -96,24 +112,40 @@
plus.screen.lockOrientation("portrait-primary");
},
methods: {
//
videotimeupdate(e) {
//e.detail.currentTimee.detail.duration
this.videoitem.watchTime = e.detail.currentTime
},
//
videoshowfalse() {
//
videoended(e) {
this.videoContext.stop()
if (this.videoerroshow) {
if (this.videoitem.watchTime) {
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
}
insertTrainingItemWatchRecord(this.videoitem).then(res => {
this.videoitem.watchTime = 0
this.info();
this.videoshow = false
this.videoitem = {
watchTime: 0
}
this.info();
})
}
},
//
videotimeupdate(e) {
//e.detail.currentTimee.detail.duration
this.videoitem.watchTime = e.detail.currentTime
},
//
videopause() {
// if (this.videoerroshow) {
// if (this.videoitem.watchTime) {
// this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
// }
// insertTrainingItemWatchRecord(this.videoitem).then(res => {
// this.videoitem.watchTime = 0
// this.info();
// })
// }
},
//
videoerror(e) {
this.videoerroshow = false
@ -139,42 +171,74 @@
},
//
videoplay(item) {
if (this.videoContext) {
this.videoshow = false
this.videoContext.stop()
if (this.videoerroshow) {
if (this.videoitem.watchTime) {
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
}
insertTrainingItemWatchRecord(this.videoitem).then(res => {
this.videoitem.watchTime = 0
})
}
}
uni.showLoading({
title: '获取视频中'
});
setTimeout(el => {
this.info();
this.videoerroshow = true
if (item.itemDirectoryUrl) {
if (!item.watchTime) {
this.videoitem.watchTime = 0
}
this.videoitem = item
this.videoitem.trainingItemId = this.list.trainingItemId
this.videoitem.nurseStationPersonId = this.nurseStationPersonId
this.videoitem.nursePersonName = uni.getStorageSync('nursePersonName')
this.videoitem.trainingItemTitle = this.list.trainingItemTitle
this.list.trainingItemDirectoryList.forEach(e => {
e.videoshow = false
})
item.trainingItemId = this.list.trainingItemId
item.nurseStationPersonId = this.nurseStationPersonId
item.nursePersonName = uni.getStorageSync('nursePersonName')
item.trainingItemTitle = this.list.trainingItemTitle
if (item.itemDirectoryWatchStatus == 'WATCHED') {
getTrainingItemWatchRecord(this.videoitem.trainingOrderId, this.videoitem.trainingItemId, this
.videoitem
.trainingItemDirectoryId, this.videoitem.nurseStationPersonId).then(res => {
getTrainingItemWatchRecord(item.trainingOrderId, item.trainingItemId, item
.trainingItemDirectoryId, item.nurseStationPersonId).then(res => {
if (res.code == 200) {
if (res.data.watchTime) {
this.videoitem.watchTime = res.data.watchTime
this.videoitem.watchTime = this.formatsecond(this.videoitem.watchTime)
item.watchTime = res.data.watchTime
item.watchTime = this.formatsecond(item.watchTime)
}
}
})
}
this.videoitem = item
this.videoitem.videoshow = true
this.videoshow = true
this.videoContext = uni.createVideoContext('video', this)
uni.hideLoading();
} else {
this.$refs.uToast.show({
title: '暂无视频',
type: 'error',
duration: '2000'
})
uni.hideLoading();
}
}, 500)
},
info() {
selectNurseAppletPersonTrainingItemDetailsList(this.trainingItemId, this.nurseStationPersonId).then(
res => {
this.list = res.data
if (this.videoitem) {
this.list.trainingItemDirectoryList.forEach(e => {
if (e.itemDirectoryCode == this.videoitem.itemDirectoryCode) {
e.videoshow = true
} else {
e.videoshow = false
}
})
}
})
},
novideo() {

View File

@ -129,6 +129,8 @@
//
tobuy() {
var that = this
const nurseStationId = uni.getStorageSync('nurseStationId');
if (nurseStationId) {
var obj = {
"trainingItemId": undefined,
"nurseStationId": undefined,
@ -200,6 +202,14 @@
})
}
})
} else {
that.$refs.uToast.show({
title: '请您重新登录',
type: 'error',
duration: 1500,
url: "/pages/login/login"
})
}
},
//
buy() {