链接登录退出

This commit is contained in:
2020-08-18 15:08:42 +08:00
parent 43e09e977d
commit cb95d1ead1
6 changed files with 46 additions and 59 deletions

View File

@@ -5,8 +5,8 @@
* @Last Modified time: 2020-4-21 15:01:41
*/
// import GoEasyIM from './goeasy-im-1.0.9';
import GoEasyIM from './goeasy-im-1.1.1';
import GoEasyIM from './goeasy-im-1.0.9';
// import GoEasyIM from './goeasy-im-1.1.1';
import restApi from './restapi';
function Friend(uuid, name, avatar,time = "", text = "",date = "",unReadMessage = 0) {
@@ -86,6 +86,7 @@ function IMService() {
IMService.prototype.login = function (uuid, name, avatar) {
//初始化当前用户
this.currentUser = new CurrentUser(uuid, name, avatar);
//初始化联系人信息,包括群
this.initialContacts();
return true;
@@ -205,6 +206,7 @@ IMService.prototype.resetFriendUnReadMessage = function (friend) {
//连接GoEasy
IMService.prototype.connectIM = function () {
//初始化IM相关的监听器
try {
this.initialIMListeners();
@@ -212,6 +214,7 @@ IMService.prototype.connectIM = function () {
console.log(123)
}
try {
console.log(this.currentUser)
this.im.connect({
id: this.currentUser.uuid,
data: {
@@ -245,6 +248,7 @@ IMService.prototype.initialIMListeners = function () {
this.im.on(GoEasyIM.EVENT.DISCONNECTED, () => {
console.log('连接断开.')
this.status = false
this.lianjie = false
});
//监听好友上下线
@@ -832,7 +836,7 @@ IMService.prototype.listenerGroupPresence = function () {
//查询和初始化在线用户列表和在线用户数
IMService.prototype.initialOnlineUsers = function (roomId) {
let self = this;
console.log(roomId)
//查询最新上线的用户列表
this.im.groupHereNow(roomId)
.then(result => {
@@ -851,7 +855,7 @@ IMService.prototype.initialOnlineUsers = function (roomId) {
if (e.code == 401) {
console.log("您还没有开通用户在线状态提醒登录goeasy->我的应用->查看详情->高级功能,自助开通.");
} else {
console.log(e);
console.log(e,1212);
}
});
//获取聊天室在线用户数
@@ -874,7 +878,12 @@ IMService.prototype.subscribePresence = function (roomId) {
}
//订阅聊天室消息
IMService.prototype.subscribeRoomMessage = function (room, user) {
IMService.prototype.subscribeRoomMessage = function (room) {
let user = {
id:this.currentUser.uuid,
nickname:this.currentUser.name,
avatar:this.currentUser.avatar
}
this.room = new Room(room.id, room.name, user);