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