【新增】:mall 客服消息样式设计

pull/468/head
puhui999 2024-07-01 17:11:47 +08:00
parent d3b4063b94
commit 7a6f5c2db8
2 changed files with 22 additions and 17 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<el-container class="kefu"> <el-container v-if="showChatBox" class="kefu">
<el-header> <el-header>
<div class="kefu-title">{{ keFuConversation.userNickname }}</div> <div class="kefu-title">{{ keFuConversation.userNickname }}</div>
</el-header> </el-header>
@ -46,6 +46,7 @@
/> />
</div> </div>
</el-main> </el-main>
<!-- TODO puhui999: 发送下次提交完善 -->
<el-footer height="230px"> <el-footer height="230px">
<div class="h-[100%]"> <div class="h-[100%]">
<div class="chat-tools"> <div class="chat-tools">
@ -58,7 +59,7 @@
</div> </div>
</el-footer> </el-footer>
</el-container> </el-container>
<!-- 没选择左侧会话时显示空界面 --> <el-empty v-else description="请选择左侧的一个会话后开始" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -67,6 +68,7 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
import { UserTypeEnum } from '@/utils/constants' import { UserTypeEnum } from '@/utils/constants'
import { replaceEmoji } from '@/views/mall/promotion/kefu/components/emoji' import { replaceEmoji } from '@/views/mall/promotion/kefu/components/emoji'
import { KeFuMessageContentTypeEnum } from '@/views/mall/promotion/kefu/components/constants' import { KeFuMessageContentTypeEnum } from '@/views/mall/promotion/kefu/components/constants'
import { isEmpty } from '@/utils/is'
defineOptions({ name: 'KeFuMessageBox' }) defineOptions({ name: 'KeFuMessageBox' })
const message = ref('') // const message = ref('') //
@ -82,6 +84,8 @@ const getMessageList = async (conversation: KeFuConversationRespVO) => {
messageList.value = list messageList.value = list
} }
defineExpose({ getMessageList }) defineExpose({ getMessageList })
//
const showChatBox = computed(() => !isEmpty(keFuConversation.value))
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -7,19 +7,21 @@
class="kefu-conversation flex justify-between items-center" class="kefu-conversation flex justify-between items-center"
@click="openRightMessage(item, index)" @click="openRightMessage(item, index)"
> >
<div class="kefu-conversation-left flex justify-center items-center"> <div class="flex justify-center items-center w-100%">
<el-avatar :src="item.userAvatar" alt="avatar" /> <el-avatar :src="item.userAvatar" alt="avatar" />
<div class="ml-10px"> <div class="ml-10px w-100%">
<div class="nickname">{{ item.userNickname }}</div> <div class="flex justify-between items-center w-100%">
<span>{{ item.userNickname }}</span>
<span class="color-[#989EA6]">
{{ formatDate(item.lastMessageTime) }}
</span>
</div>
<div <div
v-dompurify-html="replaceEmoji(item.lastMessageContent)" v-dompurify-html="replaceEmoji(item.lastMessageContent)"
class="last-message flex items-center color-[#989EA6]" class="last-message flex items-center color-[#989EA6]"
></div> ></div>
</div> </div>
</div> </div>
<div class="kefu-conversation-right color-[#989EA6]">
{{ formatDate(item.lastMessageTime) }}
</div>
</div> </div>
</div> </div>
</template> </template>
@ -30,7 +32,7 @@ import { replaceEmoji } from '@/views/mall/promotion/kefu/components/emoji'
import { formatDate, getNowDateTime } from '@/utils/formatTime' import { formatDate, getNowDateTime } from '@/utils/formatTime'
defineOptions({ name: 'KeFuConversationBox' }) defineOptions({ name: 'KeFuConversationBox' })
const activeConversationIndex = ref(0) // const activeConversationIndex = ref(-1) //
const conversationList = ref<KeFuConversationRespVO[]>([]) // const conversationList = ref<KeFuConversationRespVO[]>([]) //
const getConversationList = async () => { const getConversationList = async () => {
conversationList.value = await KeFuConversationApi.getConversationList() conversationList.value = await KeFuConversationApi.getConversationList()
@ -43,7 +45,8 @@ const getConversationList = async () => {
'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKMezSxtOImrC9lbhwHiazYwck3xwrEcO7VJfG6WQo260whaeVNoByE5RreiaGsGfOMlIiaDhSaA991w/132', 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKMezSxtOImrC9lbhwHiazYwck3xwrEcO7VJfG6WQo260whaeVNoByE5RreiaGsGfOMlIiaDhSaA991w/132',
userNickname: '辉辉鸭' + i, userNickname: '辉辉鸭' + i,
lastMessageTime: getNowDateTime(), lastMessageTime: getNowDateTime(),
lastMessageContent: '[爱心][爱心]你好哇', lastMessageContent:
'[爱心][爱心]你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇你好哇',
lastMessageContentType: 1, lastMessageContentType: 1,
adminPinned: false, adminPinned: false,
userDeleted: false, userDeleted: false,
@ -71,13 +74,11 @@ const openRightMessage = (item: KeFuConversationRespVO, index: number) => {
background-color: #fff; background-color: #fff;
transition: border-left 0.05s ease-in-out; /* 设置过渡效果 */ transition: border-left 0.05s ease-in-out; /* 设置过渡效果 */
&-left { .last-message {
.last-message { width: 200px;
width: 300px; overflow: hidden; //
overflow: hidden; // white-space: nowrap; //
white-space: nowrap; // text-overflow: ellipsis; //
text-overflow: ellipsis; //
}
} }
} }