From 66524cf5df4259aac50e0279f605040e6b25cdff Mon Sep 17 00:00:00 2001 From: "@0Melon0" <576788380@qq.com> Date: Thu, 11 Jul 2024 17:39:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BC=98=E5=8C=96=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 2 +- src/views/waitList/index.vue | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 3e38e77..bd94be5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,7 +7,7 @@ const routes = [ { path: '/', name: 'home', - redirect: '/waitList', + redirect: '/monitor', }, { path: '/pageBox', diff --git a/src/views/waitList/index.vue b/src/views/waitList/index.vue index c516ca3..fc4aa94 100644 --- a/src/views/waitList/index.vue +++ b/src/views/waitList/index.vue @@ -100,6 +100,7 @@ export default { popupMsgList: [], showPopup: false, hasPlay: false, + playNum: 0, popupMag: [], popupTimer: null, synth: window.speechSynthesis, @@ -184,6 +185,8 @@ export default { if (frame.body) { let data = JSON.parse(frame.body); this.popupMsgList.push(data['msg'].replaceAll(',', ',')); + this.popupMsgList.push(data['msg'].replaceAll(',', ',')); + this.popupMsgList.push(data['msg'].replaceAll(',', ',')); } } catch (e) { console.log(e); @@ -202,6 +205,7 @@ export default { this.hasPlay = true; this.popupMag = this.popupMsgList[0].replace(/[,,]/g, '').split('#'); this.showPopup = true; + this.playNum++; if (this.synth) { const utterance = new SpeechSynthesisUtterance([this.popupMsgList[0]].join('')); utterance.rate = 0.4; @@ -215,10 +219,15 @@ export default { // 添加 onend 事件处理器 utterance.onend = function () { - this.popupMag = []; - this.showPopup = false; - this.hasPlay = false; - this.popupMsgList.shift(); + setTimeout(() => { + if (this.playNum >= 3) { + this.popupMag = []; + this.showPopup = false; + this.playNum = 0; + } + this.hasPlay = false; + this.popupMsgList.shift(); + }, 1000); }.bind(this); this.synth.speak(utterance); @@ -256,6 +265,8 @@ export default { // setTimeout(() => { // this.popupMsgList.push('请,金尧仙,的家属#到,手术室门口接病人'); + // this.popupMsgList.push('请,金尧仙,的家属#到,手术室门口接病人'); + // this.popupMsgList.push('请,金尧仙,的家属#到,手术室门口接病人'); // }, 3000); }); },