提交: 声音测试

This commit is contained in:
23688nl 2022-09-01 11:48:36 +08:00
parent 20873eab95
commit 84a66a1473
1 changed files with 9 additions and 4 deletions

View File

@ -6,8 +6,8 @@
autoplay autoplay
src="/images/alarm_tips.mp3" src="/images/alarm_tips.mp3"
ref="audio" ref="audio"
v-if="audioHidden"
></audio> ></audio>
<el-button @click="handleTextSend">ws 告警通知</el-button>
<div class="e-dialog-div" v-show="dialogShow"> <div class="e-dialog-div" v-show="dialogShow">
<div class="dialog-top"> <div class="dialog-top">
<span class="info-title">报警提醒</span> <span class="info-title">报警提醒</span>
@ -69,6 +69,7 @@ export default {
socket_flag: true, socket_flag: true,
timeout_flag: null, timeout_flag: null,
dialogShow: false, dialogShow: false,
audioHidden: false,
interval: null, interval: null,
intervalTime: 10, intervalTime: 10,
alarmInfo: { alarmInfo: {
@ -80,10 +81,11 @@ export default {
}, },
watch: {}, watch: {},
created() { created() {
setTimeout(this.handleTextSend, 10000); setTimeout(this.handleTextSend, 5000);
}, },
methods: { methods: {
handleTextSend() { handleTextSend() {
console.log('handleTextSend-')
this.dialogShow = true; this.dialogShow = true;
this.handlePlayAudio(); this.handlePlayAudio();
}, },
@ -98,12 +100,15 @@ export default {
if(this.interval) { if(this.interval) {
clearInterval(this.interval) clearInterval(this.interval)
}; };
this.audioHidden = false;
setTimeout(this.handleTextSend, 5000);
}; };
}, },
// //
handlePlayAudio() { handlePlayAudio() {
this.$refs.audio.currentTime = 0; // // this.$refs.audio.currentTime = 0; //
this.$refs.audio.play(); // // this.$refs.audio.play(); //
this.audioHidden = true;
if (this.interval) { if (this.interval) {
clearInterval(this.interval); clearInterval(this.interval);
} }