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
a07362f4
authored
Aug 17, 2021
by
吴云建
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
会话优化
parent
a18fd1f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
29 deletions
components/chat-list-model.vue
components/chat-list.vue
store/index.ts
components/chat-list-model.vue
View file @
a07362f4
...
...
@@ -168,13 +168,17 @@ export default class ModelChatList extends Vue {
await
this
.
getList
();
this
.
setSource
(
ChatStore
.
StateChatSourceDirection
.
Server
);
this
.
scrollbar
.
update
();
this
.
$onBeforeDestroy
(
await
this
.
sdk
.
model
(
"UniplatChat"
).
registerOnChange
(
this
.
onTransportMessage
)
)
await
this
.
sdk
.
model
(
"UniplatChat"
).
registerOnChange
(
this
.
onTransportMessage
);
await
this
.
sdk
.
model
(
"general_order"
).
registerOnChange
(
this
.
onTransportMessage
);
}
onTransportMessage
(
e
:
any
)
{
let
index
=
e
.
dataUpdates
.
findIndex
(
it
=>
it
.
action
===
"startChat"
||
it
.
action
===
"csExitChat"
||
it
.
action
===
"finishChat"
);
let
index
=
e
.
dataUpdates
.
findIndex
(
it
=>
it
.
action
===
"startChat"
||
it
.
action
===
"createChat"
||
it
.
action
===
"csExitChat"
||
it
.
action
===
"finishChat"
||
it
.
action
===
"delete"
&&
it
.
model
===
"general_order"
);
if
(
index
>
-
1
)
{
this
.
refreshListDebounce
();
}
...
...
components/chat-list.vue
View file @
a07362f4
...
...
@@ -10,10 +10,8 @@
:class=
"
{ selected: isSelected(item) }"
@click="goToChatRoom(item)"
>
<div
class=
"chat-avatar pos-rel"
:class=
"
{ 'red-dot': item.unread_msg_count > 0 }"
>
<div
class=
"red-dot"
v-if=
"item.unread_msg_count > 0"
>
{{
item
.
unread_msg_count
}}
</div>
<div
class=
"chat-info"
>
<div
...
...
@@ -115,7 +113,11 @@ export default class ChatList extends Vue {
private
get
chatRooms
()
{
const
list
=
this
.
chatList
?.
list
.
filter
(
chat
=>
chat
.
title
.
indexOf
(
this
.
searchKeyword
)
>
-
1
)
||
[];
this
.
unReadMsgCount
=
list
.
filter
(
chat
=>
chat
.
unread_msg_count
>
0
).
length
;
let
unReadMsgCount
=
0
;
list
.
filter
(
chat
=>
chat
.
unread_msg_count
>
0
).
forEach
(
chat
=>
{
unReadMsgCount
+=
chat
.
unread_msg_count
})
this
.
unReadMsgCount
=
unReadMsgCount
;
this
.
$emit
(
"list-count-update"
,
this
.
unReadMsgCount
);
this
.
$eventHub
.
$emit
(
EVENTS
.
NewMsg
,
this
.
unReadMsgCount
);
return
list
;
...
...
@@ -223,6 +225,7 @@ export default class ChatList extends Vue {
}
.chat-list
{
.chat-item
{
position
:
relative
;
cursor
:
pointer
;
padding
:
4px
15px
10px
;
border-bottom
:
1px
solid
#eee
;
...
...
@@ -233,24 +236,19 @@ export default class ChatList extends Vue {
&
.selected
{
background
:
#f0f0f0
;
}
.chat-avatar
{
display
:
inline-block
;
vertical-align
:
middle
;
width
:
0
;
height
:
0
;
margin-right
:
5px
;
&.
red-dot
::
before
{
content
:
""
;
position
:
absolute
;
width
:
8px
;
height
:
8px
;
background
:
#e87005
;
border-radius
:
50%
;
z-index
:
1
;
right
:
0px
;
top
:
-4px
;
}
.red-dot
{
position
:
absolute
;
min-width
:
14px
;
height
:
14px
;
line-height
:
14px
;
padding
:
0
2px
;
background
:
#e87005
;
border-radius
:
7px
;
z-index
:
1
;
right
:
10px
;
bottom
:
10px
;
font-size
:
12px
;
color
:
#fff
;
}
.chat-info
{
display
:
inline-block
;
...
...
store/index.ts
View file @
a07362f4
...
...
@@ -568,10 +568,10 @@ export default {
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_UNIPLAT_ID
,
info
.
uniplatId
);
commit
(
ChatStore
.
MUTATION_INITING_CHAT
);
removeRegisterChatEvents
.
forEach
((
k
)
=>
k
());
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
)
await
Promise
.
all
([
dispatch
(
ChatStore
.
ACTION_REGISTER_EVENT
),
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MESSAGES
),
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
),
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MESSAGES
)
]);
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_TITLE
,
wantedChatRoom
.
title
||
chatId
);
commit
(
ChatStore
.
MUTATION_INITING_CHAT_DONE
);
...
...
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