Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
52f58fa8
authored
Jan 10, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
整合已读逻辑
parent
9db323f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
store/index.ts
store/index.ts
View file @
52f58fa8
...
@@ -32,7 +32,7 @@ function uniqueMessages(
...
@@ -32,7 +32,7 @@ function uniqueMessages(
messages
:
NonNullable
<
ChatStore
.
STATE_CHAT_MSG_HISTORY
>
messages
:
NonNullable
<
ChatStore
.
STATE_CHAT_MSG_HISTORY
>
)
{
)
{
const
arr
=
[...
messages
];
const
arr
=
[...
messages
];
return
unique
(
arr
,
function
(
item
,
all
)
{
return
unique
(
arr
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
id
===
item
.
id
);
return
all
.
findIndex
((
k
)
=>
k
.
id
===
item
.
id
);
});
});
}
}
...
@@ -230,8 +230,8 @@ export default {
...
@@ -230,8 +230,8 @@ export default {
);
);
const
withdraw
=
hasWithdraw
const
withdraw
=
hasWithdraw
?
newItems
?
newItems
.
filter
((
i
)
=>
i
.
type
===
MessageType
.
Withdraw
)
.
filter
((
i
)
=>
i
.
type
===
MessageType
.
Withdraw
)
.
map
((
i
)
=>
+
i
.
msg
)
.
map
((
i
)
=>
+
i
.
msg
)
:
[];
:
[];
const
filterout
=
withdraw
.
length
const
filterout
=
withdraw
.
length
?
newItems
.
filter
((
i
)
=>
!
withdraw
.
includes
(
i
.
id
))
?
newItems
.
filter
((
i
)
=>
!
withdraw
.
includes
(
i
.
id
))
...
@@ -374,7 +374,7 @@ export default {
...
@@ -374,7 +374,7 @@ export default {
state
[
ChatStore
.
STATE_CHAT_SENDING_MESSAGES
]
=
[...
current
];
state
[
ChatStore
.
STATE_CHAT_SENDING_MESSAGES
]
=
[...
current
];
}
}
},
},
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
const
setTimeoutId
:
{
[
key
:
string
]:
number
}
=
{};
const
setTimeoutId
:
{
[
key
:
string
]:
number
}
=
{};
return
(
return
(
state
:
ChatStoreState
,
state
:
ChatStoreState
,
...
@@ -588,7 +588,14 @@ export default {
...
@@ -588,7 +588,14 @@ export default {
.
updateChat4UnreadCount
(
p
.
chat
,
p
.
unread
)
.
updateChat4UnreadCount
(
p
.
chat
,
p
.
unread
)
.
then
(()
=>
.
then
(()
=>
dispatch
(
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
)
dispatch
(
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
)
);
).
finally
(()
=>
{
if
(
!
p
.
unread
)
{
const
messages
=
state
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
];
if
(
messages
&&
messages
.
length
)
{
xim
.
setRead
(
p
.
chat
,
messages
[
0
].
id
,
messages
[
messages
.
length
-
1
].
id
);
}
}
});
},
},
async
[
ChatStore
.
ACTION_GET_CHAT_MESSAGES
]({
state
,
commit
,
getters
})
{
async
[
ChatStore
.
ACTION_GET_CHAT_MESSAGES
]({
state
,
commit
,
getters
})
{
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
...
@@ -974,7 +981,7 @@ export default {
...
@@ -974,7 +981,7 @@ export default {
commit
(
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_MEMBERS
,
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_MEMBERS
,
unique
(
newChatMembers
,
function
(
item
,
all
)
{
unique
(
newChatMembers
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
eid
===
item
.
eid
);
return
all
.
findIndex
((
k
)
=>
k
.
eid
===
item
.
eid
);
})
})
);
);
...
@@ -1231,8 +1238,8 @@ export default {
...
@@ -1231,8 +1238,8 @@ export default {
p
.
read_count
=
option
.
all
p
.
read_count
=
option
.
all
?
p
.
total_read_count
?
p
.
total_read_count
:
option
.
readed
:
option
.
readed
?
option
.
readed
?
option
.
readed
:
p
.
read_count
+
1
;
:
p
.
read_count
+
1
;
}
}
}
}
}
else
{
}
else
{
...
@@ -1241,8 +1248,8 @@ export default {
...
@@ -1241,8 +1248,8 @@ export default {
p
.
read_count
=
option
.
all
p
.
read_count
=
option
.
all
?
p
.
total_read_count
?
p
.
total_read_count
:
option
.
readed
:
option
.
readed
?
option
.
readed
?
option
.
readed
:
p
.
read_count
+
1
;
:
p
.
read_count
+
1
;
}
}
}
}
}
}
...
...
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