Commit e75acfb6 by 施宇

111

parent 75425bcc
Showing with 38 additions and 7 deletions
......@@ -5,6 +5,7 @@ $(function () {
appName: "icsales",
defaultName: "001",
customerNum: "",
customerP: "",
templateObj: JSON.parse(Util.getCookie('template') || "{}"),
customerText: Util.getCookie('customer') || "",
isLoginSuccess: false,
......@@ -12,6 +13,7 @@ $(function () {
img: "",
name: "",
id: "",
isRelogin: true,
init: function () {
if (this.ieFun()) {
this.getUserInfo();
......@@ -32,6 +34,12 @@ $(function () {
},
getUserInfo: function () { //获取用户的基本信息
var self = this;
var imN = self.customerNum;
var imP = self.customerP;
if (imN && imP) {
self.getHistoryUsers(imN, imP);
return;
}
IcController.getData(apis.authme, 'GET', {
"token": Util.getCookie('token') || '',
}, function (res) {
......@@ -40,6 +48,7 @@ $(function () {
self.name = res.data.company_name || '--';
self.id = res.data.user_id + '';
self.customerNum = res.data.im_username || '';
self.customerP = res.data.im_password || '';
self.getHistoryUsers(res.data.im_username, res.data.im_password);
} else {
......@@ -594,12 +603,17 @@ $(function () {
title: '提示',
content: '您的聊天账号被迫下线!'
});
} else if (message.type == 1) {
if (self.isRelogin) {
self.isRelogin = false;
// self.registerIm();
self.registerIm();
} else {
// layer.open({
// title: '提示',
// content: '聊天系统出现异常!'
// });
layer.open({
title: '提示',
content: '聊天系统登录失败'
});
}
}
// layer.msg('聊天系统出错');
}, //失败回调;
......@@ -631,11 +645,24 @@ $(function () {
try {
this.conn.open(options);
} catch (e) {
console.log(e);
layer.msg('登入失败');
this.deleteCookie();
}
},
registerIm: function () {
var me = this;
IcController.getData(apis.authregistim, 'post', {
"token": Util.getCookie('token') || ''
}, function (res) {
if (res.errcode == 0) {
me.getUserInfo();
} else {
layer.open({
title: '提示',
content: '聊天系统出现异常'
});
}
}, false)
},
scrollToTop: function (userId) {
var imgLen = $('#' + userId).find('img').length;
if (!imgLen) {
......
......@@ -166,6 +166,10 @@
* 环信通讯记录列表(最多显示30条最新的聊天记录)
*/
listrecord: user_url + '/im/list/record',
/***
* 手动注册im账号
*/
authregistim: auth_url + '/auth/registIMUser',
/**
* 批量上传商品列表
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment