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
57bf14e5
authored
Jan 25, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
7e385edb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
store/index.ts
store/index.ts
View file @
57bf14e5
...
@@ -645,14 +645,14 @@ export default {
...
@@ -645,14 +645,14 @@ export default {
state
,
state
,
getters
,
getters
,
})
{
})
{
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
const
onNewMsg
=
(
e
:
Message
)
=>
{
const
onNewMsg
=
(
e
:
Message
)
=>
{
// 这里再取一次当前chatId避免数据和当前不一致
const
current
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
const
thenAction
=
()
=>
{
const
thenAction
=
()
=>
{
if
(
if
(
e
.
type
===
MessageType
.
Withdraw
&&
e
.
type
===
MessageType
.
Withdraw
&&
// 这里再取一次当前chatId避免数据和当前不一致
e
.
chat_id
===
current
e
.
chat_id
===
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
]
)
{
)
{
commit
(
commit
(
ChatStore
.
MUTATION_WITHDRAW
,
ChatStore
.
MUTATION_WITHDRAW
,
...
@@ -661,7 +661,7 @@ export default {
...
@@ -661,7 +661,7 @@ export default {
}
}
const
scroll
=
()
=>
const
scroll
=
()
=>
state
[
ChatStore
.
STATE_FUNC_ON_NEW_MSG
](
e
);
state
[
ChatStore
.
STATE_FUNC_ON_NEW_MSG
](
e
);
if
(
e
.
chat_id
===
c
hatId
)
{
if
(
e
.
chat_id
===
c
urrent
)
{
dispatch
(
ChatStore
.
ACTION_GET_FRESH_MESSAGE
).
finally
(
dispatch
(
ChatStore
.
ACTION_GET_FRESH_MESSAGE
).
finally
(
()
=>
scroll
()
()
=>
scroll
()
);
);
...
@@ -669,7 +669,7 @@ export default {
...
@@ -669,7 +669,7 @@ export default {
scroll
();
scroll
();
}
}
};
};
if
(
e
.
type
===
MessageType
.
Withdraw
)
{
if
(
e
.
type
===
MessageType
.
Withdraw
&&
current
)
{
dbController
dbController
.
removeMessage
(
e
.
chat_id
,
xim
.
withDrawMsgHandle
(
e
))
.
removeMessage
(
e
.
chat_id
,
xim
.
withDrawMsgHandle
(
e
))
.
finally
(()
=>
thenAction
());
.
finally
(()
=>
thenAction
());
...
@@ -677,6 +677,7 @@ export default {
...
@@ -677,6 +677,7 @@ export default {
thenAction
();
thenAction
();
}
}
};
};
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
if
(
!
chatId
)
{
if
(
!
chatId
)
{
xim
.
off
(
"msg"
,
onNewMsg
);
xim
.
off
(
"msg"
,
onNewMsg
);
xim
.
on
(
"msg"
,
onNewMsg
);
xim
.
on
(
"msg"
,
onNewMsg
);
...
...
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