修改
This commit is contained in:
parent
25860e2d18
commit
ea7911bd77
@ -95,52 +95,62 @@
|
|||||||
//购买
|
//购买
|
||||||
tobuy() {
|
tobuy() {
|
||||||
var that = this
|
var that = this
|
||||||
if (this.list.trainingOrderAmount > 0) {
|
const nurseStationId = uni.getStorageSync('nurseStationId');
|
||||||
let objs = {
|
if (nurseStationId) {
|
||||||
"openid": uni.getStorageSync('openid'),
|
if (this.list.trainingOrderAmount > 0) {
|
||||||
"nurseStationPersonId": this.list.nurseStationPersonId,
|
let objs = {
|
||||||
"orderNo": this.list.trainingOrderNo,
|
"openid": uni.getStorageSync('openid'),
|
||||||
"payType": "WECHAT_PAY",
|
"nurseStationPersonId": this.list.nurseStationPersonId,
|
||||||
"orderChannel": "WECHAT_APPLET",
|
"orderNo": this.list.trainingOrderNo,
|
||||||
"buySource": "TRAINING",
|
"payType": "WECHAT_PAY",
|
||||||
"paymentPrice": this.list.trainingOrderAmount,
|
"orderChannel": "WECHAT_APPLET",
|
||||||
}
|
"buySource": "TRAINING",
|
||||||
appletTrainingOrderPay(objs).then(response => {
|
"paymentPrice": this.list.trainingOrderAmount,
|
||||||
if (response.code == 200) {
|
|
||||||
uni.requestPayment({
|
|
||||||
timeStamp: response.data.timeStamp,
|
|
||||||
nonceStr: response.data.nonceStr,
|
|
||||||
package: response.data.prepayId,
|
|
||||||
signType: response.data.signType,
|
|
||||||
paySign: response.data.paySign,
|
|
||||||
success: function(res) {
|
|
||||||
uni.setStorageSync("Refresh", '1')
|
|
||||||
that.$refs.uToast.show({
|
|
||||||
title: '支付成功',
|
|
||||||
type: 'success',
|
|
||||||
duration: 1500,
|
|
||||||
})
|
|
||||||
setTimeout(e => {
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
},
|
|
||||||
fail: function(err) {
|
|
||||||
that.$refs.uToast.show({
|
|
||||||
title: '取消支付',
|
|
||||||
type: 'error',
|
|
||||||
duration: 1500,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.$refs.uToast.show({
|
|
||||||
title: response.msg,
|
|
||||||
type: 'error',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
appletTrainingOrderPay(objs).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
uni.requestPayment({
|
||||||
|
timeStamp: response.data.timeStamp,
|
||||||
|
nonceStr: response.data.nonceStr,
|
||||||
|
package: response.data.prepayId,
|
||||||
|
signType: response.data.signType,
|
||||||
|
paySign: response.data.paySign,
|
||||||
|
success: function(res) {
|
||||||
|
uni.setStorageSync("Refresh", '1')
|
||||||
|
that.$refs.uToast.show({
|
||||||
|
title: '支付成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
})
|
||||||
|
setTimeout(e => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
}, 1500)
|
||||||
|
},
|
||||||
|
fail: function(err) {
|
||||||
|
that.$refs.uToast.show({
|
||||||
|
title: '取消支付',
|
||||||
|
type: 'error',
|
||||||
|
duration: 1500,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: response.msg,
|
||||||
|
type: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.$refs.uToast.show({
|
||||||
|
title: '请您重新登录',
|
||||||
|
type: 'error',
|
||||||
|
duration: 1500,
|
||||||
|
url: "/pages/login/login"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app" v-if="list">
|
<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">
|
<view class="title">
|
||||||
{{list.trainingItemTitle}}
|
{{list.trainingItemTitle}}
|
||||||
</view>
|
</view>
|
||||||
@ -22,30 +25,45 @@
|
|||||||
<view class="" v-if="trainingOrderStatus=='PAY'">
|
<view class="" v-if="trainingOrderStatus=='PAY'">
|
||||||
<view class="play" @tap='videoplay(item)'
|
<view class="play" @tap='videoplay(item)'
|
||||||
:style="item.itemDirectoryWatchStatus=='NOT_WATCHED'?'background-color: #3D7DCA;color:#fff':''"
|
: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>
|
||||||
|
<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)'
|
<view class="play" @tap='videoplay(item)'
|
||||||
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #E3EAF5;color:#3D7DCA':''"
|
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #E3EAF5;color:#3D7DCA':''"
|
||||||
v-if="item.itemDirectoryWatchStatus=='WATCHED'">
|
v-if="item.itemDirectoryWatchStatus=='WATCHED'&&!item.videoshow">
|
||||||
继续播放
|
继续播放
|
||||||
</view>
|
</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)'
|
<view class="play" @tap='videoplay(item)'
|
||||||
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #E6E6E6;color:#76777B':''"
|
: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>
|
||||||
|
<view class="play"
|
||||||
|
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #3D7DCA;color:#fff':''"
|
||||||
|
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'&&item.videoshow">
|
||||||
|
播放中
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="play" v-else @tap='novideoplay'>
|
<view class="play" v-else @tap='novideoplay'>
|
||||||
开始播放
|
开始播放
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</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'
|
<video id="video" v-if="videoshow" :src="baseurl+videoitem.itemDirectoryUrl" @timeupdate='videotimeupdate'
|
||||||
:initial-time='videoitem.watchTime' @error='videoerror' :custom-cache="false"
|
:initial-time='videoitem.watchTime' @error='videoerror' :custom-cache="false"
|
||||||
@play='videoplays'></video>
|
@play='videoplays'></video>
|
||||||
</u-popup>
|
</u-popup> -->
|
||||||
<u-toast ref="uToast" />
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
<view class="" v-else style="padding-top: 100rpx;">
|
<view class="" v-else style="padding-top: 100rpx;">
|
||||||
@ -100,24 +118,41 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//播放进度变化
|
//播放到末尾
|
||||||
videotimeupdate(e) {
|
videoended(e) {
|
||||||
//e.detail.currentTime是已经播放了多久,e.detail.duration是该视频多长
|
this.videoContext.stop()
|
||||||
this.videoitem.watchTime = e.detail.currentTime
|
|
||||||
},
|
|
||||||
//关闭播放弹出框
|
|
||||||
videoshowfalse() {
|
|
||||||
if (this.videoerroshow) {
|
if (this.videoerroshow) {
|
||||||
if (this.videoitem.watchTime) {
|
if (this.videoitem.watchTime) {
|
||||||
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
|
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
|
||||||
}
|
}
|
||||||
insertTrainingItemWatchRecord(this.videoitem).then(res => {
|
insertTrainingItemWatchRecord(this.videoitem).then(res => {
|
||||||
this.videoitem.watchTime = 0
|
this.videoitem.watchTime = 0
|
||||||
this.info();
|
|
||||||
this.videoshow = false
|
this.videoshow = false
|
||||||
|
this.videoitem = {
|
||||||
|
watchTime: 0
|
||||||
|
}
|
||||||
|
this.info();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//播放进度变化
|
||||||
|
videotimeupdate(e) {
|
||||||
|
//e.detail.currentTime是已经播放了多久,e.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) {
|
videoerror(e) {
|
||||||
this.$refs.uToast.show({
|
this.$refs.uToast.show({
|
||||||
@ -150,44 +185,76 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
videoplay(item) {
|
videoplay(item) {
|
||||||
this.videoerroshow = true
|
if (this.videoContext) {
|
||||||
if (item.itemDirectoryUrl) {
|
this.videoshow = false
|
||||||
if (!item.watchTime) {
|
this.videoContext.stop()
|
||||||
this.videoitem.watchTime = 0
|
if (this.videoerroshow) {
|
||||||
}
|
if (this.videoitem.watchTime) {
|
||||||
this.videoitem = item
|
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
|
||||||
this.videoitem.trainingOrderId = this.list.trainingOrderId
|
}
|
||||||
this.videoitem.trainingItemId = this.list.trainingItemId
|
insertTrainingItemWatchRecord(this.videoitem).then(res => {
|
||||||
this.videoitem.nurseStationPersonId = this.nurseStationPersonId
|
this.videoitem.watchTime = 0
|
||||||
this.videoitem.trainingItemTitle = this.list.trainingItemTitle
|
|
||||||
this.videoitem.nursePersonName = uni.getStorageSync('nursePersonName')
|
|
||||||
if (item.itemDirectoryWatchStatus == 'WATCHED') {
|
|
||||||
getTrainingItemWatchRecord(this.videoitem.trainingOrderId, this.videoitem.trainingItemId, this
|
|
||||||
.videoitem
|
|
||||||
.trainingItemDirectoryId, this.videoitem.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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.videoshow = true
|
|
||||||
this.videoContext = uni.createVideoContext('video', this)
|
|
||||||
} else {
|
|
||||||
this.$refs.uToast.show({
|
|
||||||
title: '暂无视频',
|
|
||||||
type: 'error',
|
|
||||||
duration: '2000'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '获取视频中'
|
||||||
|
});
|
||||||
|
setTimeout(el => {
|
||||||
|
this.info();
|
||||||
|
this.videoerroshow = true
|
||||||
|
if (item.itemDirectoryUrl) {
|
||||||
|
if (!item.watchTime) {
|
||||||
|
this.videoitem.watchTime = 0
|
||||||
|
}
|
||||||
|
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(item.trainingOrderId, item.trainingItemId, item
|
||||||
|
.trainingItemDirectoryId, item.nurseStationPersonId).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
if (res.data.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() {
|
info() {
|
||||||
selectTrainingOrderVideoDetails(this.trainingItemId, this.trainingOrderNo, this.trainingOrderDetailsId)
|
selectTrainingOrderVideoDetails(this.trainingItemId, this.trainingOrderNo, this.trainingOrderDetailsId)
|
||||||
.then(
|
.then(
|
||||||
res => {
|
res => {
|
||||||
this.list = res.data
|
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
|
//点击tabs
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app" v-if="list">
|
<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">
|
<view class="title">
|
||||||
{{list.trainingItemTitle}}
|
{{list.trainingItemTitle}}
|
||||||
</view>
|
</view>
|
||||||
@ -25,27 +28,39 @@
|
|||||||
<view class="" v-if="item.trainingOrderStatus=='PAY'">
|
<view class="" v-if="item.trainingOrderStatus=='PAY'">
|
||||||
<view class="play" @tap='videoplay(item)'
|
<view class="play" @tap='videoplay(item)'
|
||||||
:style="item.itemDirectoryWatchStatus=='NOT_WATCHED'?'background-color: #3D7DCA;color:#fff':''"
|
: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>
|
||||||
|
<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)'
|
<view class="play" @tap='videoplay(item)'
|
||||||
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #E3EAF5;color:#3D7DCA':''"
|
:style="item.itemDirectoryWatchStatus=='WATCHED'?'background-color: #E3EAF5;color:#3D7DCA':''"
|
||||||
v-if="item.itemDirectoryWatchStatus=='WATCHED'">
|
v-if="item.itemDirectoryWatchStatus=='WATCHED'&&!item.videoshow">
|
||||||
继续播放
|
继续播放
|
||||||
</view>
|
</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)'
|
<view class="play" @tap='videoplay(item)'
|
||||||
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #E6E6E6;color:#76777B':''"
|
: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>
|
||||||
|
<view class="play"
|
||||||
|
:style="item.itemDirectoryWatchStatus=='FINISHED_READING'?'background-color: #3D7DCA;color:#fff':''"
|
||||||
|
v-if="item.itemDirectoryWatchStatus=='FINISHED_READING'&&item.videoshow">
|
||||||
|
播放中
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</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'
|
</u-popup> -->
|
||||||
:initial-time='videoitem.watchTime' @error='videoerror' :custom-cache="false"
|
|
||||||
@play='videoplays'></video>
|
|
||||||
</u-popup>
|
|
||||||
<u-toast ref="uToast" />
|
<u-toast ref="uToast" />
|
||||||
</view>
|
</view>
|
||||||
<view class="" v-else style="padding-top: 100rpx;">
|
<view class="" v-else style="padding-top: 100rpx;">
|
||||||
@ -76,6 +91,7 @@
|
|||||||
videoitem: {
|
videoitem: {
|
||||||
watchTime: 0,
|
watchTime: 0,
|
||||||
}, //视频对象
|
}, //视频对象
|
||||||
|
videoContext: null,
|
||||||
videoerroshow: true,
|
videoerroshow: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -96,24 +112,40 @@
|
|||||||
plus.screen.lockOrientation("portrait-primary");
|
plus.screen.lockOrientation("portrait-primary");
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//播放进度变化
|
//播放到末尾
|
||||||
videotimeupdate(e) {
|
videoended(e) {
|
||||||
//e.detail.currentTime是已经播放了多久,e.detail.duration是该视频多长
|
this.videoContext.stop()
|
||||||
this.videoitem.watchTime = e.detail.currentTime
|
|
||||||
},
|
|
||||||
//关闭播放弹出框
|
|
||||||
videoshowfalse() {
|
|
||||||
if (this.videoerroshow) {
|
if (this.videoerroshow) {
|
||||||
if (this.videoitem.watchTime) {
|
if (this.videoitem.watchTime) {
|
||||||
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
|
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
|
||||||
}
|
}
|
||||||
insertTrainingItemWatchRecord(this.videoitem).then(res => {
|
insertTrainingItemWatchRecord(this.videoitem).then(res => {
|
||||||
this.videoitem.watchTime = 0
|
this.videoitem.watchTime = 0
|
||||||
this.info();
|
|
||||||
this.videoshow = false
|
this.videoshow = false
|
||||||
|
this.videoitem = {
|
||||||
|
watchTime: 0
|
||||||
|
}
|
||||||
|
this.info();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//播放进度变化
|
||||||
|
videotimeupdate(e) {
|
||||||
|
//e.detail.currentTime是已经播放了多久,e.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) {
|
videoerror(e) {
|
||||||
this.videoerroshow = false
|
this.videoerroshow = false
|
||||||
@ -139,42 +171,74 @@
|
|||||||
},
|
},
|
||||||
//视频播放
|
//视频播放
|
||||||
videoplay(item) {
|
videoplay(item) {
|
||||||
this.videoerroshow = true
|
if (this.videoContext) {
|
||||||
if (item.itemDirectoryUrl) {
|
this.videoshow = false
|
||||||
if (!item.watchTime) {
|
this.videoContext.stop()
|
||||||
this.videoitem.watchTime = 0
|
if (this.videoerroshow) {
|
||||||
}
|
if (this.videoitem.watchTime) {
|
||||||
this.videoitem = item
|
this.videoitem.watchTime = this.formatSeconds(this.videoitem.watchTime)
|
||||||
this.videoitem.trainingItemId = this.list.trainingItemId
|
}
|
||||||
this.videoitem.nurseStationPersonId = this.nurseStationPersonId
|
insertTrainingItemWatchRecord(this.videoitem).then(res => {
|
||||||
this.videoitem.nursePersonName = uni.getStorageSync('nursePersonName')
|
this.videoitem.watchTime = 0
|
||||||
this.videoitem.trainingItemTitle = this.list.trainingItemTitle
|
|
||||||
if (item.itemDirectoryWatchStatus == 'WATCHED') {
|
|
||||||
getTrainingItemWatchRecord(this.videoitem.trainingOrderId, this.videoitem.trainingItemId, this
|
|
||||||
.videoitem
|
|
||||||
.trainingItemDirectoryId, this.videoitem.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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.videoshow = true
|
|
||||||
this.videoContext = uni.createVideoContext('video', this)
|
|
||||||
} else {
|
|
||||||
this.$refs.uToast.show({
|
|
||||||
title: '暂无视频',
|
|
||||||
type: 'error',
|
|
||||||
duration: '2000'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '获取视频中'
|
||||||
|
});
|
||||||
|
setTimeout(el => {
|
||||||
|
this.info();
|
||||||
|
this.videoerroshow = true
|
||||||
|
if (item.itemDirectoryUrl) {
|
||||||
|
if (!item.watchTime) {
|
||||||
|
this.videoitem.watchTime = 0
|
||||||
|
}
|
||||||
|
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(item.trainingOrderId, item.trainingItemId, item
|
||||||
|
.trainingItemDirectoryId, item.nurseStationPersonId).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
if (res.data.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() {
|
info() {
|
||||||
selectNurseAppletPersonTrainingItemDetailsList(this.trainingItemId, this.nurseStationPersonId).then(
|
selectNurseAppletPersonTrainingItemDetailsList(this.trainingItemId, this.nurseStationPersonId).then(
|
||||||
res => {
|
res => {
|
||||||
this.list = res.data
|
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() {
|
novideo() {
|
||||||
|
|||||||
@ -129,77 +129,87 @@
|
|||||||
//购买
|
//购买
|
||||||
tobuy() {
|
tobuy() {
|
||||||
var that = this
|
var that = this
|
||||||
var obj = {
|
const nurseStationId = uni.getStorageSync('nurseStationId');
|
||||||
"trainingItemId": undefined,
|
if (nurseStationId) {
|
||||||
"nurseStationId": undefined,
|
var obj = {
|
||||||
"nurseStationPersonId": undefined,
|
"trainingItemId": undefined,
|
||||||
"trainingOrderAmount": undefined,
|
"nurseStationId": undefined,
|
||||||
"nursePersonName": undefined,
|
"nurseStationPersonId": undefined,
|
||||||
}
|
"trainingOrderAmount": undefined,
|
||||||
obj.trainingItemId = this.infoslist.id
|
"nursePersonName": undefined,
|
||||||
obj.nurseStationId = uni.getStorageSync('nurseStationId');
|
}
|
||||||
obj.nurseStationPersonId = this.nurseStationPersonId
|
obj.trainingItemId = this.infoslist.id
|
||||||
obj.nursePersonName = uni.getStorageSync('nursePersonName');
|
obj.nurseStationId = uni.getStorageSync('nurseStationId');
|
||||||
obj.trainingOrderAmount = this.infoslist.trainingItemPrice
|
obj.nurseStationPersonId = this.nurseStationPersonId
|
||||||
trainingItemOrder(obj).then(res => {
|
obj.nursePersonName = uni.getStorageSync('nursePersonName');
|
||||||
if (res.code == 200) {
|
obj.trainingOrderAmount = this.infoslist.trainingItemPrice
|
||||||
if (res.data.trainingOrderAmount > 0) {
|
trainingItemOrder(obj).then(res => {
|
||||||
let objs = {
|
if (res.code == 200) {
|
||||||
"openid": uni.getStorageSync('openid'),
|
if (res.data.trainingOrderAmount > 0) {
|
||||||
"nurseStationPersonId": res.data.nurseStationPersonId,
|
let objs = {
|
||||||
"orderNo": res.data.trainingOrderNo,
|
"openid": uni.getStorageSync('openid'),
|
||||||
"payType": "WECHAT_PAY",
|
"nurseStationPersonId": res.data.nurseStationPersonId,
|
||||||
"orderChannel": "WECHAT_APPLET",
|
"orderNo": res.data.trainingOrderNo,
|
||||||
"buySource": "TRAINING",
|
"payType": "WECHAT_PAY",
|
||||||
"paymentPrice": res.data.trainingOrderAmount,
|
"orderChannel": "WECHAT_APPLET",
|
||||||
}
|
"buySource": "TRAINING",
|
||||||
appletTrainingOrderPay(objs).then(response => {
|
"paymentPrice": res.data.trainingOrderAmount,
|
||||||
if (response.code == 200) {
|
|
||||||
uni.requestPayment({
|
|
||||||
timeStamp: response.data.timeStamp,
|
|
||||||
nonceStr: response.data.nonceStr,
|
|
||||||
package: response.data.prepayId,
|
|
||||||
signType: response.data.signType,
|
|
||||||
paySign: response.data.paySign,
|
|
||||||
success: function(res) {
|
|
||||||
that.buyshow = false
|
|
||||||
that.infos();
|
|
||||||
that.info();
|
|
||||||
that.$refs.uToast.show({
|
|
||||||
title: '支付成功',
|
|
||||||
type: 'success',
|
|
||||||
duration: 1500,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail: function(err) {
|
|
||||||
that.$refs.uToast.show({
|
|
||||||
title: '取消支付',
|
|
||||||
type: 'error',
|
|
||||||
duration: 1500,
|
|
||||||
url: `/pages/Orderdetails/Orderdetails?trainingOrderNo=${res.data.trainingOrderNo}`
|
|
||||||
})
|
|
||||||
that.buyshow = false
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.buyshow = false
|
|
||||||
this.$refs.uToast.show({
|
|
||||||
title: response.msg,
|
|
||||||
type: 'error',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
appletTrainingOrderPay(objs).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
uni.requestPayment({
|
||||||
|
timeStamp: response.data.timeStamp,
|
||||||
|
nonceStr: response.data.nonceStr,
|
||||||
|
package: response.data.prepayId,
|
||||||
|
signType: response.data.signType,
|
||||||
|
paySign: response.data.paySign,
|
||||||
|
success: function(res) {
|
||||||
|
that.buyshow = false
|
||||||
|
that.infos();
|
||||||
|
that.info();
|
||||||
|
that.$refs.uToast.show({
|
||||||
|
title: '支付成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: function(err) {
|
||||||
|
that.$refs.uToast.show({
|
||||||
|
title: '取消支付',
|
||||||
|
type: 'error',
|
||||||
|
duration: 1500,
|
||||||
|
url: `/pages/Orderdetails/Orderdetails?trainingOrderNo=${res.data.trainingOrderNo}`
|
||||||
|
})
|
||||||
|
that.buyshow = false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.buyshow = false
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: response.msg,
|
||||||
|
type: 'error',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.buyshow = false
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
title: res.msg,
|
||||||
|
type: 'error',
|
||||||
|
duration: 2000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
this.buyshow = false
|
} else {
|
||||||
this.$refs.uToast.show({
|
that.$refs.uToast.show({
|
||||||
title: res.msg,
|
title: '请您重新登录',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
duration: 2000
|
duration: 1500,
|
||||||
})
|
url: "/pages/login/login"
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
},
|
},
|
||||||
//打开购买弹框
|
//打开购买弹框
|
||||||
buy() {
|
buy() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user