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
445768a5
authored
Jan 06, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
2bf2b2d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
20 deletions
store/index.ts
xim/xim.ts
store/index.ts
View file @
445768a5
...
...
@@ -225,12 +225,17 @@ export default {
if
(
chatid
)
{
// 移除撤回的消息
const
newItems
=
data
||
[];
const
withdraw
=
newItems
.
filter
((
i
)
=>
i
.
type
===
MessageType
.
Withdraw
)
.
map
((
i
)
=>
+
i
.
msg
);
const
filterout
=
newItems
.
filter
(
(
i
)
=>
!
withdraw
.
includes
(
i
.
id
)
const
hasWithdraw
=
newItems
.
find
(
(
i
)
=>
i
.
type
===
MessageType
.
Withdraw
);
const
withdraw
=
hasWithdraw
?
newItems
.
filter
((
i
)
=>
i
.
type
===
MessageType
.
Withdraw
)
.
map
((
i
)
=>
+
i
.
msg
)
:
[];
const
filterout
=
withdraw
.
length
?
newItems
.
filter
((
i
)
=>
!
withdraw
.
includes
(
i
.
id
))
:
newItems
;
state
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
]
=
Object
.
freeze
(
filterMessages
([...
old
,
...
filterout
],
chatid
)
);
...
...
@@ -610,16 +615,11 @@ export default {
data
=
await
getMessages
();
}
try
{
commit
(
ChatStore
.
MUTATION_PUSH_CHAT_MSG_HISTORY
,
data
);
dbController
.
saveChatMessages
(
chatId
,
data
);
await
preCacheImgs
(
data
);
commit
(
ChatStore
.
MUTATION_SCROLL_TO_BOTTOM
);
return
data
;
}
catch
(
error
)
{
// eslint-disable-next-line no-console
console
.
error
(
error
);
}
commit
(
ChatStore
.
MUTATION_PUSH_CHAT_MSG_HISTORY
,
data
);
dbController
.
saveChatMessages
(
chatId
,
data
);
await
preCacheImgs
(
data
);
commit
(
ChatStore
.
MUTATION_SCROLL_TO_BOTTOM
);
return
data
;
},
async
[
ChatStore
.
ACTION_GET_CHAT_MESSAGES_BEFORE_SPECIFIC_ID
](
{
state
,
commit
,
getters
},
...
...
xim/xim.ts
View file @
445768a5
...
...
@@ -196,8 +196,12 @@ export class Xim {
.
getSdk
()
.
getAxios
()
.
get
<
any
,
Message
[]
>
(
`/general/xim/model/
${
p
.
model
}
/
${
p
.
obj
}
/msgs?lid=
${
lid
}
&rid=
${
rid
}
&limit=
${
limit
}
&desc=
${
desc
?
1
:
0
}
`
)
`/general/xim/model/
${
p
.
model
}
/
${
p
.
obj
}
/msgs?lid=
${
lid
}
&rid=
${
rid
}
&limit=
${
limit
}
&desc=
${
desc
?
1
:
0
}
`
);
}
private
setMessagesRead
(
chatId
:
number
,
msg
:
Message
[])
{
...
...
@@ -432,9 +436,12 @@ export class Xim {
vue
.
$once
(
"hook:beforeDestroy"
,
()
=>
this
.
off
(
"msg"
,
action
));
}
public
withDrawMsgHandle
(
e
:
Message
)
{
const
ids
=
e
.
ref_id
?
[
e
.
ref_id
]
:
e
.
msg
.
startsWith
(
"["
)
?
JSON
.
parse
(
e
.
msg
)
:
[
+
e
.
msg
];
return
ids
;
public
withDrawMsgHandle
(
e
:
Message
):
number
[]
{
return
e
.
ref_id
?
[
e
.
ref_id
]
:
e
.
msg
.
startsWith
(
"["
)
?
JSON
.
parse
(
e
.
msg
)
:
[
+
e
.
msg
];
}
}
...
...
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