Commit 8d7825fb by 梁建民

Merge branch 'master' of http://119.23.72.7/shiyu/icsalesProgram

parents c093a03f bff2d0d5
......@@ -45,7 +45,6 @@ App({
wx.setStorageSync("member", member)
},
onLaunch() {
// wx.removeStorageSync('im');
this.versionUpdate();
//验证是否授权
if (this.globalData.auth) {
......@@ -67,6 +66,7 @@ App({
if (judgeToken()) {
WebIM.conn.close();//断开im重新登入
this.getImUser();
}
......
......@@ -198,12 +198,18 @@ Component({
template: template
});
wx.removeStorageSync('template');
if (getApp().globalData.imBoolean) {//im被异地登入
return
}
this.sendTemplateMessage();
};
if (customer) {
this.setData({
userMessage: customer
});
if (getApp().globalData.imBoolean) {//im被异地登入
return
}
this.sendMessage();
}
},
......
......@@ -16,7 +16,6 @@ Page({
onLoad(options) {
let username = JSON.parse(options.username);
this.setData({ username: username });
console.log(username)
if (getApp().globalData.customerNum == username.your){
wx.setNavigationBarTitle({
title: '芯掌柜客服'
......
// pages/tab/message/message.js
let disp = require("../../../utils/broadcast");
let WebIM = require("../../../utils/WebIM")["default"];
// let WebIM = require("../../../utils/WebIM")["default"];
import {
judgeToken,
getData,
......@@ -133,7 +133,6 @@ Page({
img: detail.ext.img,
img1: detail.ext.img1
};
console.log(nameList)
wx.navigateTo({
url: "/pages/detail/chat/index?username=" + JSON.stringify(nameList)
});
......@@ -182,7 +181,6 @@ Page({
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
console.log(wx)
wx.removeStorageSync('is_ShowModal')
},
......@@ -287,7 +285,7 @@ Page({
confirmText: "确定",
success: function (res) {
if (res.confirm) {
if (type == 1) {
if (type == 1) {//删除
getData(apis.addrecord, 'GET', {
"token": token,
"user_id": id,
......@@ -311,59 +309,54 @@ Page({
});
}
}, false);
} else {
list
let list = {
// your: {
// jid: WebIM.config.appkey + '_' + your + '@easemob.com',
// name: your,
// order: 5,
// },
};
list[your] = {
jid: WebIM.config.appkey + '_' + your + '@easemob.com',
name: your,
order: 1,
subscription: 'both',
type:"jid"
}
WebIM.conn.addToBlackList({
list: list,
type: 'jid',
success: function () {
console.log('拉黑成功')
getData(apis.addrecord, 'GET', {
"token": token,
"user_id": id,
status: 2
}, function (res) {
if (res.errcode === 0) {
let member = wx.getStorageSync('member');
let index = member.indexOf(your);
member.splice(index, 1);
wx.setStorageSync('member', member)
wx.removeStorageSync(your + myName);
wx.removeStorageSync("rendered_" + your + myName);
if (currentPage[0]) {
currentPage[0].onShow();
}
} else {
wx.showToast({
title: '加入黑名单失败',
icon: 'none',
duration: 2000
});
}
}, false);
},
error: function () {
wx.showToast({
title: '加入黑名单失败',
icon: 'none',
duration: 2000
});
}
});
} else {//拉入黑名单
// let list = {
// };
// list[your] = {
// jid: WebIM.config.appkey + '_' + your + '@easemob.com',
// name: your,
// order: 1,
// subscription: 'both',
// type:"jid"
// }
// WebIM.conn.addToBlackList({
// list: list,
// type: 'jid',
// success: function () {
// console.log('拉黑成功')
// getData(apis.addrecord, 'GET', {
// "token": token,
// "user_id": id,
// status: 2
// }, function (res) {
// if (res.errcode === 0) {
// let member = wx.getStorageSync('member');
// let index = member.indexOf(your);
// member.splice(index, 1);
// wx.setStorageSync('member', member)
// wx.removeStorageSync(your + myName);
// wx.removeStorageSync("rendered_" + your + myName);
// if (currentPage[0]) {
// currentPage[0].onShow();
// }
// } else {
// wx.showToast({
// title: '加入黑名单失败',
// icon: 'none',
// duration: 2000
// });
// }
// }, false);
// },
// error: function () {
// wx.showToast({
// title: '加入黑名单失败',
// icon: 'none',
// duration: 2000
// });
// }
// });
}
......
......@@ -129,6 +129,7 @@ const webimListen = () => {
duration: 2000
});
}
// WebIM.conn.setPresence();
},
onReconnect() {
// wx.showToast({
......@@ -193,11 +194,11 @@ const webimListen = () => {
onError(error) {
console.log(error)
if (error.type == 8) { //异地登录
WebIM.conn.close();
WebIM.conn.close();//断开im重新登入
let pages = getCurrentPages();
let curPage = pages[pages.length - 1];
getApp().globalData.imBoolean = true;
wx.setStorageSync('is_ShowModal',true)
wx.setStorageSync('is_ShowModal', true);
if (curPage.route == "pages/detail/chat/index" || curPage.route == 'pages/tab/message/message') {
reloginIm()
}
......@@ -212,14 +213,19 @@ const webimListen = () => {
showCancel: false
})
}
} else{
} else if (error.type == 'socket_error'){
wx.showToast({
title: "聊天断开,需重新登入!",
icon: 'none',
duration: 2000
});
disp.fire("em.xmpp.error.sendMsgErr", error);
}else{
wx.showModal({
title: '提示',
content: '聊天系统异常,需要重新登入账号!',
content: '聊天异常,需重新登入!',
showCancel: false
})
disp.fire("em.xmpp.error.sendMsgErr", error);
}
},
});
......
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