Commit 8d7825fb by 梁建民

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

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