|
|
|
@ -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);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|