Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
frontend-h5
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songrui
frontend-h5
Commits
dcecea5d
Commit
dcecea5d
authored
Dec 05, 2024
by
songrui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
im加载云端消息
parent
d3ea72cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
Session.vue
src/residentWX/nim/Session.vue
+29
-2
No files found.
src/residentWX/nim/Session.vue
View file @
dcecea5d
...
@@ -162,7 +162,8 @@ export default {
...
@@ -162,7 +162,8 @@ export default {
onconnect
:
()
=>
{
onconnect
:
()
=>
{
console
.
log
(
'连接成功 ================>'
)
console
.
log
(
'连接成功 ================>'
)
this
.
isConnect
=
true
this
.
isConnect
=
true
this
.
getLocalMsgs
()
// this.getLocalMsgs()
this
.
getHistoryMsgs
()
this
.
toBottom
(
'instant'
)
this
.
toBottom
(
'instant'
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// 开启滚动加载
// 开启滚动加载
...
@@ -245,8 +246,34 @@ export default {
...
@@ -245,8 +246,34 @@ export default {
}
}
})
})
},
},
// 加载云端消息
getHistoryMsgs
()
{
const
msg
=
this
.
msgs
[
0
]
||
{}
this
.
loading
=
true
this
.
nim
.
getHistoryMsgs
({
// sessionId: `p2p-${this.targetId}`,
scene
:
'p2p'
,
to
:
this
.
targetId
,
limit
:
40
,
end
:
msg
.
time
,
done
:
(
error
,
obj
)
=>
{
console
.
log
(
'获取p2p历史消息'
+
(
!
error
?
'成功'
:
'失败'
),
obj
);
const
msgs
=
obj
.
msgs
||
[]
this
.
loading
=
false
if
(
!
msgs
.
length
)
{
this
.
finished
=
true
return
}
msgs
.
sort
((
a
,
b
)
=>
{
return
a
.
time
-
b
.
time
})
this
.
msgs
=
msgs
.
concat
(
this
.
msgs
)
}
})
},
loadHistory
()
{
loadHistory
()
{
this
.
getLocalMsgs
()
// this.getLocalMsgs()
this
.
getHistoryMsgs
()
},
},
handleFiles
()
{
handleFiles
()
{
let
files
=
this
.
$refs
[
'fileElem'
].
files
let
files
=
this
.
$refs
[
'fileElem'
].
files
...
...
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