|
|
|
|
@ -6,6 +6,7 @@ |
|
|
|
|
<div class="avue-header"> |
|
|
|
|
<!-- 顶部导航栏 --> |
|
|
|
|
<top ref="top"/> |
|
|
|
|
<button @click="getAlarmInfo">点击按钮</button> |
|
|
|
|
</div> |
|
|
|
|
<div class="avue-layout"> |
|
|
|
|
<div class="avue-left"> |
|
|
|
|
@ -75,20 +76,19 @@ |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.init(); |
|
|
|
|
this.getAlarmInfo() |
|
|
|
|
if(!window.sessionStorage.getItem("click")){ |
|
|
|
|
this.$alert('请允许系统提示报警声音', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
callback: action => { |
|
|
|
|
window.sessionStorage.setItem("click", 1) |
|
|
|
|
// 添加socket通知监听 |
|
|
|
|
// window.addEventListener('onmessageWS', this.getSocketData); |
|
|
|
|
this.timer = setInterval(() =>{ |
|
|
|
|
this.getSocketData('222') |
|
|
|
|
},3000) |
|
|
|
|
setTimeout(() =>{ |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
},6200) |
|
|
|
|
window.addEventListener('onmessageWS', this.getSocketData); |
|
|
|
|
// this.timer = setInterval(() =>{ |
|
|
|
|
// this.getSocketData('222') |
|
|
|
|
// },3000) |
|
|
|
|
// setTimeout(() =>{ |
|
|
|
|
// clearInterval(this.timer) |
|
|
|
|
// },6200) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
@ -99,13 +99,13 @@ |
|
|
|
|
callback: action => { |
|
|
|
|
window.sessionStorage.setItem("click", 1) |
|
|
|
|
// 添加socket通知监听 |
|
|
|
|
// window.addEventListener('onmessageWS', this.getSocketData); |
|
|
|
|
this.timer = setInterval(() =>{ |
|
|
|
|
this.getSocketData('222') |
|
|
|
|
},3000) |
|
|
|
|
setTimeout(() =>{ |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
},9200) |
|
|
|
|
window.addEventListener('onmessageWS', this.getSocketData); |
|
|
|
|
// this.timer = setInterval(() =>{ |
|
|
|
|
// this.getSocketData('222') |
|
|
|
|
// },3000) |
|
|
|
|
// setTimeout(() =>{ |
|
|
|
|
// clearInterval(this.timer) |
|
|
|
|
// },9200) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
@ -123,31 +123,7 @@ |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
getSocketData(res) { |
|
|
|
|
this.times++; |
|
|
|
|
let dom = document.querySelector('#play_audio') |
|
|
|
|
console.log('dom ===>',dom) |
|
|
|
|
dom.pause() |
|
|
|
|
if(this.times > 0){ |
|
|
|
|
if(dom.readyState == 4){ |
|
|
|
|
for(let i = 0;i<=this.times;i++){ |
|
|
|
|
setTimeout(() =>{ |
|
|
|
|
this.start++; |
|
|
|
|
this.isMuted = false, |
|
|
|
|
this.isPlay = true |
|
|
|
|
dom.play() |
|
|
|
|
},2500 * i) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$notify({ |
|
|
|
|
title: '警告', |
|
|
|
|
message: res, |
|
|
|
|
type: 'warning' |
|
|
|
|
}) |
|
|
|
|
// if (res.detail.data === 'success' || res.detail.data === '连接成功' || res.detail.data === 'heartBath') return |
|
|
|
|
// // ...业务处理 |
|
|
|
|
// let obj = res.detail.data.indexOf('{') > -1 ? JSON.parse(res.detail.data) : null; |
|
|
|
|
// this.times++; |
|
|
|
|
// this.times++; |
|
|
|
|
// let dom = document.querySelector('#play_audio') |
|
|
|
|
// console.log('dom ===>',dom) |
|
|
|
|
// dom.pause() |
|
|
|
|
@ -163,13 +139,37 @@ |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// if (obj) { |
|
|
|
|
// this.$notify({ |
|
|
|
|
// title: '警告', |
|
|
|
|
// message: obj.buildId + '号楼' + obj.floorNo + '层发生报警:' + obj.content, |
|
|
|
|
// this.$notify({ |
|
|
|
|
// title: '警告', |
|
|
|
|
// message: res, |
|
|
|
|
// type: 'warning' |
|
|
|
|
// }); |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
if (res.detail.data === 'success' || res.detail.data === '连接成功' || res.detail.data === 'heartBath') return |
|
|
|
|
// ...业务处理 |
|
|
|
|
let obj = res.detail.data.indexOf('{') > -1 ? JSON.parse(res.detail.data) : null; |
|
|
|
|
this.times++; |
|
|
|
|
let dom = document.querySelector('#play_audio') |
|
|
|
|
console.log('dom ===>',dom) |
|
|
|
|
dom.pause() |
|
|
|
|
if(this.times > 0){ |
|
|
|
|
if(dom.readyState == 4){ |
|
|
|
|
for(let i = 0;i<=this.times;i++){ |
|
|
|
|
setTimeout(() =>{ |
|
|
|
|
this.start++; |
|
|
|
|
this.isMuted = false, |
|
|
|
|
this.isPlay = true |
|
|
|
|
dom.play() |
|
|
|
|
},2500 * i) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (obj) { |
|
|
|
|
this.$notify({ |
|
|
|
|
title: '警告', |
|
|
|
|
message: obj.buildId + '号楼' + obj.floorNo + '层发生报警:' + obj.content, |
|
|
|
|
type: 'warning' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
showCollapse() { |
|
|
|
|
this.$store.commit("SET_COLLAPSE"); |
|
|
|
|
|