| | |
| | | <div class="dialog-footer"> |
| | | <el-button @click="centerDialogVisible = false">取消</el-button> |
| | | <el-button @click="test">测试播报</el-button> |
| | | <el-button @click="playAlarm">测试报警</el-button> |
| | | <el-button @click="toggleAlarm">测试报警</el-button> |
| | | <el-button type="primary" @click="saveSet"> 确认 </el-button> |
| | | <el-button type="success" @click="shuaxin"> 刷新 </el-button> |
| | | </div> |
| | |
| | | // 创建 Audio 对象,指向 public 目录下的音频文件 |
| | | const alarmSound = new Audio(alertbaojin) |
| | | |
| | | // 播放报警声的方法 |
| | | const playAlarm = () => { |
| | | alarmSound.currentTime = 0 // 重置到开头,以便可以重复播放 |
| | | alarmSound.play().catch((err) => { |
| | | console.error('播放失败:', err) |
| | | }) |
| | | // 控制播放状态的变量 |
| | | const isPlaying = ref(false) |
| | | // 切换播放/暂停的方法 |
| | | const toggleAlarm = () => { |
| | | if (isPlaying.value) { |
| | | alarmSound.pause() |
| | | } else { |
| | | alarmSound.currentTime = 0 // 从头开始播放 |
| | | alarmSound.play().catch((err) => { |
| | | console.error('播放失败:', err) |
| | | }) |
| | | } |
| | | isPlaying.value = !isPlaying.value |
| | | } |
| | | // 语音播报 |
| | | import Speech from "speak-tts"; |
| | |
| | | if(centerDialogVisible3.value===false){ |
| | | centerDialogVisible3.value = true; |
| | | 关闭弹框警告(); |
| | | 播报警告文本(倒计时告警文本.value); |
| | | // 播报警告文本(倒计时告警文本.value); |
| | | toggleAlarm() |
| | | } |
| | | |
| | | }else{ |
| | |
| | | const 数据初始化 = ref(false); |
| | | //创建链接对象 |
| | | const creatSource = () => { |
| | | // http://testbs.ihemodialysis.com/sse/sseEvent |
| | | // const test='http://testbs.ihemodialysis.com/sse/sseEvent/' |
| | | // const test = "https://backend.ihemodialysis.com/sse/sseEvent/"; |
| | | const test = "http://10.36.2.146:8069/sse/sseEvent/"; |
| | | 数据初始化.value = true; |
| | | const test = "https://backend.ihemodialysis.com/sse/sseEvent/"; |
| | | |
| | | const stateArr = [ |
| | | { key: 0, value: "正在链接中" }, |
| | | { key: 1, value: "已经链接并且可以通讯" }, |
| | |
| | | 倒计时告警文本.value = dataBody.倒计时?.提醒文本; |
| | | 关闭弹框警告(); |
| | | 播报警告文本(倒计时告警文本.value); |
| | | toggleAlarm() |
| | | } else if (倒计时.value <= -60) { |
| | | centerDialogVisible3.value = false; |
| | | } |
| | |
| | | setTimeout(function () { |
| | | console.log("30秒已过,关闭报警设置弹框。"); |
| | | centerDialogVisible3.value = false; |
| | | toggleAlarm() |
| | | 倒计时.value=-100 |
| | | }, 30000); // 30000 毫秒 = 30 秒 |
| | | }; |