| | |
| | | const listWaiting = ref<CallingVO[]>([]) // 列表的数据 |
| | | const listPassed = ref<CallingVO[]>([]) // |
| | | |
| | | let curSpeakPat : CallingVO | undefined = undefined; |
| | | |
| | | const getList = async () => { |
| | | const data = await ScreenApi.getBigScreenData() |
| | | listReady.value = data[1] |
| | |
| | | |
| | | const startScrolling = () => { |
| | | setInterval(() => { |
| | | // console.info("...") |
| | | getList(); |
| | | }, 3000); // 每两秒滚动一次 |
| | | console.info("..." + curSpeakPat) |
| | | if ( curSpeakPat === undefined ) { |
| | | const queuePat = getNextSpeak() |
| | | if (queuePat !== undefined) { |
| | | console.info("...2" + queuePat) |
| | | curSpeakPat = queuePat |
| | | speak(queuePat.patName + queuePat.roomName); |
| | | } else { |
| | | console.info("...3" ) |
| | | curSpeakPat = undefined |
| | | } |
| | | } |
| | | }, 10000); // 每X秒滚动一次 |
| | | } |
| | | |
| | | const getNextSpeak = () => { |
| | | if (curSpeakPat === undefined || curSpeakPat === null) { |
| | | return listReady.value.find( item => item.status === 30 && item.called === 0) |
| | | } else { |
| | | return listReady.value.find( item => item.status === 30 && item.called === 0 && item.seqNum > curSpeakPat!.seqNum) |
| | | } |
| | | } |
| | | |
| | | onMounted( () => { |
| | | startScrolling() |
| | | }) |
| | | |
| | | const onSpeachEndEvent = async (event) => { |
| | | console.log("Speech ended 3" + event); |
| | | await ScreenApi.markCalled(curSpeakPat!.patId) |
| | | const queuePat = getNextSpeak() |
| | | if (queuePat !== undefined) { |
| | | curSpeakPat = queuePat |
| | | speak(queuePat.patName + queuePat.roomName); |
| | | } else { |
| | | curSpeakPat = undefined |
| | | } |
| | | } |
| | | |
| | | const speak = (msg) => { |
| | | //const msg = new SpeechSynthesisUtterance(`请${this.currentNumber}号就诊`); |
| | | const repeatNum = 3 |
| | | var speech = new SpeechSynthesisUtterance() |
| | | speech.text = msg |
| | | speech.pitch = 1 // 获取并设置话语的音调(0-2 默认1,值越大越尖锐,越低越低沉) |
| | |
| | | speech.volume = 100 // 获取并设置说话的音量 |
| | | speech.lang = 'zh-CN' // 设置播放语言 |
| | | |
| | | utterance.onend = function() { |
| | | console.log("Speech ended"); |
| | | }; |
| | | |
| | | // 增加控制播放次数 |
| | | let count = 1 |
| | | speech.onend = onSpeachEndEvent |
| | | speechSynthesis.speak(speech) |
| | | while (count < repeatNum) { |
| | | speechSynthesis.speak(speech) |
| | | count++ |
| | | } |
| | | } |
| | | |
| | | </script> |
| | |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-main> |
| | | <el-footer> |
| | | <el-footer height="100px"> |
| | | <el-table |
| | | :data="listPassed" |
| | | stripe |