mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-18 03:33:24 +00:00
同时播放两个语音时上一个没有停止动画
This commit is contained in:
parent
7fa2c0d6e7
commit
d456ea68f7
@ -30,7 +30,6 @@ export default {
|
|||||||
audioTimer: null,
|
audioTimer: null,
|
||||||
audioId: 0,
|
audioId: 0,
|
||||||
audioSrc: null,
|
audioSrc: null,
|
||||||
callback: null,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -44,9 +43,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
audioPlay(play) {
|
audioPlay(play) {
|
||||||
if (typeof this.callback === "function") {
|
this.updateState();
|
||||||
this.callback(play)
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
this.audioTimer && clearTimeout(this.audioTimer);
|
this.audioTimer && clearTimeout(this.audioTimer);
|
||||||
if (!play) {
|
if (!play) {
|
||||||
@ -57,6 +54,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}, 3000)
|
}, 3000)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
audioSrc() {
|
||||||
|
this.updateState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -75,8 +75,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const {id, src, callback} = msg
|
const {id, src} = msg
|
||||||
this.callback = callback || null;
|
|
||||||
if (src === this.audioSrc) {
|
if (src === this.audioSrc) {
|
||||||
if (ended) {
|
if (ended) {
|
||||||
audio.play()
|
audio.play()
|
||||||
@ -94,6 +93,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateState() {
|
||||||
|
this.$store.state.audioPlaying = this.audioPlay && this.audioSrc ? this.audioSrc : null;
|
||||||
|
},
|
||||||
|
|
||||||
overAudio() {
|
overAudio() {
|
||||||
this.audioPlay = false;
|
this.audioPlay = false;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--录音-->
|
<!--录音-->
|
||||||
<div v-else-if="msgData.type === 'record'" class="content-record no-dark-content">
|
<div v-else-if="msgData.type === 'record'" class="content-record no-dark-content">
|
||||||
<div class="dialog-record" :class="{playing: recordPlay}" :style="recordStyle(msgData.msg)" @click="playRecord">
|
<div class="dialog-record" :class="{playing: audioPlaying === msgData.msg.path}" :style="recordStyle(msgData.msg)" @click="playRecord">
|
||||||
<div class="record-time">{{recordDuration(msgData.msg.duration)}}</div>
|
<div class="record-time">{{recordDuration(msgData.msg.duration)}}</div>
|
||||||
<div class="record-icon taskfont"></div>
|
<div class="record-icon taskfont"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -159,7 +159,6 @@ export default {
|
|||||||
popperLoad: 0,
|
popperLoad: 0,
|
||||||
popperShow: false,
|
popperShow: false,
|
||||||
timeShow: false,
|
timeShow: false,
|
||||||
recordPlay: false,
|
|
||||||
operateEnter: false,
|
operateEnter: false,
|
||||||
allList: [],
|
allList: [],
|
||||||
}
|
}
|
||||||
@ -174,7 +173,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['userToken', 'userId', 'dialogMsgs']),
|
...mapState(['userToken', 'userId', 'dialogMsgs', 'audioPlaying']),
|
||||||
|
|
||||||
viewClass() {
|
viewClass() {
|
||||||
const {msgData, operateAction, operateEnter} = this;
|
const {msgData, operateAction, operateEnter} = this;
|
||||||
@ -391,9 +390,6 @@ export default {
|
|||||||
Store.set('audioSubscribe', {
|
Store.set('audioSubscribe', {
|
||||||
id: this.msgData.id,
|
id: this.msgData.id,
|
||||||
src: this.msgData.msg.path,
|
src: this.msgData.msg.path,
|
||||||
callback: (play) => {
|
|
||||||
this.recordPlay = play;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
3
resources/assets/js/store/state.js
vendored
3
resources/assets/js/store/state.js
vendored
@ -7,6 +7,9 @@ const stateData = {
|
|||||||
// 浏览器宽度≤768返回true
|
// 浏览器宽度≤768返回true
|
||||||
windowMax768: window.innerWidth <= 768,
|
windowMax768: window.innerWidth <= 768,
|
||||||
|
|
||||||
|
// 播放中的音频地址
|
||||||
|
audioPlaying: null,
|
||||||
|
|
||||||
// 路由记录
|
// 路由记录
|
||||||
routeHistorys: [],
|
routeHistorys: [],
|
||||||
routeHistoryLast: {},
|
routeHistoryLast: {},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user