diff --git a/src/views/mall/promotion/kefu/components/KeFuChatBox.vue b/src/views/mall/promotion/kefu/components/KeFuChatBox.vue index e675d51d..cba5869b 100644 --- a/src/views/mall/promotion/kefu/components/KeFuChatBox.vue +++ b/src/views/mall/promotion/kefu/components/KeFuChatBox.vue @@ -71,10 +71,14 @@
-
+
+
- +
发送
@@ -88,9 +92,10 @@ import { ElScrollbar as ElScrollbarType } from 'element-plus' import { KeFuMessageApi, KeFuMessageRespVO } from '@/api/mall/promotion/kefu/message' import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation' -import EmojiSelectPopover from './EmojiSelectPopover.vue' -import { Emoji, useEmoji } from './emoji' -import { KeFuMessageContentTypeEnum } from './constants' +import EmojiSelectPopover from './tools/EmojiSelectPopover.vue' +import PictureSelectUpload from './tools/PictureSelectUpload.vue' +import { Emoji, useEmoji } from './tools/emoji' +import { KeFuMessageContentTypeEnum } from './tools/constants' import { isEmpty } from '@/utils/is' import { UserTypeEnum } from '@/utils/constants' import { createImageViewer } from '@/components/ImageViewer' @@ -126,6 +131,16 @@ const showChatBox = computed(() => !isEmpty(keFuConversation.value)) const handleEmojiSelect = (item: Emoji) => { message.value += item.name } +// 处理图片发送 +const handleSendPicture = async (picUrl: string) => { + // 组织发送消息 + const msg = { + conversationId: keFuConversation.value.id, + contentType: KeFuMessageContentTypeEnum.IMAGE, + content: picUrl + } + await sendMessage(msg) +} // 发送消息 const handleSendMessage = async () => { // 1. 校验消息是否为空 @@ -139,6 +154,11 @@ const handleSendMessage = async () => { contentType: KeFuMessageContentTypeEnum.TEXT, content: message.value } + await sendMessage(msg) +} + +// 发送消息 【共用】 +const sendMessage = async (msg: any) => { await KeFuMessageApi.sendKeFuMessage(msg) message.value = '' // 3. 加载消息列表 @@ -248,9 +268,8 @@ onBeforeUnmount(() => { .chat-tools { width: 100%; border: #e4e0e0 solid 1px; + border-radius: 10px; height: 44px; - display: flex; - align-items: center; } ::v-deep(textarea) { diff --git a/src/views/mall/promotion/kefu/components/KeFuConversationBox.vue b/src/views/mall/promotion/kefu/components/KeFuConversationBox.vue index 75b4ad08..d45343ad 100644 --- a/src/views/mall/promotion/kefu/components/KeFuConversationBox.vue +++ b/src/views/mall/promotion/kefu/components/KeFuConversationBox.vue @@ -35,9 +35,9 @@ + + diff --git a/src/views/mall/promotion/kefu/components/constants.ts b/src/views/mall/promotion/kefu/components/tools/constants.ts similarity index 100% rename from src/views/mall/promotion/kefu/components/constants.ts rename to src/views/mall/promotion/kefu/components/tools/constants.ts diff --git a/src/views/mall/promotion/kefu/components/emoji.ts b/src/views/mall/promotion/kefu/components/tools/emoji.ts similarity index 100% rename from src/views/mall/promotion/kefu/components/emoji.ts rename to src/views/mall/promotion/kefu/components/tools/emoji.ts