Skip to content

Commit 76fdde4

Browse files
committed
# Conflicts: # src/utils/index.ts
2 parents 16a98e5 + 0d51ef7 commit 76fdde4

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/utils/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -517,22 +517,22 @@ export function jsonParse(str: string) {
517517
try {
518518
return JSON.parse(str)
519519
} catch (e) {
520-
console.log(`str[${str}] 不是一个 JSON 字符串`)
521-
return ''
520+
console.warn(`str[${str}] 不是一个 JSON 字符串`)
521+
return str
522522
}
523523
}
524524

525525
/**
526526
* 截取字符串
527527
*
528-
* @param str 字符串
529-
* @param start 开始位置
530-
* @param end 结束位置
528+
* @param name
529+
* @param start
530+
* @param end
531531
*/
532532

533-
export const subString = (str: string, start: number, end: number) => {
534-
if (str.length > end) {
535-
return str.slice(start, end)
533+
export const sliceName = (name: string, start: number, end: number) => {
534+
if (name.length > end) {
535+
return name.slice(start, end)
536536
}
537-
return str
537+
return name
538538
}

src/views/mall/promotion/kefu/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
1616
import { getRefreshToken } from '@/utils/auth'
1717
import { useWebSocket } from '@vueuse/core'
1818
import { useMallKefuStore } from '@/store/modules/mall/kefu'
19-
import { jsonParse } from '@/utils'
2019
2120
defineOptions({ name: 'KeFu' })
2221
@@ -66,7 +65,8 @@ watch(
6665
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
6766
if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ) {
6867
// 更新会话已读
69-
kefuStore.updateConversationStatus(jsonParse(jsonMessage.content))
68+
const message = JSON.parse(jsonMessage.content)
69+
kefuStore.updateConversationStatus(message.conversationId)
7070
}
7171
} catch (error) {
7272
console.error(error)

0 commit comments

Comments
 (0)