File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
views/mall/promotion/kefu Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -517,22 +517,22 @@ export function jsonParse(str: string) {
517
517
try {
518
518
return JSON . parse ( str )
519
519
} catch ( e ) {
520
- console . log ( `str[${ str } ] 不是一个 JSON 字符串` )
521
- return ''
520
+ console . warn ( `str[${ str } ] 不是一个 JSON 字符串` )
521
+ return str
522
522
}
523
523
}
524
524
525
525
/**
526
526
* 截取字符串
527
527
*
528
- * @param str 字符串
529
- * @param start 开始位置
530
- * @param end 结束位置
528
+ * @param name
529
+ * @param start
530
+ * @param end
531
531
*/
532
532
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 )
536
536
}
537
- return str
537
+ return name
538
538
}
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
16
16
import { getRefreshToken } from ' @/utils/auth'
17
17
import { useWebSocket } from ' @vueuse/core'
18
18
import { useMallKefuStore } from ' @/store/modules/mall/kefu'
19
- import { jsonParse } from ' @/utils'
20
19
21
20
defineOptions ({ name: ' KeFu' })
22
21
66
65
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
67
66
if (type === WebSocketMessageTypeConstants .KEFU_MESSAGE_ADMIN_READ ) {
68
67
// 更新会话已读
69
- kefuStore .updateConversationStatus (jsonParse (jsonMessage .content ))
68
+ const message = JSON .parse (jsonMessage .content )
69
+ kefuStore .updateConversationStatus (message .conversationId )
70
70
}
71
71
} catch (error ) {
72
72
console .error (error )
You can’t perform that action at this time.
0 commit comments