var timerWarnSound =null;
//播放告警音频
function playSound(obj){
if($(obj).val()!='2'){
$(obj).html('');
$(obj).val('2');
$(obj).attr('title','当前已开启页面告警声音提示,点击可关闭');
timerWarnSound = setInterval(function(){ajaxWarnInfoCount()},60000);
}else{
$(obj).val('1');
$(obj).attr('title','当前已关闭页面告警声音提示,点击可开启');
$(obj).html('');
clearInterval(timerWarnSound);
timerWarnSound=null;
}
}
function ajaxWarnInfoCount() {
var urlParams = window.location.search;
var dashView = "";
if (urlParams.indexOf("dashView") != -1) {
dashView = "?dashView=1";
}
$.ajax({
url: "/tssw/warnInfo/warnCountAjax"+dashView,
type: "GET",
dataType: "json",
success: function(data) {
if(data != '0'){
document.getElementById("notification").play();
toastr.error("有新的告警消息,请查看推送通知或点击查看日志");
}
}
});
}