Kaynağa Gözat

提交测试

lvhao 13 saat önce
ebeveyn
işleme
168628aaf9
1 değiştirilmiş dosya ile 17 ekleme ve 0 silme
  1. 17 0
      template/erp/printcode_yz.html

+ 17 - 0
template/erp/printcode_yz.html

@@ -5,6 +5,10 @@
 <div class="numberprint">
 <ul class="searchtop search" style="text-align: center;padding: 10px 0;margin-top:80px;">
 <li style="height: 56px;line-height: 56px;"><input value="" name="transferout" id="transferout" placeholder="点此处扫码" type="text" style="width:500px;height: 50px;line-height: 50px;"></li></ul>
+<div>
+    <textarea id="yybo"></textarea>
+    <button onclick="playVoice()">语音播报</button>
+</div>
 </div>
 </div>
 </div>
@@ -77,6 +81,19 @@ $(".systemwindow").hide();
 						$("#transferout").val("");
                         $("#transferout").focus();
 });
+
+
+function playVoice(){
+    let bbnr = $("#yybo").val();
+    if (!bbnr) return;
+    if ('speechSynthesis' in window) {
+        var utterance = new SpeechSynthesisUtterance(bbnr);
+        utterance.lang = 'zh-CN';
+        utterance.rate = 1;
+        window.speechSynthesis.cancel();
+        window.speechSynthesis.speak(utterance);
+    }
+}
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>
 {Template footer}