|
|
@ -11,9 +11,9 @@ HiChat.prototype = {
|
|
|
|
var _pic=document.body.querySelectorAll("#nickWrapper .img-list li.checked img")[0].src;
|
|
|
|
var _pic=document.body.querySelectorAll("#nickWrapper .img-list li.checked img")[0].src;
|
|
|
|
var curUser={
|
|
|
|
var curUser={
|
|
|
|
nickName:"我",
|
|
|
|
nickName:"我",
|
|
|
|
pic:_pic
|
|
|
|
pic:_pic,
|
|
|
|
|
|
|
|
address:""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(curUser);
|
|
|
|
|
|
|
|
this.socket = io.connect();
|
|
|
|
this.socket = io.connect();
|
|
|
|
this.socket.on('connect', function() {
|
|
|
|
this.socket.on('connect', function() {
|
|
|
|
document.getElementById('info').textContent = '请输入一个昵称:';
|
|
|
|
document.getElementById('info').textContent = '请输入一个昵称:';
|
|
|
@ -43,12 +43,11 @@ HiChat.prototype = {
|
|
|
|
var listDiv=document.getElementById("online-list");
|
|
|
|
var listDiv=document.getElementById("online-list");
|
|
|
|
var str="";
|
|
|
|
var str="";
|
|
|
|
for (var i=0;i<users.length;i++){
|
|
|
|
for (var i=0;i<users.length;i++){
|
|
|
|
str+="<li class='user-span'><img src='"+users[i].pic+"'><div>"+users[i].nickName+"</div></li>";
|
|
|
|
str+="<li class='user-span' title='"+users[i].address+"'><img src='"+users[i].pic+"'><div>"+users[i].nickName+"</div></li>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
listDiv.innerHTML=str;
|
|
|
|
listDiv.innerHTML=str;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.socket.on('newMsg', function(user, msg, color) {
|
|
|
|
this.socket.on('newMsg', function(user, msg, color) {
|
|
|
|
console.log(user);
|
|
|
|
|
|
|
|
that._displayMsg(user, msg, color,"msg");
|
|
|
|
that._displayMsg(user, msg, color,"msg");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.socket.on('newImg', function(user, img, color) {
|
|
|
|
this.socket.on('newImg', function(user, img, color) {
|
|
|
|