|
@@ -76,7 +76,7 @@
|
|
|
<text>{{item.city}}</text>
|
|
|
</template>
|
|
|
<template v-if="item.firstActivityTypeId===1&&item.activityState===3&&item.hasPlayBack">
|
|
|
- <image :src="currentAudioMsg.activityId==item.activityId&¤tAudioMsg.play?'../../static/audio-doing.png':'../../static/audio-pause.png'"></image>
|
|
|
+ <image :src="currentAudioMsg.activityId==item.activityId&¤tAudioMsg.play?'../../static/audio-doing.png':'../../static/audio-pause-3.png'"></image>
|
|
|
<text>{{currentAudioMsg.activityId==item.activityId?currentAudioMsg.play?'暂停':'回放':'回放'}}</text>
|
|
|
</template>
|
|
|
</view>
|
|
@@ -140,9 +140,9 @@
|
|
|
<view :style="{color:item.voiceUrl==currentAudioMsg.audioCurrentUrl?'#D5AD79':''}">{{item.voiceName}}</view>
|
|
|
<view style="font-size:12px;color:#999">{{item.voicePlaySeconds|formatVoiceTime}}</view>
|
|
|
</view>
|
|
|
- <image v-if="item.voiceUrl==currentAudioMsg.audioCurrentUrl&¤tAudioMsg.play" src="../../static/audio-doing.png" mode="scaleToFill"/>
|
|
|
+ <!-- <image v-if="item.voiceUrl==currentAudioMsg.audioCurrentUrl&¤tAudioMsg.play" src="../../static/audio-doing.png" mode="scaleToFill"/>
|
|
|
<image v-else-if="item.voiceUrl==currentAudioMsg.audioCurrentUrl&&!currentAudioMsg.play" src="../../static/audio-pause-3.png" mode="scaleToFill"/>
|
|
|
- <image v-else src="../../static/audio-pause-2.png" mode="scaleToFill"/>
|
|
|
+ <image v-else src="../../static/audio-pause-2.png" mode="scaleToFill"/> -->
|
|
|
</view>
|
|
|
<view class="flex box">
|
|
|
<text>{{currentAudioMsg.audioCurrentTime|formatVoiceTime}}</text>
|
|
@@ -259,20 +259,13 @@ export default {
|
|
|
if(this.$store.state.activity.activityListPageRefresh){
|
|
|
this.allRefresh()
|
|
|
}
|
|
|
-
|
|
|
this.initAudio()
|
|
|
-
|
|
|
-
|
|
|
- // let obj=uni.getStorageSync('audioMsg')
|
|
|
- // if(obj){
|
|
|
- // this.currentAudioMsg=JSON.parse(obj)
|
|
|
- // }
|
|
|
- // this.handleAudioFun()
|
|
|
},
|
|
|
onHide(){
|
|
|
this.pupData.show=false
|
|
|
this.currentAudioMsg.show=false
|
|
|
// 存一次音频信息
|
|
|
+
|
|
|
uni.setStorageSync('audioMsg', JSON.stringify(this.currentAudioMsg))
|
|
|
},
|
|
|
onUnload(){
|
|
@@ -302,16 +295,25 @@ export default {
|
|
|
methods: {
|
|
|
// 初始化音频状态
|
|
|
initAudio(){
|
|
|
- wx.getBackgroundAudioPlayerState({
|
|
|
- success:(res)=> {
|
|
|
- const status=res.status;//0暂停中 1播放中 2没有音乐播放
|
|
|
-
|
|
|
- console.log(this.statusActive);
|
|
|
- },
|
|
|
- fail:(e)=>{
|
|
|
- console.log(e);
|
|
|
+ console.log('音频src',this.globalBgMusic.src);
|
|
|
+ if(this.globalBgMusic.src){
|
|
|
+ const obj=uni.getStorageSync('audioMsg')
|
|
|
+ if(obj){
|
|
|
+ this.currentAudioMsg=JSON.parse(obj)
|
|
|
}
|
|
|
- })
|
|
|
+ this.handleAudioFun()
|
|
|
+ }else{
|
|
|
+ this.currentAudioMsg={
|
|
|
+ activityId:'',//活动id
|
|
|
+ play:false,//是否正在播放
|
|
|
+ list:[],//音频列表数据
|
|
|
+ show:false,//是否显示弹窗
|
|
|
+ title:'',//音频弹窗标题
|
|
|
+ audioCurrentTime:0,//音频播放实时时间
|
|
|
+ audioTime:0,//当前音频时间
|
|
|
+ audioCurrentUrl:'',//当前音频地址
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 点击列表中播放音频
|
|
@@ -350,12 +352,7 @@ export default {
|
|
|
|
|
|
this.globalBgMusic.onCanplay(()=>{
|
|
|
this.globalBgMusic.play()
|
|
|
- })
|
|
|
-
|
|
|
- this.globalBgMusic.onPlay(()=>{
|
|
|
- this.currentAudioMsg.play=true
|
|
|
this.currentAudioMsg.audioTime=item.voicePlaySeconds
|
|
|
- this.currentAudioMsg.audioCurrentUrl=this.globalBgMusic.src
|
|
|
})
|
|
|
|
|
|
this.handleAudioFun()
|
|
@@ -363,6 +360,10 @@ export default {
|
|
|
|
|
|
// 音频事件
|
|
|
handleAudioFun(){
|
|
|
+ this.globalBgMusic.onPlay(()=>{
|
|
|
+ this.currentAudioMsg.play=true
|
|
|
+ this.currentAudioMsg.audioCurrentUrl=this.globalBgMusic.src
|
|
|
+ })
|
|
|
this.globalBgMusic.onPause(()=>{
|
|
|
this.currentAudioMsg.play=false
|
|
|
})
|
|
@@ -378,9 +379,10 @@ export default {
|
|
|
console.log('onError',e);
|
|
|
})
|
|
|
this.globalBgMusic.onTimeUpdate(()=>{
|
|
|
- if(this.globalBgMusic.src==this.currentAudioMsg.audioCurrentUrl){
|
|
|
+ console.log('时间更新');
|
|
|
+ // if(this.globalBgMusic.src==this.currentAudioMsg.audioCurrentUrl){
|
|
|
this.currentAudioMsg.audioCurrentTime=parseInt(this.globalBgMusic.currentTime)
|
|
|
- }
|
|
|
+ // }
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -426,11 +428,11 @@ export default {
|
|
|
handleAudioChange(item){
|
|
|
// 点击的同一个
|
|
|
if(item.voiceUrl==this.currentAudioMsg.audioCurrentUrl){
|
|
|
- if(this.currentAudioMsg.play){
|
|
|
- this.globalBgMusic.pause()
|
|
|
- }else{
|
|
|
- this.globalBgMusic.play()
|
|
|
- }
|
|
|
+ // if(this.currentAudioMsg.play){
|
|
|
+ // this.globalBgMusic.pause()
|
|
|
+ // }else{
|
|
|
+ // this.globalBgMusic.play()
|
|
|
+ // }
|
|
|
}else{
|
|
|
this.handlePlayAudio(item)
|
|
|
}
|