master
kira 6 years ago
parent 58ade45bca
commit f4ffe14bfa

@ -3,7 +3,8 @@
<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" charset="utf-8"></script> <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"
charset="utf-8"></script>
<script> <script>
window.uid = 'taki'; window.uid = 'taki';
window.touid = 'mitsuha'; window.touid = 'mitsuha';
@ -17,7 +18,11 @@
credential: 'xxxxxx', credential: 'xxxxxx',
touid: window.touid, touid: window.touid,
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png', logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
pluginUrl: 'http://192.168.0.43:9001/service_contact_list.html?uid='+window.uid pluginUrl: 'http://192.168.0.43:9001/service_contact_list.html?uid='
+ window.uid,
onMsgReceived: function (data) {
document.getElementById("J_wkitPluginFrame").contentWindow.updateContractList(data);
}
}); });
} }
</script> </script>

@ -12,6 +12,7 @@
var sdk = new WSDK(); var sdk = new WSDK();
var queryParam = getQueryString(); var queryParam = getQueryString();
function login() { function login() {
sdk.Base.login({ sdk.Base.login({
uid: queryParam['uid'], uid: queryParam['uid'],
@ -21,7 +22,6 @@
success: function (data) { success: function (data) {
initUnreadMsgAndContact(); initUnreadMsgAndContact();
console.log('login success', data); console.log('login success', data);
sdk.Base.startListenAllMsg();
}, },
error: function (error) { error: function (error) {
console.log('get login msg count fail', error); console.log('get login msg count fail', error);
@ -116,6 +116,16 @@
} }
return args; return args;
} }
function updateContractList(data) {
var msg =data.msgs[0];
var msg_uid = sdk.Base.getNick(msg.from);
if(unreadMap[msg_uid]){
unreadMap[msg_uid] = unreadMap[msg_uid]+1;
}else {
unreadMap[msg_uid] = 1;
}
loadContactList();
}
</script> </script>
<script> <script>
window.onload = function () { window.onload = function () {

@ -3,7 +3,8 @@
<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" charset="utf-8"></script> <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"
charset="utf-8"></script>
<script> <script>
window.onload = function () { window.onload = function () {
WKIT.init({ WKIT.init({
@ -15,7 +16,6 @@
credential: 'xxxxxx', credential: 'xxxxxx',
touid: 'taki', touid: 'taki',
logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png', logo: 'http://img.alicdn.com/tps/i3/TB12LD9IFXXXXb3XpXXSyFWJXXX-82-82.png',
pluginUrl: 'http://www.taobao.com/market/seller/openim/plugindemo.php'
}); });
} }
</script> </script>

Loading…
Cancel
Save