This commit is contained in:
joylink_zhaoerwei 2023-08-18 09:01:40 +08:00
parent 0c8163e7b5
commit ebbdff239d

View File

@ -7,7 +7,7 @@
</template>
<script setup lang="ts">
import { watch, onUnmounted, ref, onMounted, reactive } from 'vue';
import { watch, onUnmounted, ref, onMounted } from 'vue';
import { useLineNetStore } from 'src/stores/line-net-store';
import { useQuasar } from 'quasar';
import alarmInfoDialog from 'src/components/alarm/alarmInfoDialog.vue';
@ -25,7 +25,6 @@ const watchInteract = () => {
document.removeEventListener('click', watchInteract);
document.removeEventListener('keydown', watchInteract);
};
const redOption = ['计轴红光带', '计轴大面积红光带'];
watch(
() => lineNetStore.alarmInfo,
@ -41,12 +40,19 @@ watch(
function playAlarmMusic(type: number) {
if (playAble.value && audio.value.paused) {
const alarmType = (showAlertTypeData as never)[type + ''];
if (alarmType == '道岔失表') {
audioSrc.value = 'src/assets/lost.mp3';
} else if (redOption.includes(alarmType)) {
audioSrc.value = 'src/assets/red.mp3';
} else {
audioSrc.value = 'src/assets/buzzer.mp3';
switch (alarmType) {
case '道岔失表':
audioSrc.value = 'src/assets/lost.mp3';
break;
case '计轴红光带':
audioSrc.value = 'src/assets/red.mp3';
break;
case '计轴大面积红光带':
audioSrc.value = 'src/assets/red.mp3';
break;
default:
audioSrc.value = 'src/assets/buzzer.mp3';
break;
}
audio.value.src = audioSrc.value;
audio.value.play();