mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-08 16:32:43 +08:00
!758 【功能完善】商城: 客服 WebSocket 消息统一 json 化
Merge pull request !758 from puhui999/dev
This commit is contained in:
commit
0d51ef707a
@ -503,8 +503,8 @@ export function jsonParse(str: string) {
|
|||||||
try {
|
try {
|
||||||
return JSON.parse(str)
|
return JSON.parse(str)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`str[${str}] 不是一个 JSON 字符串`)
|
console.warn(`str[${str}] 不是一个 JSON 字符串`)
|
||||||
return ''
|
return str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
|
|||||||
import { getRefreshToken } from '@/utils/auth'
|
import { getRefreshToken } from '@/utils/auth'
|
||||||
import { useWebSocket } from '@vueuse/core'
|
import { useWebSocket } from '@vueuse/core'
|
||||||
import { useMallKefuStore } from '@/store/modules/mall/kefu'
|
import { useMallKefuStore } from '@/store/modules/mall/kefu'
|
||||||
import { jsonParse } from '@/utils'
|
|
||||||
|
|
||||||
defineOptions({ name: 'KeFu' })
|
defineOptions({ name: 'KeFu' })
|
||||||
|
|
||||||
@ -66,7 +65,8 @@ watch(
|
|||||||
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
|
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
|
||||||
if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ) {
|
if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ) {
|
||||||
// 更新会话已读
|
// 更新会话已读
|
||||||
kefuStore.updateConversationStatus(jsonParse(jsonMessage.content))
|
const message = JSON.parse(jsonMessage.content)
|
||||||
|
kefuStore.updateConversationStatus(message.conversationId)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user