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
1ee879ff
authored
Dec 23, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
8b24464a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
9 deletions
components/chat-room.vue
store/index.ts
xim/index.ts
components/chat-room.vue
View file @
1ee879ff
...
...
@@ -31,7 +31,7 @@
class=
"chat-input flex-none h-100"
v-if=
"hasInput"
>
<message-input
@
error=
"onError"
/>
<message-input
@
error=
"onError"
@
sent=
"onMessageSent"
/>
</div>
</div>
</div>
...
...
@@ -70,6 +70,11 @@
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_IS_CHAT_ERROR
)
private
readonly
chatError
!
:
ChatStore
.
STATE_CHAT_CURRENT_IS_CHAT_ERROR
;
@
chatStore
.
Getter
(
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
)
private
readonly
currentChat
!
:
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
;
private
setting
=
0
;
private
get
hasInput
()
{
return
this
.
isChatMember
&&
this
.
chatError
!==
this
.
chatId
;
}
...
...
@@ -131,6 +136,21 @@
private
openPayMessage
(
id
:
number
)
{
this
.
$emit
(
"open-pay-message"
,
id
);
}
private
onMessageSent
()
{
if
(
this
.
setting
)
{
clearTimeout
(
this
.
setting
);
}
this
.
setting
=
setTimeout
(
()
=>
this
.
currentChat
&&
Chat
.
setRead
(
this
.
currentChat
.
model_name
,
this
.
currentChat
.
obj_id
),
300
);
}
}
</
script
>
...
...
store/index.ts
View file @
1ee879ff
This diff is collapsed.
Click to expand it.
xim/index.ts
View file @
1ee879ff
...
...
@@ -146,14 +146,16 @@ class Chat {
return
Promise
.
resolve
(
uri
);
}
return
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
xim
.
open
(
uri
,
this
.
token
).
catch
(
reject
).
finally
(()
=>
{
this
.
registerXimEvent
();
if
(
xim
.
isConnected
())
{
resolve
();
}
else
{
reject
(
new
Error
(
`xim is not connected`
));
}
});
xim
.
open
(
uri
,
this
.
token
)
.
catch
(
reject
)
.
finally
(()
=>
{
this
.
registerXimEvent
();
if
(
xim
.
isConnected
())
{
resolve
();
}
else
{
reject
(
new
Error
(
`xim is not connected`
));
}
});
});
}
...
...
@@ -203,6 +205,15 @@ class Chat {
public
getAvatar
()
{
return
this
.
defaultAvatar
;
}
public
setRead
(
model
:
string
,
obj
:
string
)
{
if
(
this
.
isBackend
())
{
const
sdk
=
this
.
getSdk
();
if
(
sdk
)
{
sdk
.
getAxios
().
post
(
`/general/xim/model/
${
model
}
/
${
obj
}
/read`
);
}
}
}
}
export
default
new
Chat
();
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