From 1d08de208c93dba281f39cbbc59bdc336841a3e4 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 15 十月 2024 16:33:45 +0800
Subject: [PATCH] 大屏..小屏 叫号

---
 src/views/ecg/callingscreen/roomscreen.vue |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/views/ecg/callingscreen/roomscreen.vue b/src/views/ecg/callingscreen/roomscreen.vue
index be6335e..b57a18a 100644
--- a/src/views/ecg/callingscreen/roomscreen.vue
+++ b/src/views/ecg/callingscreen/roomscreen.vue
@@ -4,11 +4,14 @@
 import {RoomApi} from "@/api/ecg/room";
 import {ScreenQueueVO, ScreenApi} from "@/api/ecg/screen";
 import {DICT_TYPE} from "@/utils/dict";
+import {CallApi, CallVO} from "@/api/ecg/call";
 
 defineOptions({ name: 'roomscreen' })
 
 const list = ref<ScreenQueueVO[]>([]) // 鍒楄〃鐨勬暟鎹�
 const listPassed = ref<ScreenQueueVO[]>([]) // 杩囧彿鍒楄〃鐨勬暟鎹�
+
+let curSpeakPat : CallVO | null = null;
 
 const roomBed = ref<RoomBedVO>({
   roomId : null,
@@ -31,6 +34,9 @@
   setInterval(() => {
     // console.info("...")
     getList()
+    if ( curSpeakPat === null ) {
+      initiateSpeak()
+    }
   }, 3000); // 姣忎袱绉掓粴鍔ㄤ竴娆�
 }
 
@@ -49,6 +55,34 @@
   }
 }
 
+const onSpeachEndEvent = async (event) => {
+  console.log("Speech ended... " + event.currentTarget.text);
+  curSpeakPat!.called = 1
+  await CallApi.updateCall(curSpeakPat!)
+  initiateSpeak()
+}
+
+const initiateSpeak = async () => {
+  curSpeakPat = await CallApi.getNextInstallCall()
+  console.info( curSpeakPat )
+  if (curSpeakPat !== null) {
+    speak("璇枫��" + curSpeakPat.patName + "鍒�" + curSpeakPat.roomName + "瑁呮満");
+  }
+}
+
+const speak = (msg) => {
+  console.info("speak " + msg);
+  var speech = new SpeechSynthesisUtterance()
+  speech.text = msg + "銆傘�傘��" + msg + "銆傘�傘��" + msg  + "銆傘�傘��"
+  speech.pitch = 1 // 鑾峰彇骞惰缃瘽璇殑闊宠皟(0-2 榛樿1锛屽�艰秺澶ц秺灏栭攼,瓒婁綆瓒婁綆娌�)
+  speech.rate = 0.9 // 鑾峰彇骞惰缃璇濈殑閫熷害(0.1-10 榛樿1锛屽�艰秺澶ц閫熻秺蹇�,瓒婂皬璇�熻秺鎱�)
+  speech.volume = 100 // 鑾峰彇骞惰缃璇濈殑闊抽噺
+  speech.lang = 'zh-CN' // 璁剧疆鎾斁璇█
+
+  speech.onend = onSpeachEndEvent
+  speechSynthesis.speak(speech)
+}
+
 onMounted( () => {
   getRoomByIp()
   startScrolling()

--
Gitblit v1.9.3