master
kira 6 years ago
parent 3b6609ad03
commit 58cf4e0fe0

@ -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,9 +38,12 @@
}
function switchTouid(touid) {
window.uid = touid;
window.touid = touid;
WKIT.switchTouid({
touid: touid
touid: window.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,
@ -82,20 +85,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);
@ -109,7 +104,7 @@
function updateContractList(data) {
var msg = data.msgs[0];
var msg_uid = getName(WKIT.Conn.sdk.Base.getNick(msg.from))
if (window.uid = msg_uid) {
if (window.uid == msg_uid) {
WKIT.Conn.sdk.Chat.setReadState({
touid: msg_uid,
timestamp: Math.floor((+new Date()) / 1000),
@ -119,15 +114,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() {

@ -164,13 +164,14 @@
function showContactList(map) {
var contact_list = '';
for (var key in map) {
var ele= map[key];
var css = 'hover';
if (key == parent.window.uid) {
if (key == parent.window.touid) {
css = 'active';
}
var headImUrl = '';
if (map[key].headimg) {
headImUrl = map[key].headimg;
if (ele.headimg) {
headImUrl = ele.headimg;
} else {
headImUrl = "/static/images/act/encourage_money/default_headimg.png";
}
@ -179,8 +180,10 @@
+ "')>"
+ "<div class=\"headimg\" style='background-image:url(" + headImUrl
+ "')>"
+ "<div class=\"notice\">" + map[key].msgCount + "</div>"
+ "</div>"
if(ele.msgCount>0){
contact_list+="<div class=\"notice\">" + ele.msgCount + "</div>";
}
contact_list += "</div>"
+ "<div class=\"avatar\">" + key + "</div>"
+ "</li>"
}

@ -15,7 +15,7 @@
uid: 'kira3_PINE',
appkey: 24980715,
credential: 'xxxxxx',
touid: 'kiraservant2',
touid: 'kiraservanttest1',
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
});
}

Loading…
Cancel
Save