Commit 9684bc36 authored by xieyishang's avatar xieyishang

addxx

parent e8f3475b
......@@ -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);
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment