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
Commit
8b0778ca
authored
Nov 09, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码评审】商城:在线客服
parent
e4b57bd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
src/store/modules/mall/kefu.ts
+10
-4
No files found.
src/store/modules/mall/kefu.ts
View file @
8b0778ca
...
@@ -23,12 +23,13 @@ export const useMallKefuStore = defineStore('mall-kefu', {
...
@@ -23,12 +23,13 @@ export const useMallKefuStore = defineStore('mall-kefu', {
}
}
},
},
actions
:
{
actions
:
{
//======================= 会话消息相关 =======================
//
======================= 会话消息相关 =======================
/** 缓存历史消息 */
/** 缓存历史消息 */
saveMessageList
(
conversationId
:
number
,
messageList
:
KeFuMessageRespVO
[])
{
saveMessageList
(
conversationId
:
number
,
messageList
:
KeFuMessageRespVO
[])
{
this
.
conversationMessageList
.
set
(
conversationId
,
messageList
)
this
.
conversationMessageList
.
set
(
conversationId
,
messageList
)
},
},
//======================= 会话相关 =======================
// ======================= 会话相关 =======================
/** 加载会话缓存列表 */
/** 加载会话缓存列表 */
async
setConversationList
()
{
async
setConversationList
()
{
this
.
conversationList
=
await
KeFuConversationApi
.
getConversationList
()
this
.
conversationList
=
await
KeFuConversationApi
.
getConversationList
()
...
@@ -62,11 +63,16 @@ export const useMallKefuStore = defineStore('mall-kefu', {
...
@@ -62,11 +63,16 @@ export const useMallKefuStore = defineStore('mall-kefu', {
}
}
},
},
conversationSort
()
{
conversationSort
()
{
// TODO @puhui999:1)逻辑上,先按照置顶、再按照最后消息时间;2)感觉写的有一丢丢小复杂,发给大模型,看看有没可能简化哈。
this
.
conversationList
.
sort
((
obj1
,
obj2
)
=>
{
this
.
conversationList
.
sort
((
obj1
,
obj2
)
=>
{
// 如果 obj1.adminPinned 为 true,obj2.adminPinned 为 false,obj1 应该排在前面
// 如果 obj1.adminPinned 为 true,obj2.adminPinned 为 false,obj1 应该排在前面
if
(
obj1
.
adminPinned
&&
!
obj2
.
adminPinned
)
return
-
1
if
(
obj1
.
adminPinned
&&
!
obj2
.
adminPinned
)
{
return
-
1
}
// 如果 obj1.adminPinned 为 false,obj2.adminPinned 为 true,obj2 应该排在前面
// 如果 obj1.adminPinned 为 false,obj2.adminPinned 为 true,obj2 应该排在前面
if
(
!
obj1
.
adminPinned
&&
obj2
.
adminPinned
)
return
1
if
(
!
obj1
.
adminPinned
&&
obj2
.
adminPinned
)
{
return
1
}
// 如果 obj1.adminPinned 和 obj2.adminPinned 都为 true,比较 adminUnreadMessageCount 的值
// 如果 obj1.adminPinned 和 obj2.adminPinned 都为 true,比较 adminUnreadMessageCount 的值
if
(
obj1
.
adminPinned
&&
obj2
.
adminPinned
)
{
if
(
obj1
.
adminPinned
&&
obj2
.
adminPinned
)
{
...
...
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