Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lumastoreapp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xieyishang
lumastoreapp
Commits
9684bc36
Commit
9684bc36
authored
Nov 11, 2021
by
xieyishang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addxx
parent
e8f3475b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
store/Im_store.js
store/Im_store.js
+14
-16
No files found.
store/Im_store.js
View file @
9684bc36
...
...
@@ -15,6 +15,7 @@ const Im_store = {
myconversationList
:
[],
//会话列表 我的会话列表
dfuserId
:
""
,
//单聊的时候 对方的userID
groupId
:
""
,
//正在聊天的群聊id
Unread
:
0
,
//未读的消息数
//APP IM data end
},
mutations
:
{
...
...
@@ -48,7 +49,11 @@ const Im_store = {
},
setmyconversationList
(
state
,
data
)
{
state
.
myconversationList
=
data
;
},
setUnread
(
state
,
data
){
//未读的消息数
state
.
Unread
=
data
;
}
//APP fun edn
},
...
...
@@ -72,12 +77,13 @@ const Im_store = {
let
IMUserID
=
uni
.
getStorageSync
(
"
IMUserID
"
);
// #ifdef APP-PLUS
store
.
dispatch
(
"
loginStatus
"
,
String
(
IMUserID
)).
then
((
res
)
=>
{
//获取登录状态
console
.
info
(
"
登录状态
"
,
res
);
if
(
res
.
loginStatus
!=
1
)
{
//没登录
store
.
dispatch
(
"
baselogin
"
,
String
(
IMUserID
))
}
else
{
//已经登录了
console
.
info
(
"
已经登录了
"
);
store
.
dispatch
(
"
baselogin
"
,
String
(
IMUserID
))
}
})
// #endif
...
...
@@ -93,6 +99,7 @@ const Im_store = {
},
result
=>
{
})
console
.
info
(
"
isSuccess
"
,
isSuccess
);
//如果初始化成功
if
(
isSuccess
)
{
txIm
.
removeAdvancedMsgListener
();
//移除高级消息监听
...
...
@@ -105,7 +112,6 @@ const Im_store = {
// #ifdef APP-PLUS
txIm
=
uni
.
requireNativePlugin
(
'
TX-TencentIM
'
);
// #endif
console
.
info
(
"
新消息来了
"
);
//新消息来了
//震动
...
...
@@ -114,16 +120,7 @@ const Im_store = {
// console.log('success');
// }
// });
let
content
=
"
1
"
;
if
(
result
.
msg
.
elemType
==
1
)
{
content
=
`
${
result
.
msg
.
textElem
.
msg
}
`
;
}
else
if
(
result
.
msg
.
elemType
==
2
)
{
content
=
`[自定义消息]`
}
else
if
(
result
.
msg
.
elemType
==
3
)
{
content
=
`[图片消息]`
}
else
if
(
result
.
msg
.
elemType
==
4
)
{
content
=
`[语音消息]`
}
//....
// 去刷新消息
// 1.刷新聊天界面里面的消息
...
...
@@ -367,7 +364,7 @@ const Im_store = {
})
}
else
if
(
msg
.
elemType
==
2
){
//自定义消息
console
.
info
(
msg
,
"
msgitem1
"
);
//
console.info(msg,"msgitem1");
if
(
msg
.
customElem
.
extension
){
if
(
msg
.
customElem
.
extension
.
indexOf
(
"
type
"
)
!=-
1
){
msg
.
customdata
=
JSON
.
parse
(
msg
.
customElem
.
desc
);
...
...
@@ -524,12 +521,12 @@ const Im_store = {
conversationList
.
forEach
((
item
,
index
)
=>
{
Unread
+=
item
.
unreadCount
;
})
//
console.info("未读总", Unread);
console
.
info
(
"
未读总
"
,
Unread
);
// console.info("conversationList",conversationList);
store
.
commit
(
"
setmyconversationList
"
,
conversationList
);
//更新会话列表
reslove
(
result
);
store
.
commit
(
'
setUnread
'
,
Unread
);
//未读的数量
//设置消息角标
let
CornerIndex
=
1
;
if
(
Unread
>
0
&&
Unread
<=
99
)
{
uni
.
setTabBarBadge
({
...
...
@@ -555,6 +552,7 @@ const Im_store = {
plus
.
runtime
.
setBadgeNumber
(
0
);
// #endif
}
reslove
(
result
);
})
})
...
...
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