diff --git a/src/store/modules/chat/chat.js b/src/store/modules/chat/chat.js index c32a560..73a66a4 100644 --- a/src/store/modules/chat/chat.js +++ b/src/store/modules/chat/chat.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-06-07 15:41:05 * @LastEditors: ch - * @LastEditTime: 2022-06-13 17:16:27 + * @LastEditTime: 2022-06-14 14:59:41 * @Description: file content */ import * as api from '@/api/chat'; @@ -48,21 +48,29 @@ const getters = { } else if (type === 5) { payload = '[撤回消息]'; } else if (type === 6 || type === 1) { - try { - // payload = JSON.parse(payload.value); - if ('text' in payload) { - payload = payload.text; - } else if ('linkJump' in payload) { - payload = '[超链接]'; - } else if ('orderNo' in payload) { - payload = '[订单信息]'; - } else if ('productImageUrl' in payload) { - payload = '[商品信息]'; - } else { - payload = '[未知数据]'; + if (payload.customType === 'transferWaiterSession') { + let str = `${payload.fromNickname}将会话转移给了---${payload.toNickname}`; + if (payload.reason) { + str += `,并留言:${payload.reason}`; + } + payload = str; + } else { + try { + // payload = JSON.parse(payload.value); + if ('text' in payload) { + payload = payload.text; + } else if ('linkJump' in payload) { + payload = '[超链接]'; + } else if ('orderNo' in payload) { + payload = '[订单信息]'; + } else if ('productImageUrl' in payload) { + payload = '[商品信息]'; + } else { + payload = '[未知数据]'; + } + } catch (e) { + payload = '[解析异常]'; } - } catch (e) { - payload = '[解析异常]'; } } else if (type === 7) { payload = payload.text; @@ -104,19 +112,23 @@ const getters = { }, parseContent: () => { return (payload) => { - try { - // payload = JSON.parse(payload); - if ('linkJump' in payload) { - payload.type = 'link'; - } else if ('orderNo' in payload) { - payload.type = 'order'; - } else if ('productImageUrl' in payload) { - payload.type = 'product'; - } else { - payload = '[未知消息]'; + if (payload.customType === 'transferWaiterSession') { + payload.type = 'transferWaiterSession'; + } else { + try { + // payload = JSON.parse(payload); + if ('linkJump' in payload) { + payload.type = 'link'; + } else if ('orderNo' in payload) { + payload.type = 'order'; + } else if ('productImageUrl' in payload) { + payload.type = 'product'; + } else { + payload = '[未知消息]'; + } + } catch (e) { + payload = '[解析异常]'; } - } catch (e) { - payload = '[解析异常]'; } return payload; }; diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index e7f7e4d..eeda704 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -394,6 +394,7 @@ display: flex; border: 1px solid #ebeef5; .aside { + width: 240px; border-right: 1px solid #ebeef5; .aside-header { height: 60px; diff --git a/src/views/chat/message.vue b/src/views/chat/message.vue index d9a03eb..b60ec27 100644 --- a/src/views/chat/message.vue +++ b/src/views/chat/message.vue @@ -3,97 +3,113 @@ class="message-item" :class="{ [`--${messageType[props.message.type]}`]: true, + '--notify': messageType[props.message.type] === 'custom' && content.type === 'transferWaiterSession', '--self': props.message.fromId !== props.session.fromId, }" > -
- -
-
-
- {{ props.message.fromNickname }} +