播放音乐调整
This commit is contained in:
parent
8149d6d6f1
commit
37a81de2ce
@ -7,7 +7,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch, onUnmounted, ref, onMounted } from 'vue';
|
||||
import { watch, onUnmounted, ref } from 'vue';
|
||||
import { useLineNetStore } from 'src/stores/line-net-store';
|
||||
import { DialogChainObject, useQuasar } from 'quasar';
|
||||
import alarmInfoDialog from 'src/components/alarm/alarmInfoDialog.vue';
|
||||
@ -29,12 +29,6 @@ const lineNetStore = useLineNetStore();
|
||||
const audio = ref();
|
||||
const audioSrc = ref('');
|
||||
const $q = useQuasar();
|
||||
const playAble = ref(false);
|
||||
const watchInteract = () => {
|
||||
playAble.value = true;
|
||||
document.removeEventListener('click', watchInteract);
|
||||
document.removeEventListener('keydown', watchInteract);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => lineNetStore.alarmInfo,
|
||||
@ -48,7 +42,7 @@ watch(
|
||||
);
|
||||
|
||||
function playAlarmMusic(type: number) {
|
||||
if (playAble.value && audio.value.paused) {
|
||||
if (lineNetStore.playAble && audio.value.paused) {
|
||||
const alarmType = (showAlertTypeData as never)[type + ''];
|
||||
const mapAlarmMusic = new Map([
|
||||
['蓝显', blue],
|
||||
@ -117,11 +111,6 @@ function alarm(alarmType: number) {
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener('click', watchInteract);
|
||||
document.addEventListener('keydown', watchInteract);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (dialogInstance.length) {
|
||||
dialogInstance.forEach((item) => {
|
||||
|
@ -97,6 +97,7 @@ import setAlarmText from 'src/components/alarm/setAlarmText.vue';
|
||||
import setAlarmMock from 'src/components/alarm/setAlarmMock.vue';
|
||||
import NCC from '/logo/NCC_bai.png';
|
||||
import { getShowSetAlarmTextButton } from 'src/configs/UrlManage';
|
||||
import { useLineNetStore } from 'src/stores/line-net-store';
|
||||
|
||||
const leftDrawerOpen = ref(false);
|
||||
const router = useRouter();
|
||||
@ -124,10 +125,18 @@ function onLeftResize(size: { width: number; height: number }) {
|
||||
leftDrawerSize.height = size.height;
|
||||
}
|
||||
|
||||
const watchInteract = () => {
|
||||
useLineNetStore().playAble = true;
|
||||
document.removeEventListener('click', watchInteract);
|
||||
document.removeEventListener('keydown', watchInteract);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (getShowSetAlarmTextButton()) {
|
||||
showSetAlarmTextButton.value = true;
|
||||
}
|
||||
document.addEventListener('click', watchInteract);
|
||||
document.addEventListener('keydown', watchInteract);
|
||||
});
|
||||
|
||||
//模拟报警
|
||||
|
@ -26,6 +26,7 @@ export const useLineNetStore = defineStore('lineNet', {
|
||||
alarmInfo: [] as AlarmInfo[], //报警信息
|
||||
untreatedMap: new Map(), // 未处理的报警
|
||||
alarmInfoListTable: undefined as QTable | undefined,
|
||||
playAble: false, //是否允许播放音乐
|
||||
}),
|
||||
getters: {
|
||||
untreatedNum: (state) => {
|
||||
|
Loading…
Reference in New Issue
Block a user