diff --git a/src/utils/msb-im.js b/src/utils/msb-im.js index d72e5fe..2bec60b 100644 --- a/src/utils/msb-im.js +++ b/src/utils/msb-im.js @@ -2,12 +2,13 @@ * @Author: ch * @Date: 2022-05-18 14:54:47 * @LastEditors: ch - * @LastEditTime: 2022-06-10 10:10:21 + * @LastEditTime: 2022-06-10 19:15:46 * @Description: file content */ import '@/utils/poto-req'; import '@/utils/proto-rsp'; import { CreateUUID, ToAsyncAwait } from '@/utils/utils'; + const connect = Symbol('connect'); const send = Symbol('send'); const onMessage = Symbol('onMessage'); @@ -363,6 +364,9 @@ class MsbIm { createTimeStamp: new Date().getTime(), sendStatus: 'loading', }; + if (typeof msgCtx.payload === 'string') { + msgCtx.payload = JSON.parse(msgCtx.payload); + } // 点发送,立即把消息加入消息列表,标记为发送中状态 curSession.messageList.push(msgCtx); // 超过时间未返回视为发送失败 @@ -453,6 +457,3 @@ class MsbIm { } } export default MsbIm; -// export default (app) => { -// app.config.globalProperties.$im = MsbIm; -// }; diff --git a/src/views/chat/message.vue b/src/views/chat/message.vue index 56e80d3..1d38efd 100644 --- a/src/views/chat/message.vue +++ b/src/views/chat/message.vue @@ -111,7 +111,7 @@ }, }); const messageType = computed(() => store.state.chat.messageType); - const content = computed(() => store.getters['im/parseContent'](props.message.payload)); + const content = computed(() => store.getters['im/parseContent']({ ...props.message.payload })); const handleProduct = (id) => { router.push({ name: 'UpdateProduct',