Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
00619ca6
authored
Jul 02, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】:mall 客服图片消息显示
parent
91c262fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
src/views/mall/promotion/kefu/components/KeFuChatBox.vue
+28
-2
src/views/mall/promotion/kefu/components/KeFuConversationBox.vue
+12
-4
No files found.
src/views/mall/promotion/kefu/components/KeFuChatBox.vue
View file @
00619ca6
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
alt=
"avatar"
alt=
"avatar"
/>
/>
<div
class=
"kefu-message p-10px"
>
<div
class=
"kefu-message p-10px"
>
<!-- TODO puhui999: 消息相关等后续完成后统一抽离封装 -->
<!-- 文本消息 -->
<!-- 文本消息 -->
<template
v-if=
"KeFuMessageContentTypeEnum.TEXT === item.contentType"
>
<template
v-if=
"KeFuMessageContentTypeEnum.TEXT === item.contentType"
>
<div
<div
...
@@ -38,8 +39,25 @@
...
@@ -38,8 +39,25 @@
class=
"flex items-center"
class=
"flex items-center"
></div>
></div>
</
template
>
</
template
>
<
template
v-else
>
<!-- 图片消息 -->
{{
item
.
content
}}
<
template
v-if=
"KeFuMessageContentTypeEnum.IMAGE === item.contentType"
>
<div
:class=
"[
item.senderType === UserTypeEnum.MEMBER
? `ml-10px`
: item.senderType === UserTypeEnum.ADMIN
? `mr-10px`
: ''
]"
class=
"flex items-center"
>
<el-image
:src=
"item.content"
fit=
"contain"
style=
"width: 200px; height: 200px"
@
click=
"imagePreview(item.content)"
/>
</div>
</
template
>
</
template
>
</div>
</div>
<el-avatar
<el-avatar
...
@@ -75,6 +93,7 @@ import { Emoji, replaceEmoji } from './emoji'
...
@@ -75,6 +93,7 @@ import { Emoji, replaceEmoji } from './emoji'
import
{
KeFuMessageContentTypeEnum
}
from
'./constants'
import
{
KeFuMessageContentTypeEnum
}
from
'./constants'
import
{
isEmpty
}
from
'@/utils/is'
import
{
isEmpty
}
from
'@/utils/is'
import
{
UserTypeEnum
}
from
'@/utils/constants'
import
{
UserTypeEnum
}
from
'@/utils/constants'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
defineOptions
({
name
:
'KeFuMessageBox'
})
defineOptions
({
name
:
'KeFuMessageBox'
})
const
messageTool
=
useMessage
()
const
messageTool
=
useMessage
()
...
@@ -134,6 +153,13 @@ const scrollToBottom = async () => {
...
@@ -134,6 +153,13 @@ const scrollToBottom = async () => {
scrollbarRef
.
value
!
.
setScrollTop
(
innerRef
.
value
!
.
clientHeight
)
scrollbarRef
.
value
!
.
setScrollTop
(
innerRef
.
value
!
.
clientHeight
)
}
}
/** 图预览 */
const
imagePreview
=
(
imgUrl
:
string
)
=>
{
createImageViewer
({
urlList
:
[
imgUrl
]
})
}
// TODO puhui999: 轮训相关,功能完善后移除
// TODO puhui999: 轮训相关,功能完善后移除
onBeforeUnmount
(()
=>
{
onBeforeUnmount
(()
=>
{
if
(
!
poller
.
value
)
{
if
(
!
poller
.
value
)
{
...
...
src/views/mall/promotion/kefu/components/KeFuConversationBox.vue
View file @
00619ca6
...
@@ -16,10 +16,17 @@
...
@@ -16,10 +16,17 @@
{{
formatDate
(
item
.
lastMessageTime
)
}}
{{
formatDate
(
item
.
lastMessageTime
)
}}
</span>
</span>
</div>
</div>
<div
<!-- 文本消息 -->
v-dompurify-html=
"replaceEmoji(item.lastMessageContent)"
<template
v-if=
"KeFuMessageContentTypeEnum.TEXT === item.lastMessageContentType"
>
class=
"last-message flex items-center color-[#989EA6]"
<div
></div>
v-dompurify-html=
"replaceEmoji(item.lastMessageContent)"
class=
"last-message flex items-center color-[#989EA6]"
></div>
</
template
>
<!-- 图片消息 -->
<
template
v-if=
"KeFuMessageContentTypeEnum.IMAGE === item.lastMessageContentType"
>
<div
class=
"last-message flex items-center color-[#989EA6]"
>
【图片消息】
</div>
</
template
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -30,6 +37,7 @@
...
@@ -30,6 +37,7 @@
import
{
KeFuConversationApi
,
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
import
{
KeFuConversationApi
,
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
import
{
replaceEmoji
}
from
'@/views/mall/promotion/kefu/components/emoji'
import
{
replaceEmoji
}
from
'@/views/mall/promotion/kefu/components/emoji'
import
{
formatDate
,
getNowDateTime
}
from
'@/utils/formatTime'
import
{
formatDate
,
getNowDateTime
}
from
'@/utils/formatTime'
import
{
KeFuMessageContentTypeEnum
}
from
'@/views/mall/promotion/kefu/components/constants'
defineOptions
({
name
:
'KeFuConversationBox'
})
defineOptions
({
name
:
'KeFuConversationBox'
})
const
activeConversationIndex
=
ref
(
-
1
)
// 选中的会话
const
activeConversationIndex
=
ref
(
-
1
)
// 选中的会话
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment