|
19 | 19 | class="flex mb-20px w-[100%]"
|
20 | 20 | >
|
21 | 21 | <el-avatar
|
22 |
| - v-show="item.senderType === UserTypeEnum.MEMBER" |
| 22 | + v-if="item.senderType === UserTypeEnum.MEMBER" |
23 | 23 | :src="keFuConversation.userAvatar"
|
24 | 24 | alt="avatar"
|
25 | 25 | />
|
26 | 26 | <div class="kefu-message p-10px">
|
27 |
| - <!-- TODO puhui999: 消息相关等后续完成后统一抽离封装 --> |
28 | 27 | <!-- 文本消息 -->
|
29 |
| - <template v-if="KeFuMessageContentTypeEnum.TEXT === item.contentType"> |
30 |
| - <div |
31 |
| - v-dompurify-html="replaceEmoji(item.content)" |
32 |
| - :class="[ |
33 |
| - item.senderType === UserTypeEnum.MEMBER |
34 |
| - ? `ml-10px` |
35 |
| - : item.senderType === UserTypeEnum.ADMIN |
36 |
| - ? `mr-10px` |
37 |
| - : '' |
38 |
| - ]" |
39 |
| - class="flex items-center" |
40 |
| - ></div> |
41 |
| - </template> |
| 28 | + <TextMessageItem :message="item" /> |
42 | 29 | <!-- 图片消息 -->
|
43 |
| - <template v-if="KeFuMessageContentTypeEnum.IMAGE === item.contentType"> |
44 |
| - <div |
45 |
| - :class="[ |
46 |
| - item.senderType === UserTypeEnum.MEMBER |
47 |
| - ? `ml-10px` |
48 |
| - : item.senderType === UserTypeEnum.ADMIN |
49 |
| - ? `mr-10px` |
50 |
| - : '' |
51 |
| - ]" |
52 |
| - class="flex items-center" |
53 |
| - > |
54 |
| - <el-image |
55 |
| - :src="item.content" |
56 |
| - fit="contain" |
57 |
| - style="width: 200px; height: 200px" |
58 |
| - @click="imagePreview(item.content)" |
59 |
| - /> |
60 |
| - </div> |
61 |
| - </template> |
| 30 | + <ImageMessageItem :message="item" /> |
62 | 31 | </div>
|
63 | 32 | <el-avatar
|
64 |
| - v-show="item.senderType === UserTypeEnum.ADMIN" |
| 33 | + v-if="item.senderType === UserTypeEnum.ADMIN" |
65 | 34 | :src="item.senderAvatar"
|
66 | 35 | alt="avatar"
|
67 | 36 | />
|
@@ -94,14 +63,14 @@ import { KeFuMessageApi, KeFuMessageRespVO } from '@/api/mall/promotion/kefu/mes
|
94 | 63 | import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
|
95 | 64 | import EmojiSelectPopover from './tools/EmojiSelectPopover.vue'
|
96 | 65 | import PictureSelectUpload from './tools/PictureSelectUpload.vue'
|
97 |
| -import { Emoji, useEmoji } from './tools/emoji' |
| 66 | +import TextMessageItem from './message/TextMessageItem.vue' |
| 67 | +import ImageMessageItem from './message/ImageMessageItem.vue' |
| 68 | +import { Emoji } from './tools/emoji' |
98 | 69 | import { KeFuMessageContentTypeEnum } from './tools/constants'
|
99 | 70 | import { isEmpty } from '@/utils/is'
|
100 | 71 | import { UserTypeEnum } from '@/utils/constants'
|
101 |
| -import { createImageViewer } from '@/components/ImageViewer' |
102 | 72 |
|
103 | 73 | defineOptions({ name: 'KeFuMessageBox' })
|
104 |
| -const { replaceEmoji } = useEmoji() |
105 | 74 | const messageTool = useMessage()
|
106 | 75 | const message = ref('') // 消息
|
107 | 76 | const messageList = ref<KeFuMessageRespVO[]>([]) // 消息列表
|
@@ -175,13 +144,6 @@ const scrollToBottom = async () => {
|
175 | 144 | scrollbarRef.value!.setScrollTop(innerRef.value!.clientHeight)
|
176 | 145 | }
|
177 | 146 |
|
178 |
| -/** 图预览 */ |
179 |
| -const imagePreview = (imgUrl: string) => { |
180 |
| - createImageViewer({ |
181 |
| - urlList: [imgUrl] |
182 |
| - }) |
183 |
| -} |
184 |
| -
|
185 | 147 | // TODO puhui999: 轮训相关,功能完善后移除
|
186 | 148 | onBeforeUnmount(() => {
|
187 | 149 | if (!poller.value) {
|
|
0 commit comments