mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-08 08:22:41 +08:00
Merge branch 'dev' of https://gitee.com/yudaocode/yudao-ui-admin-vue3
# Conflicts: # src/utils/index.ts
This commit is contained in:
commit
76fdde43b2
@ -517,22 +517,22 @@ export function jsonParse(str: string) {
|
||||
try {
|
||||
return JSON.parse(str)
|
||||
} catch (e) {
|
||||
console.log(`str[${str}] 不是一个 JSON 字符串`)
|
||||
return ''
|
||||
console.warn(`str[${str}] 不是一个 JSON 字符串`)
|
||||
return str
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param start 开始位置
|
||||
* @param end 结束位置
|
||||
* @param name
|
||||
* @param start
|
||||
* @param end
|
||||
*/
|
||||
|
||||
export const subString = (str: string, start: number, end: number) => {
|
||||
if (str.length > end) {
|
||||
return str.slice(start, end)
|
||||
export const sliceName = (name: string, start: number, end: number) => {
|
||||
if (name.length > end) {
|
||||
return name.slice(start, end)
|
||||
}
|
||||
return str
|
||||
return name
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user