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
Unverified
Commit
0d51ef70
authored
Apr 01, 2025
by
芋道源码
Committed by
Gitee
Apr 01, 2025
Browse files
Options
Browse Files
Download
Plain Diff
!758 【功能完善】商城: 客服 WebSocket 消息统一 json 化
Merge pull request !758 from puhui999/dev
parents
824b0328
c79c8554
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
src/utils/index.ts
+3
-3
src/views/mall/promotion/kefu/index.vue
+2
-2
No files found.
src/utils/index.ts
View file @
0d51ef70
...
...
@@ -503,8 +503,8 @@ export function jsonParse(str: string) {
try
{
return
JSON
.
parse
(
str
)
}
catch
(
e
)
{
console
.
error
(
`str[
${
str
}
] 不是一个 JSON 字符串`
)
return
''
console
.
warn
(
`str[
${
str
}
] 不是一个 JSON 字符串`
)
return
str
}
}
...
...
@@ -516,7 +516,7 @@ export function jsonParse(str: string) {
* @param end
*/
export
const
sliceName
=
(
name
:
string
,
start
:
number
,
end
:
number
)
=>
{
export
const
sliceName
=
(
name
:
string
,
start
:
number
,
end
:
number
)
=>
{
if
(
name
.
length
>
end
)
{
return
name
.
slice
(
start
,
end
)
}
...
...
src/views/mall/promotion/kefu/index.vue
View file @
0d51ef70
...
...
@@ -16,7 +16,6 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
import
{
getRefreshToken
}
from
'@/utils/auth'
import
{
useWebSocket
}
from
'@vueuse/core'
import
{
useMallKefuStore
}
from
'@/store/modules/mall/kefu'
import
{
jsonParse
}
from
'@/utils'
defineOptions
({
name
:
'KeFu'
})
...
...
@@ -66,7 +65,8 @@ watch(
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
if
(
type
===
WebSocketMessageTypeConstants
.
KEFU_MESSAGE_ADMIN_READ
)
{
// 更新会话已读
kefuStore
.
updateConversationStatus
(
jsonParse
(
jsonMessage
.
content
))
const
message
=
JSON
.
parse
(
jsonMessage
.
content
)
kefuStore
.
updateConversationStatus
(
message
.
conversationId
)
}
}
catch
(
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