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
10cc168f
authored
Aug 11, 2021
by
吴云建
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加消息事件触发
parent
bfa8ee43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
components/chat-list-model.vue
components/chat-list.vue
components/chat-list-model.vue
View file @
10cc168f
...
...
@@ -3,6 +3,7 @@
<div
class=
"chat-list h-100"
>
<div
class=
"chat-list-scroll"
>
<el-scrollbar
ref=
"scrollbar"
class=
"list-scroll no-bottom-scrollbar"
>
<div
v-if=
"needUpdate"
class=
"need-update-tip"
@
click=
"refreshFirstPage"
>
数据有更新,请刷新
</div>
<div
v-for=
"item in chatRooms"
:key=
"'room_' + item.id"
...
...
@@ -101,6 +102,9 @@ export default class ModelChatList extends Vue {
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_SHOW_CHAT
)
private
readonly
showChat
:
ChatStore
.
MUTATION_SHOW_CHAT
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_HIDE_CHAT
)
private
readonly
hideChat
:
ChatStore
.
MUTATION_HIDE_CHAT
;
@
Prop
({
type
:
Number
,
default
:
-
1
})
private
selected
!
:
number
;
...
...
@@ -113,6 +117,7 @@ export default class ModelChatList extends Vue {
private
pageSize
=
10
;
private
total
=
0
;
private
currentPage
=
1
;
private
needUpdate
=
false
;
private
get
chatRooms
()
{
...
...
@@ -125,8 +130,8 @@ export default class ModelChatList extends Vue {
private
async
getList
()
{
const
result
=
await
this
.
sdk
.
model
(
this
.
modelName
).
list
(
this
.
listName
||
undefined
).
query
({
pageIndex
:
1
,
item_size
:
50
pageIndex
:
this
.
currentPage
,
item_size
:
this
.
pageSize
})
this
.
chatList
=
result
.
pageData
.
rows
.
map
(
it
=>
{
return
{
...
...
@@ -143,16 +148,33 @@ export default class ModelChatList extends Vue {
title
:
it
.
title
.
value
}
as
ChatType
})
this
.
needUpdate
=
false
;
this
.
hideChat
();
this
.
total
=
result
.
pageData
.
record_count
;
this
.
$emit
(
"update-page-info"
,
{
title
:
result
.
pageData
.
title
})
}
private
async
refreshFirstPage
()
{
this
.
currentPage
=
1
;
await
this
.
getList
();
}
async
created
()
{
this
.
modelName
=
this
.
$route
.
params
.
modelName
;
this
.
listName
=
this
.
$route
.
params
.
listName
;
await
this
.
getList
();
this
.
setSource
(
ChatStore
.
StateChatSourceDirection
.
Server
);
this
.
scrollbar
.
update
();
this
.
$onBeforeDestroy
(
await
this
.
sdk
.
model
(
"UniplatChat"
).
registerOnChange
(
this
.
onTransportMessage
)
)
}
onTransportMessage
(
e
:
any
)
{
let
index
=
e
.
dataUpdates
.
findIndex
(
it
=>
it
.
action
===
"startChat"
||
it
.
action
===
"csExitChat"
);
if
(
index
>
-
1
)
{
this
.
needUpdate
=
true
;
}
}
mounted
()
{
...
...
@@ -302,4 +324,14 @@ export default class ModelChatList extends Vue {
padding
:
0
;
border-color
:
#ccc
;
}
.need-update-tip
{
background
:
#fff2e6
;
color
:
#e87005
;
font-size
:
14px
;
font-weight
:
400
;
line-height
:
14px
;
padding
:
8px
0
;
text-align
:
center
;
cursor
:
pointer
;
}
</
style
>
components/chat-list.vue
View file @
10cc168f
...
...
@@ -101,6 +101,9 @@ export default class ChatList extends Vue {
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_SHOW_CHAT
)
private
readonly
showChat
:
ChatStore
.
MUTATION_SHOW_CHAT
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_HIDE_CHAT
)
private
readonly
hideChat
:
ChatStore
.
MUTATION_HIDE_CHAT
;
@
Prop
({
type
:
Number
,
default
:
-
1
})
private
selected
!
:
number
;
...
...
@@ -123,6 +126,9 @@ export default class ChatList extends Vue {
this
.
setSource
(
ChatStore
.
StateChatSourceDirection
.
Server
);
await
this
.
selectFirstChat
();
this
.
scrollbar
.
update
();
this
.
$onBeforeDestroy
(
await
this
.
sdk
.
model
(
"UniplatChat"
).
registerOnChange
(
this
.
onTransportMessage
)
)
}
mounted
()
{
...
...
@@ -130,6 +136,11 @@ export default class ChatList extends Vue {
this
.
goToOnlyRoom
();
}
onTransportMessage
()
{
this
.
getMyChatList
()
// this.hideChat()
}
private
goToOnlyRoom
()
{
if
(
this
.
chatRooms
.
length
===
1
)
{
const
wantedChat
=
this
.
chatRooms
[
0
];
...
...
@@ -178,7 +189,7 @@ export default class ChatList extends Vue {
}
private
close
()
{
this
.
$emit
(
"close"
);
this
.
$emit
(
"close"
);
}
private
goToDetail
(
model_name
:
string
,
keyvalue
:
string
)
{
...
...
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