叫号语音播放

This commit is contained in:
duan
2024-10-22 14:27:35 +08:00
parent bc3929a32e
commit 9c2ce903b2

View File

@@ -103,6 +103,8 @@ border: 1px solid rgba(255,255,255,0.28);" @click="dialogConfirm(3)">过号</el-
<script>
import { callTable, callTablequeue, callTableput, callTabletakeNumber, callTablecall } from '@/api/shop'
const synth = window.speechSynthesis;
const msg = new SpeechSynthesisUtterance()
export default {
data() {
return {
@@ -151,7 +153,27 @@ export default {
}
},
handleSpeak(text) {
msg.text = text; // 文字内容: 小朋友,你是否有很多问号
msg.lang = "zh-CN"; // 使用的语言:中文
msg.volume = 3; // 声音音量1
msg.rate = 1; // 语速1
msg.pitch = 1; // 音高1
synth.speak(msg); // 播放
},
// // 语音停止
// handleStop(e) {
// msg.text = e;
// msg.lang = "zh-CN";
// synth.cancel(msg);
// },
async profilepicture(d) {
this.handleSpeak(d.callNum)
let res = await callTablecall({
shopId: localStorage.getItem('shopId'),
callQueueId: d.id