|
|
|
@ -22,7 +22,7 @@
|
|
|
|
|
uid: window.uid,
|
|
|
|
|
appkey: window.appKey,
|
|
|
|
|
credential: window.password,
|
|
|
|
|
touid: window.touid,
|
|
|
|
|
touid: window.uid,
|
|
|
|
|
pluginUrl: '/service_contact_list.html?uid='
|
|
|
|
|
+ window.uid,
|
|
|
|
|
onLoginSuccess: function (data) {
|
|
|
|
@ -38,12 +38,16 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function switchTouid(touid) {
|
|
|
|
|
window.uid = touid;
|
|
|
|
|
window.touid = touid;
|
|
|
|
|
var low_touid = WKIT.Conn.sdk.Base.getNick(touid).toLowerCase();
|
|
|
|
|
WKIT.switchTouid({
|
|
|
|
|
touid: touid
|
|
|
|
|
touid: low_touid,
|
|
|
|
|
logo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
|
|
|
|
|
Avatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg',
|
|
|
|
|
toAvatar: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805782509&di=98f7fa48980696f8eddf7eb617a834a3&imgtype=0&src=http%3A%2F%2Fi2.hdslb.com%2Fbfs%2Fface%2F98dbd049061292bca8625caf91cff1b41ee999cd.jpg'
|
|
|
|
|
});
|
|
|
|
|
WKIT.Conn.sdk.Chat.setReadState({
|
|
|
|
|
touid: touid,
|
|
|
|
|
touid: low_touid,
|
|
|
|
|
timestamp: Math.floor((+new Date()) / 1000),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
},
|
|
|
|
@ -82,20 +86,12 @@
|
|
|
|
|
var unreads = data.data;
|
|
|
|
|
var uids = "";
|
|
|
|
|
for (var i = unreads.length - 1; i >= 0; i--) {
|
|
|
|
|
window.sdk.unreadMap[getName(
|
|
|
|
|
WKIT.Conn.sdk.Base.getNick(
|
|
|
|
|
unreads[i].contact))].msgCount =
|
|
|
|
|
unreads[i].msgCount;
|
|
|
|
|
var nick = getName(
|
|
|
|
|
WKIT.Conn.sdk.Base.getNick(
|
|
|
|
|
unreads[i].contact));
|
|
|
|
|
if (nick.length <= 6) {
|
|
|
|
|
window.sdk.unreadMap[getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact))].msgCount = unreads[i].msgCount;
|
|
|
|
|
var nick = getName(WKIT.Conn.sdk.Base.getNick(unreads[i].contact));
|
|
|
|
|
if (nick.substring(nick.length - 5, nick.length - 4) == '_') {
|
|
|
|
|
uids += nick + ",";
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
uids +=
|
|
|
|
|
nick.substring(0, uid.length - 5)
|
|
|
|
|
+ ",";
|
|
|
|
|
uids += nick.substring(0, uid.length - 5) + ",";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
window.sdk.loadContactList(uids);
|
|
|
|
@ -108,10 +104,11 @@
|
|
|
|
|
|
|
|
|
|
function updateContractList(data) {
|
|
|
|
|
var msg = data.msgs[0];
|
|
|
|
|
var msg_uid = getName(WKIT.Conn.sdk.Base.getNick(msg.from))
|
|
|
|
|
if (window.uid = msg_uid) {
|
|
|
|
|
var low_msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
|
|
|
|
|
var msg_uid = getName(low_msg_uid);
|
|
|
|
|
if (window.uid == msg_uid) {
|
|
|
|
|
WKIT.Conn.sdk.Chat.setReadState({
|
|
|
|
|
touid: msg_uid,
|
|
|
|
|
touid: low_msg_uid,
|
|
|
|
|
timestamp: Math.floor((+new Date()) / 1000),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
},
|
|
|
|
@ -119,15 +116,15 @@
|
|
|
|
|
console.log('set read state fail', error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else {
|
|
|
|
|
if (window.sdk.unreadMap[msg_uid]) {
|
|
|
|
|
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
|
|
|
|
|
} else {
|
|
|
|
|
var unreadMapEle = {msgCount: 1}
|
|
|
|
|
window.sdk.unreadMap[msg_uid] = unreadMapEle;
|
|
|
|
|
}
|
|
|
|
|
window.sdk.loadContactList(msg_uid.substr(0, msg_uid - 6));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (window.sdk.unreadMap[msg_uid]) {
|
|
|
|
|
window.sdk.unreadMap[msg_uid].msgCount = window.sdk.unreadMap[msg_uid].msgCount + 1;
|
|
|
|
|
} else {
|
|
|
|
|
var unreadMapEle = {msgCount: 1}
|
|
|
|
|
window.sdk.unreadMap[msg_uid] = unreadMapEle;
|
|
|
|
|
}
|
|
|
|
|
window.sdk.loadContactList(msg_uid.substr(0, msg_uid - 6));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initLayout() {
|
|
|
|
|