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
06599338
authored
Sep 29, 2021
by
胡锦波
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1. fix 报错去除
parent
3d94dda3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
23 deletions
components/chat-room.vue
components/controller/chat-list.ts
components/message-list.vue
components/message.vue
database/index.ts
hybrid-input/index.vue
store/index.ts
components/chat-room.vue
View file @
06599338
...
@@ -56,10 +56,10 @@ type RoomInfoTab = "customer" | "order";
...
@@ -56,10 +56,10 @@ type RoomInfoTab = "customer" | "order";
},
},
})
})
export
default
class
ChatRoom
extends
Vue
{
export
default
class
ChatRoom
extends
Vue
{
@
Ref
(
"chatBox"
)
chatBox
:
Element
;
@
Ref
(
"chatBox"
)
chatBox
!
:
Element
;
@
Ref
(
"top"
)
refTop
:
Element
;
@
Ref
(
"top"
)
refTop
!
:
Element
;
@
Ref
(
"bottom"
)
refBottom
:
Element
;
@
Ref
(
"bottom"
)
refBottom
!
:
Element
;
@
Ref
(
"resize"
)
refResize
:
Element
;
@
Ref
(
"resize"
)
refResize
!
:
Element
;
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
...
...
components/controller/chat-list.ts
View file @
06599338
...
@@ -18,7 +18,7 @@ export default class ChatList extends Vue {
...
@@ -18,7 +18,7 @@ export default class ChatList extends Vue {
protected
readonly
chatList
!
:
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
;
protected
readonly
chatList
!
:
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
;
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_USERNAME
)
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_USERNAME
)
protected
readonly
userNames
!
:
ChatStore
.
STATE_CHAT_USERNAME
;
protected
readonly
userNames
!
:
ChatStore
.
STATE_CHAT_USERNAME
|
any
;
@
chatStore
.
Action
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
)
@
chatStore
.
Action
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
)
protected
readonly
saveChatId
!
:
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
;
protected
readonly
saveChatId
!
:
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
;
...
@@ -36,10 +36,10 @@ export default class ChatList extends Vue {
...
@@ -36,10 +36,10 @@ export default class ChatList extends Vue {
protected
readonly
saveChatTitle
!
:
ChatStore
.
MUTATION_SAVE_CHAT_TITLE
;
protected
readonly
saveChatTitle
!
:
ChatStore
.
MUTATION_SAVE_CHAT_TITLE
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_SHOW_CHAT
)
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_SHOW_CHAT
)
protected
readonly
showChat
:
ChatStore
.
MUTATION_SHOW_CHAT
;
protected
readonly
showChat
!
:
ChatStore
.
MUTATION_SHOW_CHAT
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_HIDE_CHAT
)
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_HIDE_CHAT
)
protected
readonly
hideChat
:
ChatStore
.
MUTATION_HIDE_CHAT
;
protected
readonly
hideChat
!
:
ChatStore
.
MUTATION_HIDE_CHAT
;
protected
parseMesage
(
data
:
ChatItem
)
{
protected
parseMesage
(
data
:
ChatItem
)
{
if
(
data
.
last_msg_sender
&&
data
.
last_msg_sender
!==
"0"
)
{
if
(
data
.
last_msg_sender
&&
data
.
last_msg_sender
!==
"0"
)
{
...
@@ -49,7 +49,7 @@ export default class ChatList extends Vue {
...
@@ -49,7 +49,7 @@ export default class ChatList extends Vue {
.
model
(
"user"
)
.
model
(
"user"
)
.
detail
(
data
.
last_msg_sender
)
.
detail
(
data
.
last_msg_sender
)
.
query
()
.
query
()
.
then
((
userInfo
)
=>
{
.
then
((
userInfo
:
any
)
=>
{
this
.
updateUserName
({
this
.
updateUserName
({
id
:
data
.
last_msg_sender
,
id
:
data
.
last_msg_sender
,
name
:
userInfo
.
row
.
first_name
.
display
as
string
,
name
:
userInfo
.
row
.
first_name
.
display
as
string
,
...
...
components/message-list.vue
View file @
06599338
...
@@ -81,13 +81,13 @@ export default class MessageList extends Vue {
...
@@ -81,13 +81,13 @@ export default class MessageList extends Vue {
private
readonly
clearScrollToBottomFunc
!
:
ChatStore
.
MUTATION_CLEAR_FUNC_SCROLL_TO_BOTTOM
;
private
readonly
clearScrollToBottomFunc
!
:
ChatStore
.
MUTATION_CLEAR_FUNC_SCROLL_TO_BOTTOM
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_SAVE_FUNC_ON_NEW_MSG
)
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_SAVE_FUNC_ON_NEW_MSG
)
private
readonly
onNewMessage
:
ChatStore
.
MUTATION_SAVE_FUNC_ON_NEW_MSG
;
private
readonly
onNewMessage
!
:
ChatStore
.
MUTATION_SAVE_FUNC_ON_NEW_MSG
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_CLEAR_FUNC_ON_NEW_MSG
)
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_CLEAR_FUNC_ON_NEW_MSG
)
private
readonly
clearNewMessage
:
ChatStore
.
MUTATION_CLEAR_FUNC_ON_NEW_MSG
;
private
readonly
clearNewMessage
!
:
ChatStore
.
MUTATION_CLEAR_FUNC_ON_NEW_MSG
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_WITHDRAW
)
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_WITHDRAW
)
private
readonly
executeWithDraw
:
ChatStore
.
MUTATION_WITHDRAW
;
private
readonly
executeWithDraw
!
:
ChatStore
.
MUTATION_WITHDRAW
;
@
Prop
({
default
:
"circle"
})
@
Prop
({
default
:
"circle"
})
private
shape
!
:
string
;
private
shape
!
:
string
;
...
...
components/message.vue
View file @
06599338
...
@@ -202,7 +202,7 @@ export default class Message extends Mixins(Filters) {
...
@@ -202,7 +202,7 @@ export default class Message extends Mixins(Filters) {
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
private
readonly
chatId
!
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_WITHDRAW
)
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_WITHDRAW
)
private
readonly
executeWithDraw
:
ChatStore
.
MUTATION_WITHDRAW
;
private
readonly
executeWithDraw
!
:
ChatStore
.
MUTATION_WITHDRAW
;
/**
/**
* tbd: 文件消息所在的域名的url,逻辑需要补充
* tbd: 文件消息所在的域名的url,逻辑需要补充
...
@@ -280,7 +280,7 @@ export default class Message extends Mixins(Filters) {
...
@@ -280,7 +280,7 @@ export default class Message extends Mixins(Filters) {
}
}
const
senderEid
=
this
.
messageBody
.
eid
;
const
senderEid
=
this
.
messageBody
.
eid
;
return
senderEid
.
toString
()
===
this
.
chatMyId
.
toString
();
return
senderEid
!
.
toString
()
===
this
.
chatMyId
!
.
toString
();
// if (this.messageBody) {
// if (this.messageBody) {
// const msg = this.messageBody;
// const msg = this.messageBody;
// if (this.chatSource) {
// if (this.chatSource) {
...
@@ -304,13 +304,13 @@ export default class Message extends Mixins(Filters) {
...
@@ -304,13 +304,13 @@ export default class Message extends Mixins(Filters) {
// return false;
// return false;
}
}
private
mounted
()
{
mounted
()
{
this
.
buildMessageUrl
();
this
.
buildMessageUrl
();
}
}
private
get
userName
()
{
private
get
userName
()
{
return
(
return
(
this
.
chatMembers
.
find
((
member
)
=>
member
.
eid
===
this
.
data
.
eid
)
this
.
chatMembers
!
.
find
((
member
)
=>
member
.
eid
===
this
.
data
.
eid
)
?.
name
??
""
?.
name
??
""
);
);
}
}
...
@@ -468,9 +468,9 @@ export default class Message extends Mixins(Filters) {
...
@@ -468,9 +468,9 @@ export default class Message extends Mixins(Filters) {
}
}
private
withdraw
()
{
private
withdraw
()
{
ximInstance
.
withdraw
(
this
.
chatId
,
this
.
data
.
id
).
finally
(()
=>
{
ximInstance
.
withdraw
(
this
.
chatId
!
,
this
.
data
.
id
).
finally
(()
=>
{
dbController
dbController
.
removeMessage
(
this
.
chatId
,
this
.
data
.
id
)
.
removeMessage
(
this
.
chatId
!
,
this
.
data
.
id
)
.
finally
(()
=>
{
.
finally
(()
=>
{
this
.
executeWithDraw
(
this
.
data
.
id
);
this
.
executeWithDraw
(
this
.
data
.
id
);
this
.
$emit
(
"withdraw"
,
this
.
data
.
id
);
this
.
$emit
(
"withdraw"
,
this
.
data
.
id
);
...
...
database/index.ts
View file @
06599338
import
{
Chat
,
Message
}
from
"./../xim/models/chat"
;
import
{
Chat
,
Message
}
from
"./../xim/models/chat"
;
class
ChatCacheDatabaseController
{
class
ChatCacheDatabaseController
{
private
db
:
IDBDatabase
;
private
db
!
:
IDBDatabase
;
private
readonly
messageDatabases
=
new
Map
<
string
,
IDBDatabase
>
();
private
readonly
messageDatabases
=
new
Map
<
string
,
IDBDatabase
>
();
...
@@ -60,7 +60,7 @@ class ChatCacheDatabaseController {
...
@@ -60,7 +60,7 @@ class ChatCacheDatabaseController {
const
setupDb
=
()
=>
{
const
setupDb
=
()
=>
{
const
db
=
that
.
messageDatabases
.
get
(
k
);
const
db
=
that
.
messageDatabases
.
get
(
k
);
try
{
try
{
that
.
buildTables
(
db
,
this
.
chatMessageKey
,
"id"
);
that
.
buildTables
(
db
!
,
this
.
chatMessageKey
,
"id"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
);
console
.
error
(
e
);
}
}
...
...
hybrid-input/index.vue
View file @
06599338
...
@@ -279,7 +279,7 @@ export default class Input extends Vue {
...
@@ -279,7 +279,7 @@ export default class Input extends Vue {
const
el
=
this
.
messageInputBox
;
const
el
=
this
.
messageInputBox
;
const
range
=
document
.
createRange
();
const
range
=
document
.
createRange
();
const
sel
=
window
.
getSelection
();
const
sel
=
window
.
getSelection
();
const
offset
=
sel
.
focusOffset
;
const
offset
=
sel
!
.
focusOffset
;
const
content
=
el
.
innerHTML
;
const
content
=
el
.
innerHTML
;
el
.
innerHTML
=
el
.
innerHTML
=
content
.
slice
(
0
,
offset
)
+
content
.
slice
(
0
,
offset
)
+
...
@@ -287,8 +287,8 @@ export default class Input extends Vue {
...
@@ -287,8 +287,8 @@ export default class Input extends Vue {
(
content
.
slice
(
offset
)
||
"\n"
);
(
content
.
slice
(
offset
)
||
"\n"
);
range
.
setStart
(
el
.
childNodes
[
0
],
offset
+
1
);
range
.
setStart
(
el
.
childNodes
[
0
],
offset
+
1
);
range
.
collapse
(
true
);
range
.
collapse
(
true
);
sel
.
removeAllRanges
();
sel
!
.
removeAllRanges
();
sel
.
addRange
(
range
);
sel
!
.
addRange
(
range
);
return
;
return
;
}
}
if
(
e
.
shiftKey
)
{
if
(
e
.
shiftKey
)
{
...
...
store/index.ts
View file @
06599338
...
@@ -369,7 +369,7 @@ export default {
...
@@ -369,7 +369,7 @@ export default {
const
ts
=
cache
.
map
((
i
)
=>
i
.
last_msg_ts
).
sort
();
const
ts
=
cache
.
map
((
i
)
=>
i
.
last_msg_ts
).
sort
();
const
last
=
ts
[
ts
.
length
-
1
];
const
last
=
ts
[
ts
.
length
-
1
];
await
xim
.
fetchChatListAfter
(
last
).
then
((
r
)
=>
{
await
xim
.
fetchChatListAfter
(
last
)
!
.
then
((
r
)
=>
{
const
list
=
r
.
args
[
0
]
as
any
[];
const
list
=
r
.
args
[
0
]
as
any
[];
const
items
=
list
.
map
((
i
)
=>
buildChatItem
(
i
));
const
items
=
list
.
map
((
i
)
=>
buildChatItem
(
i
));
if
(
items
&&
items
.
length
)
{
if
(
items
&&
items
.
length
)
{
...
...
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