|
@@ -54,6 +54,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {apiViewLogUpdate} from '@/api/common'
|
|
|
export default {
|
|
|
filters:{
|
|
|
formatVoiceTime(e){
|
|
@@ -120,6 +121,7 @@ export default {
|
|
|
const curAudio=this.$store.state.audio.list[this.$store.state.audio.index]
|
|
|
setTimeout(() => {
|
|
|
if(this.globalBgMusic.src!=curAudio.url){
|
|
|
+ this.handleUpdateAudioPlayTime()
|
|
|
this.globalBgMusic.src=curAudio.url
|
|
|
this.globalBgMusic.title=curAudio.title
|
|
|
}
|
|
@@ -141,16 +143,18 @@ export default {
|
|
|
})
|
|
|
this.globalBgMusic.onPause(()=>{
|
|
|
console.log('音频暂停');
|
|
|
+ this.handleUpdateAudioPlayTime()
|
|
|
this.play=false
|
|
|
this.$store.commit('audio/updateAudioPause',true)
|
|
|
})
|
|
|
this.globalBgMusic.onStop(()=>{
|
|
|
console.log('音频停止');
|
|
|
+ this.handleUpdateAudioPlayTime()
|
|
|
this.$store.commit('audio/removeAudio')
|
|
|
})
|
|
|
this.globalBgMusic.onEnded(()=>{
|
|
|
console.log('音频onEnded');
|
|
|
-
|
|
|
+ this.handleUpdateAudioPlayTime()
|
|
|
const index=this.$store.state.audio.index
|
|
|
if(index==this.$store.state.audio.list.length-1){
|
|
|
this.$store.commit('audio/removeAudio')
|
|
@@ -212,6 +216,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ // 记录音频播放 时长
|
|
|
+ handleUpdateAudioPlayTime(){
|
|
|
+ if(!this.$store.state.audio.recordId||this.$store.state.audio.curTime==0) return
|
|
|
+ apiViewLogUpdate({
|
|
|
+ id:this.$store.state.audio.recordId,
|
|
|
+ stop_seconds:parseInt(this.$store.state.audio.curTime),
|
|
|
+ source:this.$store.state.audio.lastType
|
|
|
+ }).then(res=>{
|
|
|
+ console.log('音频播放时间记录成功');
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
}
|
|
|
</script>
|