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
f2a6352f
authored
Jan 17, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整已读未读逻辑,移除多余检查
parent
cb2682db
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
34 deletions
components/message-list.vue
components/message.vue
store/index.ts
store/model.ts
components/message-list.vue
View file @
f2a6352f
...
...
@@ -172,7 +172,10 @@
public
mounted
()
{
this
.
scollWrapper
&&
this
.
scollWrapper
.
addEventListener
(
"scroll"
,
this
.
handleScroll
);
this
.
saveScrollToBottomFunc
(
this
.
scrollToNewMsg
);
this
.
saveScrollToBottomFunc
((
e
)
=>
{
this
.
scrollToNewMsg
();
this
.
checkReadingStatus
(
e
);
});
this
.
scrollToNewMsg
();
setTimeout
(()
=>
this
.
scroll2End
(
200
));
setTimeout
(()
=>
this
.
scroll2End
(
1000
),
200
);
...
...
@@ -206,6 +209,10 @@
});
}
private
checkReadingStatus
(
e
:
Message
)
{
return
e
;
}
private
startLoading
()
{
this
.
loading
=
true
;
}
...
...
components/message.vue
View file @
f2a6352f
...
...
@@ -234,9 +234,6 @@
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_IS_CHAT_MEMBER
)
private
readonly
isChatMember
!
:
ChatStore
.
STATE_CHAT_CURRENT_IS_CHAT_MEMBER
;
@
chatStore
.
Action
(
ChatStore
.
ACTION_UPDATE_MESSAGE_READ_STATUS
)
private
readonly
updateMessage
!
:
ChatStore
.
ACTION_UPDATE_MESSAGE_READ_STATUS
;
@
Prop
({
type
:
Object
,
default
:
()
=>
Object
.
create
(
null
)
})
private
readonly
data
!
:
dto
.
Message
;
...
...
@@ -504,32 +501,6 @@
created
()
{
this
.
messageComponent
=
messageMapping
.
get
(
this
.
messageType
)
as
string
;
if
(
Xim
.
isBackend
())
{
this
.
data
&&
!
this
.
isAllRead
&&
ximInstance
.
queryNextPageMsg
(
"group"
,
this
.
chatId
as
number
,
this
.
data
.
id
-
1
,
1
)
.
then
((
m
)
=>
{
if
(
m
&&
m
.
length
)
{
const
t
=
m
[
0
];
t
.
read_count
&&
t
.
read_count
!==
this
.
data
.
read_count
&&
this
.
updateMessage
({
chat
:
this
.
chatId
as
number
,
start
:
this
.
data
.
id
,
all
:
(
this
.
manualAllRead
=
t
.
read_count
===
t
.
total_read_count
),
readed
:
(
this
.
manualReaded
=
t
.
read_count
),
});
}
});
}
}
private
isCustomer
()
{
...
...
store/index.ts
View file @
f2a6352f
...
...
@@ -164,7 +164,7 @@ export default {
[
ChatStore
.
STATE_ALL_HISTORY_CHAT_MEMBERS
]:
null
,
[
ChatStore
.
STATE_CURRENT_CHAT_TITLE
]:
""
,
[
ChatStore
.
STATE_FUNC_SCROLL_TO_BOTTOM
]:
()
=>
true
,
[
ChatStore
.
STATE_FUNC_ON_NEW_MSG
]:
(
)
=>
tru
e
,
[
ChatStore
.
STATE_FUNC_ON_NEW_MSG
]:
(
e
:
Message
)
=>
e
,
[
ChatStore
.
STATE_CURRENT_CHAT_INPUTING
]:
[],
[
ChatStore
.
STATE_CURRENT_CHAT_INITING
]:
false
,
[
ChatStore
.
STATE_CHAT_CURRENT_USER_TYPE
]:
null
,
...
...
@@ -304,7 +304,7 @@ export default {
state
[
ChatStore
.
STATE_SINGLE_CHAT
]
=
null
;
},
[
ChatStore
.
MUTATION_SCROLL_TO_BOTTOM
](
state
)
{
state
[
ChatStore
.
STATE_FUNC_SCROLL_TO_BOTTOM
]();
state
[
ChatStore
.
STATE_FUNC_SCROLL_TO_BOTTOM
](
null
);
},
[
ChatStore
.
MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM
](
state
,
...
...
store/model.ts
View file @
f2a6352f
...
...
@@ -77,7 +77,7 @@ export namespace ChatStore {
export
type
STATE_CURRENT_CHAT_TITLE
=
string
;
export
const
STATE_FUNC_SCROLL_TO_BOTTOM
=
"收到消息后滚动到底部的方法"
;
export
type
STATE_FUNC_SCROLL_TO_BOTTOM
=
()
=>
void
;
export
type
STATE_FUNC_SCROLL_TO_BOTTOM
=
(
e
:
chatDto
.
Message
)
=>
void
;
export
const
STATE_FUNC_ON_NEW_MSG
=
"收到消息回调方法"
;
export
type
STATE_FUNC_ON_NEW_MSG
=
(
e
:
chatDto
.
Message
)
=>
void
;
...
...
@@ -204,7 +204,7 @@ export namespace ChatStore {
export
const
MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM
=
"保存收到新消息后滚动到底部的方法"
;
export
type
MUTATION_SAVE_FUNC_SCROLL_TO_BOTTOM
=
(
func
:
()
=>
void
func
:
(
e
:
chatDto
.
Message
)
=>
void
)
=>
void
;
export
const
MUTATION_CLEAR_FUNC_SCROLL_TO_BOTTOM
=
"删除收到新消息后滚动到底部的方法"
;
...
...
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