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
b9e15296
authored
Nov 10, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能完善】商城: 客服消息JSON 化
parent
649c24ed
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
17 deletions
+21
-17
src/views/mall/promotion/kefu/components/KeFuConversationList.vue
+4
-3
src/views/mall/promotion/kefu/components/KeFuMessageList.vue
+6
-5
src/views/mall/promotion/kefu/components/message/OrderItem.vue
+10
-7
src/views/mall/promotion/kefu/index.vue
+1
-2
No files found.
src/views/mall/promotion/kefu/components/KeFuConversationList.vue
View file @
b9e15296
<
template
>
<
template
>
<el-aside
class=
"kefu p-5px h-100%"
width=
"260px"
>
<el-aside
class=
"kefu p-5px h-100%"
width=
"260px"
>
<div
class=
"color-[#999] font-bold my-10px"
<div
class=
"color-[#999] font-bold my-10px"
>
>
会话记录(
{{
kefuStore
.
getConversationList
.
length
}}
)
会话记录(
{{
kefuStore
.
getConversationList
.
length
}}
)
</div>
</div>
<div
<div
v-for=
"item in kefuStore.getConversationList"
v-for=
"item in kefuStore.getConversationList"
...
@@ -78,6 +78,7 @@ import { formatPast } from '@/utils/formatTime'
...
@@ -78,6 +78,7 @@ import { formatPast } from '@/utils/formatTime'
import
{
KeFuMessageContentTypeEnum
}
from
'./tools/constants'
import
{
KeFuMessageContentTypeEnum
}
from
'./tools/constants'
import
{
useAppStore
}
from
'@/store/modules/app'
import
{
useAppStore
}
from
'@/store/modules/app'
import
{
useMallKefuStore
}
from
'@/store/modules/mall/kefu'
import
{
useMallKefuStore
}
from
'@/store/modules/mall/kefu'
import
{
jsonParse
}
from
'@/utils'
defineOptions
({
name
:
'KeFuConversationList'
})
defineOptions
({
name
:
'KeFuConversationList'
})
...
@@ -118,7 +119,7 @@ const getConversationDisplayText = computed(
...
@@ -118,7 +119,7 @@ const getConversationDisplayText = computed(
case
KeFuMessageContentTypeEnum
.
VOICE
:
case
KeFuMessageContentTypeEnum
.
VOICE
:
return
'[语音消息]'
return
'[语音消息]'
case
KeFuMessageContentTypeEnum
.
TEXT
:
case
KeFuMessageContentTypeEnum
.
TEXT
:
return
replaceEmoji
(
lastMessageContent
)
return
replaceEmoji
(
jsonParse
(
lastMessageContent
).
text
||
lastMessageContent
)
default
:
default
:
return
''
return
''
}
}
...
...
src/views/mall/promotion/kefu/components/KeFuMessageList.vue
View file @
b9e15296
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
<MessageItem
:message=
"item"
>
<MessageItem
:message=
"item"
>
<template
v-if=
"KeFuMessageContentTypeEnum.TEXT === item.contentType"
>
<template
v-if=
"KeFuMessageContentTypeEnum.TEXT === item.contentType"
>
<div
<div
v-dompurify-html=
"replaceEmoji(item.content)"
v-dompurify-html=
"replaceEmoji(
getMessageContent(item).text ||
item.content)"
class=
"flex items-center"
class=
"flex items-center"
></div>
></div>
</
template
>
</
template
>
...
@@ -62,8 +62,8 @@
...
@@ -62,8 +62,8 @@
<el-image
<el-image
v-if=
"KeFuMessageContentTypeEnum.IMAGE === item.contentType"
v-if=
"KeFuMessageContentTypeEnum.IMAGE === item.contentType"
:initial-index=
"0"
:initial-index=
"0"
:preview-src-list=
"[item.content]"
:preview-src-list=
"[
getMessageContent(item).picUrl ||
item.content]"
:src=
"item.content"
:src=
"
getMessageContent(item).picUrl ||
item.content"
class=
"w-200px"
class=
"w-200px"
fit=
"contain"
fit=
"contain"
preview-teleported
preview-teleported
...
@@ -244,6 +244,7 @@ const getNewMessageList = async (val: KeFuConversationRespVO) => {
...
@@ -244,6 +244,7 @@ const getNewMessageList = async (val: KeFuConversationRespVO) => {
total
.
value
=
messageList
.
value
.
length
||
0
total
.
value
=
messageList
.
value
.
length
||
0
loadHistory
.
value
=
false
loadHistory
.
value
=
false
refreshContent
.
value
=
false
refreshContent
.
value
=
false
skipGetMessageList
.
value
=
false
// 2.2 设置会话相关属性
// 2.2 设置会话相关属性
conversation
.
value
=
val
conversation
.
value
=
val
queryParams
.
conversationId
=
val
.
id
queryParams
.
conversationId
=
val
.
id
...
@@ -267,7 +268,7 @@ const handleSendPicture = async (picUrl: string) => {
...
@@ -267,7 +268,7 @@ const handleSendPicture = async (picUrl: string) => {
const
msg
=
{
const
msg
=
{
conversationId
:
conversation
.
value
.
id
,
conversationId
:
conversation
.
value
.
id
,
contentType
:
KeFuMessageContentTypeEnum
.
IMAGE
,
contentType
:
KeFuMessageContentTypeEnum
.
IMAGE
,
content
:
picUrl
content
:
JSON
.
stringify
({
picUrl
})
}
}
await
sendMessage
(
msg
)
await
sendMessage
(
msg
)
}
}
...
@@ -287,7 +288,7 @@ const handleSendMessage = async (event: any) => {
...
@@ -287,7 +288,7 @@ const handleSendMessage = async (event: any) => {
const
msg
=
{
const
msg
=
{
conversationId
:
conversation
.
value
.
id
,
conversationId
:
conversation
.
value
.
id
,
contentType
:
KeFuMessageContentTypeEnum
.
TEXT
,
contentType
:
KeFuMessageContentTypeEnum
.
TEXT
,
content
:
message
.
value
content
:
JSON
.
stringify
({
text
:
message
.
value
})
}
}
await
sendMessage
(
msg
)
await
sendMessage
(
msg
)
}
}
...
...
src/views/mall/promotion/kefu/components/message/OrderItem.vue
View file @
b9e15296
...
@@ -14,11 +14,11 @@
...
@@ -14,11 +14,11 @@
</div>
</div>
<div
v-for=
"item in getMessageContent.items"
:key=
"item.id"
class=
"border-bottom"
>
<div
v-for=
"item in getMessageContent.items"
:key=
"item.id"
class=
"border-bottom"
>
<ProductItem
<ProductItem
:spu-id=
"item.spuId"
:num=
"item.count"
:num=
"item.count"
:picUrl=
"item.picUrl"
:picUrl=
"item.picUrl"
:price=
"item.price"
:price=
"item.price"
:skuText=
"item.properties.map((property: any) => property.valueName).join(' ')"
:skuText=
"item.properties.map((property: any) => property.valueName).join(' ')"
:spu-id=
"item.spuId"
:title=
"item.spuName"
:title=
"item.spuName"
/>
/>
</div>
</div>
...
@@ -112,14 +112,14 @@ function formatOrderStatus(order: any) {
...
@@ -112,14 +112,14 @@ function formatOrderStatus(order: any) {
border-radius
:
10px
;
border-radius
:
10px
;
padding
:
10px
;
padding
:
10px
;
border
:
1px
var
(
--el-border-color
)
solid
;
border
:
1px
var
(
--el-border-color
)
solid
;
background-color
:
var
(
--app-content-bg-color
);
background-color
:
rgba
(
128
,
128
,
128
,
0.5
);
//
透明色,暗黑模式下也能体现
.order-card-header
{
.order-card-header
{
height
:
28px
;
height
:
28px
;
font-weight
:
bold
;
.order-no
{
.order-no
{
font-size
:
12px
;
font-size
:
13px
;
font-weight
:
500
;
span
{
span
{
&:hover
{
&:hover
{
...
@@ -128,27 +128,30 @@ function formatOrderStatus(order: any) {
...
@@ -128,27 +128,30 @@ function formatOrderStatus(order: any) {
}
}
}
}
}
}
.order-state
{
font-size
:
13px
;
}
}
}
.pay-box
{
.pay-box
{
padding-top
:
10px
;
padding-top
:
10px
;
color
:
#fff
;
font-weight
:
bold
;
.discounts-title
{
.discounts-title
{
font-size
:
16px
;
font-size
:
16px
;
line-height
:
normal
;
line-height
:
normal
;
color
:
#999999
;
}
}
.discounts-money
{
.discounts-money
{
font-size
:
16px
;
font-size
:
16px
;
line-height
:
normal
;
line-height
:
normal
;
color
:
#999
;
font-family
:
OPPOSANS
;
font-family
:
OPPOSANS
;
}
}
.pay-color
{
.pay-color
{
font-size
:
13px
;
font-size
:
13px
;
color
:
var
(
--left-menu-text-color
);
}
}
}
}
}
}
...
...
src/views/mall/promotion/kefu/index.vue
View file @
b9e15296
...
@@ -57,7 +57,6 @@ watchEffect(() => {
...
@@ -57,7 +57,6 @@ watchEffect(() => {
if
(
type
===
WebSocketMessageTypeConstants
.
KEFU_MESSAGE_TYPE
)
{
if
(
type
===
WebSocketMessageTypeConstants
.
KEFU_MESSAGE_TYPE
)
{
const
message
=
JSON
.
parse
(
jsonMessage
.
content
)
const
message
=
JSON
.
parse
(
jsonMessage
.
content
)
// 刷新会话列表
// 刷新会话列表
// TODO @puhui999:不应该刷新列表,而是根据消息,本地 update 列表的数据;
kefuStore
.
updateConversation
(
message
.
conversationId
)
kefuStore
.
updateConversation
(
message
.
conversationId
)
// 刷新消息列表
// 刷新消息列表
keFuChatBoxRef
.
value
?.
refreshMessageList
(
message
)
keFuChatBoxRef
.
value
?.
refreshMessageList
(
message
)
...
@@ -66,7 +65,7 @@ watchEffect(() => {
...
@@ -66,7 +65,7 @@ watchEffect(() => {
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
if
(
type
===
WebSocketMessageTypeConstants
.
KEFU_MESSAGE_ADMIN_READ
)
{
if
(
type
===
WebSocketMessageTypeConstants
.
KEFU_MESSAGE_ADMIN_READ
)
{
// 更新会话已读
// 更新会话已读
kefuStore
.
updateConversationStatus
(
JSON
.
parse
(
jsonMessage
.
content
)
?.
id
)
kefuStore
.
updateConversationStatus
(
JSON
.
parse
(
jsonMessage
.
content
))
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
error
)
console
.
error
(
error
)
...
...
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