|
|
@ -143,6 +143,11 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.users = redata.data;
|
|
|
|
this.users = redata.data;
|
|
|
|
this.currentGuest = redata.data[0].uid;
|
|
|
|
this.currentGuest = redata.data[0].uid;
|
|
|
|
|
|
|
|
for(i=0;i<redata.data.length;i++){
|
|
|
|
|
|
|
|
if (typeof (this.msgListUser[redata.data[i].uid]) == "undefined") {
|
|
|
|
|
|
|
|
this.msgListUser[redata.data[i].uid] = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (redata.type == "chatMessage") {
|
|
|
|
if (redata.type == "chatMessage") {
|
|
|
@ -166,7 +171,12 @@
|
|
|
|
talkTo(guestId) {
|
|
|
|
talkTo(guestId) {
|
|
|
|
this.currentGuest = guestId;
|
|
|
|
this.currentGuest = guestId;
|
|
|
|
this.msgList = [];
|
|
|
|
this.msgList = [];
|
|
|
|
this.msgList=this.clone(this.msgListUser[guestId]);
|
|
|
|
let buf = [];
|
|
|
|
|
|
|
|
var i = this.msgListUser[guestId].length;
|
|
|
|
|
|
|
|
while (i--) {
|
|
|
|
|
|
|
|
buf[i] = this.msgListUser[guestId][i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.msgList = buf;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//发送给客户
|
|
|
|
//发送给客户
|
|
|
|
chatToUser() {
|
|
|
|
chatToUser() {
|
|
|
@ -194,26 +204,6 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.msgListUser[this.currentGuest].push(content);
|
|
|
|
this.msgListUser[this.currentGuest].push(content);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
clone(Obj){
|
|
|
|
|
|
|
|
var buf;
|
|
|
|
|
|
|
|
if(Obj instanceof Array){
|
|
|
|
|
|
|
|
buf=[];
|
|
|
|
|
|
|
|
var i=Obj.length;
|
|
|
|
|
|
|
|
while(i--){
|
|
|
|
|
|
|
|
buf[i]=clone(Obj[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
|
|
|
|
}else if(Obj instanceof Object){
|
|
|
|
|
|
|
|
buf={};
|
|
|
|
|
|
|
|
for(var k in Obj){
|
|
|
|
|
|
|
|
buf[k]=clone(Obj[k]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
return Obj;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created: function () {
|
|
|
|
created: function () {
|
|
|
|
this.getOnlineUsers();
|
|
|
|
this.getOnlineUsers();
|
|
|
|