|
@@ -113,6 +113,11 @@ export const sendMsg = (data: any) => {
|
|
websocket.send(data)
|
|
websocket.send(data)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const playSound = () => {
|
|
|
|
+ const audio = new Audio('src/assets/audio/tip.mp3')
|
|
|
|
+ audio.play()
|
|
|
|
+}
|
|
|
|
+
|
|
// socket 接收数据
|
|
// socket 接收数据
|
|
export const websocketOnmessage = () => {
|
|
export const websocketOnmessage = () => {
|
|
websocket.onmessage = function (e: any) {
|
|
websocket.onmessage = function (e: any) {
|
|
@@ -137,6 +142,7 @@ export const websocketOnmessage = () => {
|
|
type: 'success',
|
|
type: 'success',
|
|
duration: 3000
|
|
duration: 3000
|
|
})
|
|
})
|
|
|
|
+ playSound()
|
|
return e.data
|
|
return e.data
|
|
}
|
|
}
|
|
}
|
|
}
|