Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Madara
Project
Project
Details
Activity
Releases
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
viitto
Madara
Commits
1d5410ef
Commit
1d5410ef
authored
Oct 17, 2019
by
华国豪
🙄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取消息列表未读消息
parent
52fd672b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
8 deletions
+40
-8
chatitem.vue
src/renderer/components/msssage/chatitem.vue
+0
-1
index.vue
src/renderer/components/msssage/index.vue
+24
-1
msgs.js
src/store/actions/msgs.js
+9
-5
index.js
src/store/mutations/index.js
+5
-0
state.js
src/store/state.js
+2
-1
No files found.
src/renderer/components/msssage/chatitem.vue
View file @
1d5410ef
...
...
@@ -670,7 +670,6 @@ export default {
return result;
},
formatCustom(item) {
console.log(item)
if (item.content) {
item.customData = JSON.parse(item.content).data;
...
...
src/renderer/components/msssage/index.vue
View file @
1d5410ef
...
...
@@ -214,6 +214,7 @@ export default {
},
data
()
{
return
{
sessionlistHis
:
[],
sessionKey
:
""
,
currentSession
:
{
id
:
""
...
...
@@ -241,8 +242,28 @@ export default {
// 提交sdk连接请求
this
.
$store
.
dispatch
(
"connect"
);
this
.
$store
.
dispatch
(
"updateRefreshState"
);
},
watch
:
{
// 监听消息接受
sessionlistHis
(
newVal
,
oldVal
)
{
if
(
JSON
.
stringify
(
newVal
)
!==
JSON
.
stringify
(
oldVal
))
{
this
.
getUnreadHis
()
}
}
},
methods
:
{
// 获取会话列表有未读消息的会话的所有聊天记录
getUnreadHis
:
function
(){
let
list
=
this
.
sessionlistHis
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
$store
.
dispatch
(
"getHistoryMsgs"
,
{
scene
:
list
[
i
].
scene
,
to
:
list
[
i
].
to
,
pageDatas
:
list
[
i
].
unread
,
});
}
// let msgs = this.$store.state.unreadListHis;
// console.log(msgs, "// 获取会话列表有未读消息的会话的所有聊天记录")
},
showNotice
()
{
this
.
$electron
.
ipcRenderer
.
send
(
'load-notice'
)
},
...
...
@@ -544,6 +565,7 @@ export default {
},
sessionlist
()
{
let
unreadList
=
[];
let
sessionlistHis
=
[]
let
historicList
=
window
.
localStorage
.
historicList
?
JSON
.
parse
(
window
.
localStorage
.
historicList
)
:
[];
// console.log("this.$store.state.sessionlist", this.$store.state.sessionlist)
let
sessionlist
=
this
.
$store
.
state
.
sessionlist
.
filter
(
item
=>
{
...
...
@@ -575,7 +597,7 @@ export default {
}
}
else
if
(
item
.
scene
===
"team"
)
{
if
(
item
.
unread
>
0
)
{
console
.
log
(
item
.
unread
)
sessionlistHis
.
push
(
item
)
}
let
teamInfo
=
null
;
teamInfo
=
this
.
$store
.
state
.
teamlist
.
find
(
team
=>
{
...
...
@@ -720,6 +742,7 @@ export default {
this
.
newMsgList
=
unreadList
;
this
.
sessionlistHis
=
sessionlistHis
;
return
sessionlist
;
}
// netState(){
...
...
src/store/actions/msgs.js
View file @
1d5410ef
...
...
@@ -478,12 +478,16 @@ export function getHistoryMsgs({ state, commit }, obj) {
return
formatMsg
(
msg
)
})
if
(
pageDatas
)
{
console
.
log
(
msgs
)
commit
(
'unreadListHis'
,
{
msgs
:
msgs
,
to
:
to
})
}
else
{
commit
(
'updateCurrSessionMsgs'
,
{
type
:
'concat'
,
msgs
:
msgs
})
}
commit
(
'updateCurrSessionMsgs'
,
{
type
:
'concat'
,
msgs
:
msgs
})
}
}
store
.
dispatch
(
'hideLoading'
)
...
...
src/store/mutations/index.js
View file @
1d5410ef
...
...
@@ -257,6 +257,11 @@ export default {
}
}
},
// 装入未读消息
unreadListHis
(
state
,
obj
)
{
state
.
unreadListHis
[
obj
.
to
]
=
obj
.
msgs
console
.
log
(
state
.
unreadListHis
,
"装数据"
)
},
// clearMsgs(state, obj) {
// state.msgs = []
// },
...
...
src/store/state.js
View file @
1d5410ef
...
...
@@ -72,7 +72,8 @@ export default {
noMoreHistoryMsgs
:
false
,
// 继续对话的机器人id
continueRobotAccid
:
''
,
// 未读消息
unreadListHis
:
{},
// 系统消息
sysMsgs
:
[],
customSysMsgs
:
[],
...
...
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