单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
chenyc
2025-06-19 43eda7e0ebca2130d5714dcf4005530a2824b3f1
gx报警测试
1个文件已修改
1个文件已添加
13 ■■■■■ 已修改文件
src/assets/alert.wav 补丁 | 查看 | 原始文档 | blame | 历史
src/views/deviceWindoes2.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/alert.wav
Binary files differ
src/views/deviceWindoes2.vue
@@ -1532,6 +1532,7 @@
        <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 type="primary" @click="saveSet"> 确认 </el-button>
          <el-button type="success" @click="shuaxin"> 刷新 </el-button>
        </div>
@@ -1664,6 +1665,8 @@
import cljd from "../img/cljd.png";
import tizhong from "../img/tizhong.png";
import { EventSourcePolyfill } from "event-source-polyfill";
import alertbaojin from '../assets/alert.wav'
import {
  computed,
  getCurrentInstance,
@@ -1678,6 +1681,16 @@
import * as echarts from "echarts";
import { jgTime4 } from "../utils/formatTime";
import { setTimeoutAlert } from "../utils/httpApi";
// 创建 Audio 对象,指向 public 目录下的音频文件
const alarmSound = new Audio(alertbaojin)
// 播放报警声的方法
const playAlarm = () => {
  alarmSound.currentTime = 0 // 重置到开头,以便可以重复播放
  alarmSound.play().catch((err) => {
    console.error('播放失败:', err)
  })
}
// 语音播报
import Speech from "speak-tts";
const speech = ref(null);