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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/utils/index.ts
+4
-4
src/views/mall/promotion/kefu/index.vue
+2
-2
No files found.
src/utils/index.ts
View file @
0d51ef70
...
@@ -118,7 +118,7 @@ export function toAnyString() {
...
@@ -118,7 +118,7 @@ export function toAnyString() {
/**
/**
* 根据支持的文件类型生成 accept 属性值
* 根据支持的文件类型生成 accept 属性值
*
*
* @param supportedFileTypes 支持的文件类型数组,如 ['PDF', 'DOC', 'DOCX']
* @param supportedFileTypes 支持的文件类型数组,如 ['PDF', 'DOC', 'DOCX']
* @returns 用于文件上传组件 accept 属性的字符串
* @returns 用于文件上传组件 accept 属性的字符串
*/
*/
...
@@ -503,8 +503,8 @@ export function jsonParse(str: string) {
...
@@ -503,8 +503,8 @@ export function jsonParse(str: string) {
try
{
try
{
return
JSON
.
parse
(
str
)
return
JSON
.
parse
(
str
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
`str[
${
str
}
] 不是一个 JSON 字符串`
)
console
.
warn
(
`str[
${
str
}
] 不是一个 JSON 字符串`
)
return
''
return
str
}
}
}
}
...
@@ -516,7 +516,7 @@ export function jsonParse(str: string) {
...
@@ -516,7 +516,7 @@ export function jsonParse(str: string) {
* @param end
* @param end
*/
*/
export
const
sliceName
=
(
name
:
string
,
start
:
number
,
end
:
number
)
=>
{
export
const
sliceName
=
(
name
:
string
,
start
:
number
,
end
:
number
)
=>
{
if
(
name
.
length
>
end
)
{
if
(
name
.
length
>
end
)
{
return
name
.
slice
(
start
,
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'
...
@@ -16,7 +16,6 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
import
{
getRefreshToken
}
from
'@/utils/auth'
import
{
getRefreshToken
}
from
'@/utils/auth'
import
{
useWebSocket
}
from
'@vueuse/core'
import
{
useWebSocket
}
from
'@vueuse/core'
import
{
useMallKefuStore
}
from
'@/store/modules/mall/kefu'
import
{
useMallKefuStore
}
from
'@/store/modules/mall/kefu'
import
{
jsonParse
}
from
'@/utils'
defineOptions
({
name
:
'KeFu'
})
defineOptions
({
name
:
'KeFu'
})
...
@@ -66,7 +65,8 @@ watch(
...
@@ -66,7 +65,8 @@ watch(
// 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
(
jsonParse
(
jsonMessage
.
content
))
const
message
=
JSON
.
parse
(
jsonMessage
.
content
)
kefuStore
.
updateConversationStatus
(
message
.
conversationId
)
}
}
}
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