|
|
@ -4,8 +4,9 @@
|
|
|
|
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
|
|
|
|
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
|
|
|
|
<![endif]-->
|
|
|
|
<![endif]-->
|
|
|
|
<!-- 自动适配移动端与pc端 -->
|
|
|
|
<!-- 自动适配移动端与pc端 -->
|
|
|
|
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.3.3/scripts/kit.js"
|
|
|
|
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/1.0.6/scripts/wsdk.js,h5.openim.kit/0.4.0/scripts/kit.js"
|
|
|
|
charset="utf-8"></script>
|
|
|
|
charset="utf-8"></script>
|
|
|
|
|
|
|
|
<script src="https://g.alicdn.com/aliww/h5.openim.sdk/1.0.6/scripts/wsdk.js"></script>
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
window.uid = 'imuser123';
|
|
|
|
window.uid = 'imuser123';
|
|
|
|
window.touid = 'imuser1234';
|
|
|
|
window.touid = 'imuser1234';
|
|
|
@ -20,15 +21,17 @@
|
|
|
|
touid: window.touid,
|
|
|
|
touid: window.touid,
|
|
|
|
logo:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805672266&di=2b24a1579255192f7456d64872c65b39&imgtype=0&src=http%3A%2F%2Fimage.coolapk.com%2Ffeed%2F2016%2F1113%2F661664_1479013815_7771.jpg.m.jpg',
|
|
|
|
logo:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805672266&di=2b24a1579255192f7456d64872c65b39&imgtype=0&src=http%3A%2F%2Fimage.coolapk.com%2Ffeed%2F2016%2F1113%2F661664_1479013815_7771.jpg.m.jpg',
|
|
|
|
toAvatar:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805672266&di=2b24a1579255192f7456d64872c65b39&imgtype=0&src=http%3A%2F%2Fimage.coolapk.com%2Ffeed%2F2016%2F1113%2F661664_1479013815_7771.jpg.m.jpg',
|
|
|
|
toAvatar:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805672266&di=2b24a1579255192f7456d64872c65b39&imgtype=0&src=http%3A%2F%2Fimage.coolapk.com%2Ffeed%2F2016%2F1113%2F661664_1479013815_7771.jpg.m.jpg',
|
|
|
|
|
|
|
|
Avatar:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805672266&di=2b24a1579255192f7456d64872c65b39&imgtype=0&src=http%3A%2F%2Fimage.coolapk.com%2Ffeed%2F2016%2F1113%2F661664_1479013815_7771.jpg.m.jpg',
|
|
|
|
|
|
|
|
|
|
|
|
pluginUrl: 'http://192.168.0.43:9001/service_contact_list.html?uid='
|
|
|
|
pluginUrl: 'http://192.168.0.43:9001/service_contact_list.html?uid='
|
|
|
|
+ window.uid,
|
|
|
|
+ window.uid,
|
|
|
|
onLoginSuccess: function (data) {
|
|
|
|
onLoginSuccess: function (data) {
|
|
|
|
WKIT.Conn.sdk.Event.on('MSG_RECEIVED', function (data) {
|
|
|
|
WKIT.Conn.sdk.Event.on('MSG_RECEIVED', function (data) {
|
|
|
|
|
|
|
|
|
|
|
|
updateContractList(data.data);
|
|
|
|
updateContractList(data.data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
initUnreadMsgAndContact();
|
|
|
|
initUnreadMsgAndContact();
|
|
|
|
WKIT.Conn.sdk.Base.startListenAllMsg();
|
|
|
|
WKIT.Conn.sdk.Base.startListenAllMsg();
|
|
|
|
|
|
|
|
window.sdk =document.getElementById("J_wkitPluginFrame").contentWindow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -36,8 +39,8 @@
|
|
|
|
function switchTouid(touid) {
|
|
|
|
function switchTouid(touid) {
|
|
|
|
WKIT.switchTouid({
|
|
|
|
WKIT.switchTouid({
|
|
|
|
touid: touid,
|
|
|
|
touid: touid,
|
|
|
|
logo:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531805672266&di=2b24a1579255192f7456d64872c65b39&imgtype=0&src=http%3A%2F%2Fimage.coolapk.com%2Ffeed%2F2016%2F1113%2F661664_1479013815_7771.jpg.m.jpg',
|
|
|
|
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',
|
|
|
|
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'
|
|
|
|
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({
|
|
|
|
WKIT.Conn.sdk.Chat.setReadState({
|
|
|
@ -50,8 +53,8 @@
|
|
|
|
console.log('set read state fail', error);
|
|
|
|
console.log('set read state fail', error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.unreadMap[touid] = 0;
|
|
|
|
window.sdk.unreadMap[touid] = 0;
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.loadContactList();
|
|
|
|
window.sdk.loadContactList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function initUnreadMsgAndContact() {
|
|
|
|
function initUnreadMsgAndContact() {
|
|
|
@ -60,7 +63,7 @@
|
|
|
|
success: function (data) {
|
|
|
|
success: function (data) {
|
|
|
|
var cnts = data.data.cnts;
|
|
|
|
var cnts = data.data.cnts;
|
|
|
|
for (var i = cnts.length - 1; i >= 0; i--) {
|
|
|
|
for (var i = cnts.length - 1; i >= 0; i--) {
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.unreadMap[WKIT.Conn.sdk.Base.getNick(cnts[i].to)] = 0;
|
|
|
|
window.sdk.unreadMap[WKIT.Conn.sdk.Base.getNick(cnts[i].to)] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getUnreadMsgCount();
|
|
|
|
getUnreadMsgCount();
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -76,10 +79,10 @@
|
|
|
|
success: function (data) {
|
|
|
|
success: function (data) {
|
|
|
|
var unreads = data.data;
|
|
|
|
var unreads = data.data;
|
|
|
|
for (var i = unreads.length - 1; i >= 0; i--) {
|
|
|
|
for (var i = unreads.length - 1; i >= 0; i--) {
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.unreadMap[ WKIT.Conn.sdk.Base.getNick(unreads[i].contact)] =
|
|
|
|
window.sdk.unreadMap[ WKIT.Conn.sdk.Base.getNick(unreads[i].contact)] =
|
|
|
|
unreads[i].msgCount;
|
|
|
|
unreads[i].msgCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.loadContactList();
|
|
|
|
window.sdk.loadContactList();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
error: function (error) {
|
|
|
|
error: function (error) {
|
|
|
|
console.log('get recent contact fail', error);
|
|
|
|
console.log('get recent contact fail', error);
|
|
|
@ -90,12 +93,12 @@
|
|
|
|
function updateContractList(data) {
|
|
|
|
function updateContractList(data) {
|
|
|
|
var msg = data.msgs[0];
|
|
|
|
var msg = data.msgs[0];
|
|
|
|
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
|
|
|
|
var msg_uid = WKIT.Conn.sdk.Base.getNick(msg.from);
|
|
|
|
if (document.getElementById("J_wkitPluginFrame").contentWindow.unreadMap[msg_uid]) {
|
|
|
|
if (window.sdk.unreadMap[msg_uid]) {
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.unreadMap[msg_uid] = document.getElementById("J_wkitPluginFrame").contentWindow.unreadMap[msg_uid] + 1;
|
|
|
|
window.sdk.unreadMap[msg_uid] = window.sdk.unreadMap[msg_uid] + 1;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.unreadMap[msg_uid] = 1;
|
|
|
|
window.sdk.unreadMap[msg_uid] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
document.getElementById("J_wkitPluginFrame").contentWindow.loadContactList();
|
|
|
|
window.sdk.loadContactList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
</html>
|
|
|
|
</html>
|