转发消息缺少提示音

This commit is contained in:
bob
2025-05-18 15:04:10 +08:00
parent 5c0b255092
commit 88bc4f3efb
2 changed files with 21 additions and 8 deletions

View File

@@ -3,22 +3,31 @@ import msgSend from '@/assets/audio/msgsend.mp3'
import { useUserStore } from '@/stores'
const userData = useUserStore()
let playMsgReceiveTimer
export const playMsgReceive = () => {
if (!userData.user.newMsgTips) {
return
}
const audio = new Audio(msgReceive)
audio.play().catch(() => {
// do nothing
})
clearTimeout(playMsgReceiveTimer)
playMsgReceiveTimer = setTimeout(() => {
const audio = new Audio(msgReceive)
audio.play().catch(() => {
// do nothing
})
}, 300)
}
let playMsgSendTimer
export const playMsgSend = () => {
if (!userData.user.sendMsgTips) {
return
}
const audio = new Audio(msgSend)
audio.play().catch(() => {
// do nothing
})
clearTimeout(playMsgSendTimer)
playMsgSendTimer = setTimeout(() => {
const audio = new Audio(msgSend)
audio.play().catch(() => {
// do nothing
})
}, 300)
}

View File

@@ -673,6 +673,10 @@ const handleSendForwardMsg = async ({ session, content, contentType }) => {
const after = (msgId) => {
messageData.updateMsg(msg.sessionId, msg.msgId, { msgId, status: msgSendStatus.OK })
if (!messageData.sessionList[msg.sessionId].dnd) {
playMsgSend()
}
}
wsConnect.sendMsg(
msg.sessionId,