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
f9d281a8
authored
Jan 11, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
u
parent
b8db0839
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
39 deletions
components/chat-room.vue
store/index.ts
store/model.ts
xim/index.ts
components/chat-room.vue
View file @
f9d281a8
...
...
@@ -56,15 +56,9 @@
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_CLEAR_CURRENT_CHAT_MEMBERS
)
private
readonly
clearChatMembers
!
:
ChatStore
.
MUTATION_CLEAR_CURRENT_CHAT_MEMBERS
;
@
chatStore
.
State
(
ChatStore
.
STATE_CURRENT_CHAT_INPUTING
)
private
readonly
currentInputPeople
!
:
ChatStore
.
STATE_CURRENT_CHAT_INPUTING
;
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
)
private
readonly
currentChatUniplatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
;
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_IS_CHAT_MEMBER
)
private
readonly
isChatMember
!
:
ChatStore
.
STATE_CHAT_CURRENT_IS_CHAT_MEMBER
;
...
...
@@ -82,12 +76,6 @@
@
Provide
()
showReadSummary
=
true
;
@
Watch
(
"currentChatUniplatId"
)
private
whenCurrentChatIdChanged
(
newValue
:
string
,
oldValue
:
string
)
{
if
(
Number
(
oldValue
)
===
Number
(
newValue
))
return
;
this
.
clearChatMembers
();
}
private
get
getCurrentInputingPeople
()
{
return
this
.
currentInputPeople
.
map
(()
=>
""
/* this.userInfo[k].name */
)
...
...
@@ -174,6 +162,7 @@
),
300
);
this
.
$emit
(
"send"
);
}
}
</
script
>
...
...
@@ -184,7 +173,7 @@
width
:
46px
;
height
:
20px
;
line-height
:
20px
;
background
:
#22bd7a
;
background
-color
:
#22bd7a
;
font-size
:
13px
;
border-radius
:
2px
;
color
:
#ffffff
;
...
...
store/index.ts
View file @
f9d281a8
...
...
@@ -108,14 +108,16 @@ const chatType = "group";
const
allowedChatTypes
=
[
chatType
,
"notify"
];
export
const
filterActiveChats
=
(
items
:
RawChatItem
[])
=>
{
return
items
.
filter
(
return
items
.
filter
(
(
i
)
=>
!
i
.
is_finish
&&
!
i
.
is_exited
&&
!
i
.
is_remove
&&
!
i
.
is_deleted
&&
allowedChatTypes
.
includes
(
i
.
type
)
);
)
.
sort
((
x
,
y
)
=>
(
x
.
update_time
-
y
.
update_time
?
1
:
-
1
));
};
export
function
getLastMessageId
(
msgs
:
Message
[]
|
any
)
{
...
...
@@ -471,26 +473,6 @@ export default {
return
await
execute
().
then
((
d
)
=>
clearAction
(
d
));
},
async
[
ChatStore
.
ACTION_FORCE_RELOAD_CHAT_LIST
]({
commit
})
{
return
new
Promise
<
ChatType
[]
>
((
resolve
)
=>
{
Chat
.
onReady
(()
=>
{
xim
.
fetchChatList
().
then
((
data
)
=>
{
if
(
!
data
)
{
return
resolve
([]);
}
const
chatList
=
filterActiveChats
(
data
.
args
[
0
]
as
RawChatItem
[]
);
const
items
=
chatList
.
map
((
chat
)
=>
buildChatItem
(
chat
)
);
dbController
.
saveChatList
(
items
);
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
items
);
resolve
(
items
);
});
});
});
},
async
[
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
]({
state
})
{
let
items
=
await
dbController
.
getChatList
();
let
sum
=
0
;
...
...
store/model.ts
View file @
f9d281a8
...
...
@@ -252,9 +252,6 @@ export namespace ChatStore {
keyword
?:
string
)
=>
Promise
<
ChatType
[]
>
;
export
const
ACTION_FORCE_RELOAD_CHAT_LIST
=
"重新获取我的会话列表"
;
export
type
ACTION_FORCE_RELOAD_CHAT_LIST
=
()
=>
Promise
<
ChatType
[]
>
;
export
const
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
=
"重新计算未读消息数"
;
export
type
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
=
()
=>
void
;
...
...
xim/index.ts
View file @
f9d281a8
...
...
@@ -151,7 +151,7 @@ class Chat {
.
finally
(()
=>
{
this
.
registerXimEvent
();
if
(
xim
.
isConnected
())
{
resolve
(
);
setTimeout
(
resolve
,
0
);
}
else
{
reject
(
new
Error
(
`xim is not connected`
));
}
...
...
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