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
d1311847
authored
Jan 05, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into pre
parents
66487887
8931da86
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
18 deletions
components/message-input.vue
hybrid-input/index.vue
service/monitor.ts
components/message-input.vue
View file @
d1311847
...
...
@@ -9,7 +9,7 @@
<
script
lang=
"ts"
>
import
{
Component
,
Ref
,
Vue
,
Watch
}
from
"vue-property-decorator"
;
import
ChatInput
,
{
FILE_INFO_CLASS
,
isFileElement
,
isImageOrFile
,
}
from
"../hybrid-input/index.vue"
;
import
{
Message
,
MessageType
}
from
"../model"
;
...
...
@@ -51,6 +51,8 @@
@
Ref
(
"chat-input"
)
private
readonly
chatInput
!
:
ChatInput
;
private
sending
=
false
;
@
Watch
(
"chatRoomVisible"
)
private
whenChatRoomShow
()
{
if
(
!
this
.
chatRoomVisible
)
return
;
...
...
@@ -58,27 +60,39 @@
}
private
async
sendMessage
(
msg
:
ChildNode
[])
{
if
(
this
.
chatIniting
)
{
if
(
this
.
chatIniting
||
this
.
sending
)
{
return
;
}
const
count
=
msg
.
length
;
let
finished
=
0
;
this
.
sending
=
true
;
const
onFinishedChanged
=
()
=>
{
finished
++
;
if
(
finished
===
count
)
{
this
.
sending
=
false
;
}
};
setTimeout
(()
=>
(
this
.
sending
=
false
),
3000
);
for
(
const
item
of
msg
)
{
if
(
isImageOrFile
(
item
))
{
if
(
(
item
as
Element
).
classList
.
contains
(
FILE_INFO_CLASS
))
{
await
this
.
sendFile
(
item
,
MessageType
.
File
)
.
catch
((
e
)
=>
this
.
onError
(
e
)
);
if
(
isFileElement
(
item
))
{
await
this
.
sendFile
(
item
,
MessageType
.
File
)
.
catch
((
e
)
=>
this
.
onError
(
e
)
)
.
finally
(
onFinishedChanged
);
}
else
{
await
this
.
sendFile
(
item
,
MessageType
.
Image
)
.
catch
((
e
)
=>
this
.
onError
(
e
)
);
await
this
.
sendFile
(
item
,
MessageType
.
Image
)
.
catch
((
e
)
=>
this
.
onError
(
e
)
)
.
finally
(
onFinishedChanged
);
}
continue
;
}
if
(
item
.
textContent
)
{
await
this
.
sendText
(
item
.
textContent
).
catch
((
e
)
=>
this
.
onError
(
e
)
);
await
this
.
sendText
(
item
.
textContent
)
.
catch
((
e
)
=>
this
.
onError
(
e
))
.
finally
(
onFinishedChanged
);
}
else
{
onFinishedChanged
();
}
}
this
.
$emit
(
"sent"
);
...
...
@@ -166,7 +180,8 @@
console
.
error
(
e
);
this
.
setMsg2Failed
(
index
);
this
.
chatInput
&&
this
.
chatInput
.
updateUploadProgress
(
0
);
this
.
chatInput
&&
this
.
chatInput
.
updateUploadProgress
(
0
);
});
}
}
...
...
hybrid-input/index.vue
View file @
d1311847
...
...
@@ -125,6 +125,10 @@
);
}
export
function
isFileElement
(
node
:
ChildNode
)
{
return
(
node
as
Element
).
classList
.
contains
(
FILE_INFO_CLASS
);
}
const
limitedFileExtension
=
[
"ppt"
,
"pptx"
,
...
...
@@ -149,9 +153,6 @@
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
@
chatStore
.
Action
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
)
protected
readonly
getMyChatList
!
:
ChatStore
.
ACTION_GET_MY_CHAT_LIST
;
@
Ref
(
"input"
)
private
readonly
messageInputBox
!
:
HTMLDivElement
;
...
...
@@ -350,8 +351,6 @@
if
(
this
.
chatId
)
{
chatCache
[
this
.
chatId
]
=
[];
}
this
.
getMyChatList
();
},
120
);
}
...
...
service/monitor.ts
View file @
d1311847
...
...
@@ -102,6 +102,7 @@ class WebMonitor {
options
&&
options
.
userAgent
&&
msg
.
push
(
`UserAgent:
${
window
.
navigator
.
userAgent
}
`
);
r
.
config
&&
r
.
config
.
params
&&
msg
.
push
(
`Params:
${
r
.
config
.
params
}
`
);
r
.
config
&&
r
.
config
.
data
&&
msg
.
push
(
`Payload:
${
JSON
.
stringify
(
r
.
config
.
data
)}
`
);
msg
.
push
(
...
...
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