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) {
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}
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
1616import { getRefreshToken } from ' @/utils/auth'
1717import { useWebSocket } from ' @vueuse/core'
1818import { useMallKefuStore } from ' @/store/modules/mall/kefu'
19- import { jsonParse } from ' @/utils'
2019
2120defineOptions ({ name: ' KeFu' })
2221
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 )
You can’t perform that action at this time.
0 commit comments