From 128349af96a256464b4e1e60312ab86c864e3c23 Mon Sep 17 00:00:00 2001
From: hdw <hdw@192.168.7.112>
Date: 星期六, 29 十二月 2018 09:03:10 +0800
Subject: [PATCH] 关闭页面小面板的声音
---
gx_tieta/WebRoot/js/base.js | 9 +++++++--
gx_tieta/WebRoot/js/VoiceUtil.js | 14 +++++++++++---
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/gx_tieta/WebRoot/js/VoiceUtil.js b/gx_tieta/WebRoot/js/VoiceUtil.js
index 08e3a96..83f3db4 100644
--- a/gx_tieta/WebRoot/js/VoiceUtil.js
+++ b/gx_tieta/WebRoot/js/VoiceUtil.js
@@ -93,9 +93,8 @@
var voice = new Voice();
-var voiceStatus = getCookie('voice');
+var voiceStatus = checkPageVoiceStatus();
// 璁剧疆鍒濆璇煶鎾姤鐘舵��
-voiceStatus = voiceStatus=='false'?false:true;
voice.changeSpeak(voiceStatus);
voice.cancel();
@@ -113,4 +112,13 @@
}else {
voice.changeSpeak(true);
}
-});
\ No newline at end of file
+});
+
+// 鑾峰彇椤甸潰璇煶鏄惁寮�鍚�
+function checkPageVoiceStatus() {
+ var voiceStatus = getCookie('voice');
+ // 璁剧疆鍒濆璇煶鎾姤鐘舵��
+ voiceStatus = voiceStatus=='false'?false:true;
+
+ return voiceStatus;
+}
\ No newline at end of file
diff --git a/gx_tieta/WebRoot/js/base.js b/gx_tieta/WebRoot/js/base.js
index 6e0c50b..3303ef7 100644
--- a/gx_tieta/WebRoot/js/base.js
+++ b/gx_tieta/WebRoot/js/base.js
@@ -570,7 +570,7 @@
return null;
}
-function createEleWarning(num){
+function createEleWarning(num, muted){
//娓呯悊鍛婅妗�
$('body').children('#eleWarning').remove();
var __divCon=$('<div id="eleWarning"></div>'); //鍛婅瀹瑰櫒
@@ -587,6 +587,10 @@
var __divContentCon=$('<div class="warning-content"></div>'); //鍛婅鍐呭瀹瑰櫒
/* 鍛婅鐨勯煶棰�*/
var __divAudio=$('<audio autoplay="autoplay"></audio>');
+ // 鍒ゆ柇鏄惁闈欓煶
+ if(muted) {
+ __divAudio=$('<audio autoplay="autoplay" muted></audio>');
+ }
var __divSourceWav=$('<source src="sound/warnings.wav" type="audio/wav" />');
var __divSourceMp3=$('<source src="sound/warnings.mp3" type="audio/mpeg" />');
__divAudio.append(__divSourceWav);
@@ -619,7 +623,8 @@
if(model.code==1){
$('#batt_alarm_num .num').text(model.sum);
if(totalAlm_num<model.sum){
- createEleWarning(model.sum-totalAlm_num);
+ var voiceStatus = checkPageVoiceStatus();
+ createEleWarning(model.sum-totalAlm_num, !voiceStatus);
}
totalAlm_num=model.sum;
--
Gitblit v1.9.1