Commit 8d410c00 by 施宇

111

parent 60f42551
const WebIM = require("utils/WebIM")["default"]; const WebIM = require("utils/WebIM")["default"];
let chat = require('utils/chat.js'); let chat = require('utils/chat.js');
import { getData } from './utils/util.js'; import { getData, judgeToken } from './utils/util.js';
import { apis } from './utils/api.js'; import { apis } from './utils/api.js';
App({ App({
globalData: { globalData: {
...@@ -64,8 +64,10 @@ App({ ...@@ -64,8 +64,10 @@ App({
}) })
} }
} }
}) });
this.getImUser(); if (judgeToken()){
this.getImUser();
}
chat.webimListen(); chat.webimListen();
this.checkIsIPhoneX(); this.checkIsIPhoneX();
}, },
......
/* pages/detail/chat/index.wxss */ /* pages/detail/chat/index.wxss */
page{ page{
background-color: #fff; background-color: #fff;
height:auto;
} }
\ No newline at end of file
// pages/search/index/index.js // pages/search/index/index.js
import {
getData,
dataEncryption
} from '../../../utils/util.js';
import {
apis
} from '../../../utils/api.js';
Page({ Page({
/** /**
...@@ -6,74 +13,99 @@ Page({ ...@@ -6,74 +13,99 @@ Page({
*/ */
data: { data: {
key: "", key: "",
historyList:[], historyList: [],
rmList:[] rmList: []
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
this.getHotGoods()
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
let storageKeys = wx.getStorageSync('storageKeys') || []; let storageKeys = wx.getStorageSync('storageKeys') || [];
this.setData({ this.setData({
historyList:storageKeys historyList: storageKeys
}) })
}, },
getHotGoods: function() {
let obj = dataEncryption();
let me = this;
getData(apis.hotgoods, 'get', {
timestamp: obj.timestampStr,
random: obj.randomStr,
signature: obj.singnatrueStr
}, function(res) {
if (res.err_code === 0) {
if (res.data.length) {
me.setData({
rmList: res.data
})
} else {
me.setData({
rmList: []
})
}
} else {
me.setData({
rmList: []
})
}
}, true)
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
bindKeyInput: function (e) { bindKeyInput: function(e) {
this.setData({ this.setData({
key: e.detail.value key: e.detail.value
}) })
}, },
confirmTap: function () { confirmTap: function() {
let val = this.data.key; let val = this.data.key;
if (!val.length) { if (!val.length) {
wx.showToast({ wx.showToast({
...@@ -89,15 +121,21 @@ Page({ ...@@ -89,15 +121,21 @@ Page({
}); });
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: "/pages/search/result/index?key="+val url: "/pages/search/result/index?key=" + val
}) })
} }
}, },
deleteHistory:function(){ deleteHistory: function() {
this.setData({ this.setData({
historyList: [] historyList: []
}); });
wx.removeStorageSync('storageKeys') wx.removeStorageSync('storageKeys')
},
toSearch:function(e){
let title = e.target.dataset.title;
wx.navigateTo({
url: "/pages/search/result/index?key=" + title
})
} }
}) })
\ No newline at end of file
...@@ -7,12 +7,7 @@ ...@@ -7,12 +7,7 @@
<view class="rm_search" wx:if="{{rmList.length}}"> <view class="rm_search" wx:if="{{rmList.length}}">
<text class="title beforeLine">热门搜索</text> <text class="title beforeLine">热门搜索</text>
<view class="rm_ls_content row" > <view class="rm_ls_content row" >
<view class="search-item">LM358</view> <view class="search-item" wx:for="{{rmList}}" wx:key="*this" bindtap="toSearch" data-title="{{item.title}}">{{item.title}}</view>
<view class="search-item">TJA1027</view>
<view class="search-item">贴片电阻330k</view>
<view class="search-item">PFB0824GHE</view>
<view class="search-item">T6738-4K</view>
<view class="search-item">ECW-FA2J155J</view>
</view> </view>
</view> </view>
<view class="ls_search" wx:if="{{historyList.length}}"> <view class="ls_search" wx:if="{{historyList.length}}">
...@@ -21,7 +16,7 @@ ...@@ -21,7 +16,7 @@
<text class="icon iconfont iconiconxiantiaoshouji7" bindtap="deleteHistory"></text> <text class="icon iconfont iconiconxiantiaoshouji7" bindtap="deleteHistory"></text>
</view> </view>
<view class="rm_ls_content row"> <view class="rm_ls_content row">
<view class="search-item" wx:for="{{historyList}}" wx:key="*this">{{item}}</view> <view class="search-item" wx:for="{{historyList}}" wx:key="*this" bindtap="toSearch" data-title="{{item}}">{{item}}</view>
</view> </view>
</view> </view>
......
// pages/tab/good/good.js // pages/tab/good/good.js
import { getData } from '../../../utils/util.js'; import { getData, judgeToken } from '../../../utils/util.js';
import { apis } from '../../../utils/api.js'; import { apis } from '../../../utils/api.js';
Page({ Page({
...@@ -20,7 +20,9 @@ Page({ ...@@ -20,7 +20,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.getData() if (judgeToken(true)) {
this.getData();
}
}, },
bindKeyInput: function (e) { bindKeyInput: function (e) {
this.setData({ this.setData({
......
// pages/tab/home/home.js // pages/tab/home/home.js
import { getData } from '../../../utils/util.js'; import {
import { apis } from '../../../utils/api.js'; getData,
judgeToken
} from '../../../utils/util.js';
import {
apis
} from '../../../utils/api.js';
let timer = null;
Page({ Page({
/** /**
...@@ -12,26 +18,37 @@ Page({ ...@@ -12,26 +18,37 @@ Page({
animation: {}, animation: {},
translateY: 0, translateY: 0,
tabIndex: 1, tabIndex: 1,
xb: 1,//1表示询价 2表示报价 xb: 1, //1表示询价 2表示报价
limit: 10,//每页的条数 limit: 10, //每页的条数
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
this.getTopData(); if (judgeToken()) {
this.getData(); this.getData();
} else {
wx.setStorageSync('homeToken', 1)
}
}, },
getTopData: function () { getTopData: function() {
let me = this; let me = this;
let token = wx.getStorageSync('access_token') || '' let token = wx.getStorageSync('access_token') || '';
this.setData({
xjList: [],
translateY: 0,
animation: {},
})
if (timer) {
clearInterval(timer)
}
getData(apis.inquirySearch, 'get', { getData(apis.inquirySearch, 'get', {
"offset": 10, "offset": 10,
"p": 1, "p": 1,
"add_time/order": "desc", "add_time/order": "desc",
"token": token "token": token
}, function (res) { }, function(res) {
let newArr = []; let newArr = [];
if (res.errcode === 0) { if (res.errcode === 0) {
if (res.total == 0) { if (res.total == 0) {
...@@ -43,9 +60,9 @@ Page({ ...@@ -43,9 +60,9 @@ Page({
newArr.push(res.inquiry_list[key]) newArr.push(res.inquiry_list[key])
}; };
let nowDate = Date.parse(new Date()); let nowDate = Date.parse(new Date());
for(let i=0;i<newArr.length;i++){ for (let i = 0; i < newArr.length; i++) {
let etime = newArr[i].add_time*1000; let etime = newArr[i].add_time * 1000;
let usedTime = me.interval(nowDate-etime); let usedTime = me.interval(nowDate - etime);
newArr[i].usedTime = usedTime newArr[i].usedTime = usedTime
} }
me.setData({ me.setData({
...@@ -58,15 +75,10 @@ Page({ ...@@ -58,15 +75,10 @@ Page({
}) })
} else { } else {
let allHeight = (arrLen - 2) * 30; let allHeight = (arrLen - 2) * 30;
let interVal = setInterval(() => { timer = setInterval(() => {
let translateY = me.data.translateY; let translateY = me.data.translateY;
if (translateY + allHeight == 0) { if (translateY + allHeight == 0) {
// clearInterval(interVal);
// let arr = me.data.xjList.concat();
// let arr1 = arr.splice(arrLen-2,arrLen);
// arr = arr1.concat(arr);
me.setData({ me.setData({
// xjList:arr,
translateY: 0 translateY: 0
}) })
me.translateYAnimation(); me.translateYAnimation();
...@@ -89,7 +101,7 @@ Page({ ...@@ -89,7 +101,7 @@ Page({
} }
}, false) }, false)
}, },
getData: function () { getData: function() {
let me = this; let me = this;
let url, token = wx.getStorageSync('access_token') let url, token = wx.getStorageSync('access_token')
if (!token) { if (!token) {
...@@ -103,7 +115,11 @@ Page({ ...@@ -103,7 +115,11 @@ Page({
} else { } else {
url = apis.offerinfo url = apis.offerinfo
} }
getData(url, 'get', { offset: me.data.limit, p: 1, token: token }, function (res) { getData(url, 'get', {
offset: me.data.limit,
p: 1,
token: token
}, function(res) {
if (res.errcode === 0) { if (res.errcode === 0) {
let newArr = []; let newArr = [];
if (me.data.xb == 1) { if (me.data.xb == 1) {
...@@ -124,24 +140,24 @@ Page({ ...@@ -124,24 +140,24 @@ Page({
}, true) }, true)
} }
}, },
interval: function (usedTime){ interval: function(usedTime) {
let days = Math.floor(usedTime / (24 * 3600 * 1000)); let days = Math.floor(usedTime / (24 * 3600 * 1000));
//计算出小时数 //计算出小时数
let leave1 = usedTime % (24 * 3600 * 1000); //计算天数后剩余的毫秒数 let leave1 = usedTime % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
let hours = Math.floor(leave1 / (3600 * 1000)); let hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数 //计算相差分钟数
let leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数 let leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60 * 1000)); let minutes = Math.floor(leave2 / (60 * 1000));
if(days){ if (days) {
return days + "天前"; return days + "天前";
}else{ } else {
if (hours){ if (hours) {
if(minutes){ if (minutes) {
return hours + "小时" + minutes + "分钟前"; return hours + "小时" + minutes + "分钟前";
}else{ } else {
return hours + "小时前"; return hours + "小时前";
} }
}else{ } else {
if (minutes) { if (minutes) {
return minutes + "分钟前"; return minutes + "分钟前";
} else { } else {
...@@ -153,7 +169,7 @@ Page({ ...@@ -153,7 +169,7 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
translateYAnimation: function () { translateYAnimation: function() {
let animation = wx.createAnimation({ let animation = wx.createAnimation({
duration: 1000, duration: 1000,
timingFunction: 'ease', timingFunction: 'ease',
...@@ -164,52 +180,60 @@ Page({ ...@@ -164,52 +180,60 @@ Page({
animation: animation.export() animation: animation.export()
}); });
}, },
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
this.getTopData();
if (judgeToken()) {
if (wx.getStorageSync('homeToken')) {
this.getData();
wx.removeStorageSync('homeToken')
}
}
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
switchTab: function (e) { switchTab: function(e) {
let i = e.currentTarget.dataset.index; let i = e.currentTarget.dataset.index;
if (i == this.data.tabIndex) { if (i == this.data.tabIndex) {
return return
...@@ -233,24 +257,31 @@ Page({ ...@@ -233,24 +257,31 @@ Page({
}, },
toSearch: function () { toSearch: function() {
wx.navigateTo({ wx.navigateTo({
url: '/pages/search/index/index', url: '/pages/search/index/index',
}) })
}, },
toXj: function () { toXj: function() {
wx.navigateTo({ if (judgeToken(true)) {
url: "/pages/form/xj/index" wx.navigateTo({
}) url: "/pages/form/xj/index"
})
}
}, },
fbGood: function () { fbGood: function() {
wx.navigateTo({ if (judgeToken(true)) {
url: "/pages/form/good/index", wx.navigateTo({
}) url: "/pages/form/good/index",
})
}
}, },
toQd: function () { toQd: function() {
wx.navigateTo({ if (judgeToken(true)) {
url: "/pages/list/qd/index" wx.navigateTo({
}) url: "/pages/list/qd/index"
})
}
} }
}) })
\ No newline at end of file
...@@ -60,10 +60,10 @@ ...@@ -60,10 +60,10 @@
</view> </view>
</view> </view>
<view class="price-content"> <view class="price-content">
<view wx:if="{{priceList&&priceList.length==0}}" class="nodata"> <view hidden="{{priceList&&priceList.length!=0}}" class="nodata">
<image src="/res/images/imgs/noxb.png" class="img" style="width:500rpx;"></image> <image src="/res/images/imgs/noxb.png" class="img"></image>
<view class="h3 bold">暂无询报价信息</view> <view class="h3 bold">暂无询报价信息</view>
<view class="p" style="color:#61A0F2;padding-top:20rpx;">您还可以发布询价。</view> <view class="p" style="color:#61A0F2;padding:20rpx 0;" bindtap="toXj">您还可以发布询价。</view>
</view> </view>
<priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="1" xb="{{xb}}"></priceItem> <priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="1" xb="{{xb}}"></priceItem>
</view> </view>
......
...@@ -25,7 +25,9 @@ Page({ ...@@ -25,7 +25,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
if (!http.judgeToken(true)){
return
}
//获取数量统计 //获取数量统计
http.getData(apis.countBusiness, 'GET', { http.getData(apis.countBusiness, 'GET', {
token: wx.getStorageSync('access_token') token: wx.getStorageSync('access_token')
......
// 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 { judgeToken } from '../../../utils/util.js';
Page({ Page({
/** /**
...@@ -18,18 +19,21 @@ Page({ ...@@ -18,18 +19,21 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function(options) { onLoad: function(options) {
let me = this; if (judgeToken(true)) {
let my = wx.getStorageSync("myUsername"); let me = this;
//监听未读消息数 let my = wx.getStorageSync("myUsername");
disp.on("em.xmpp.unreadspot", function(message) { //监听未读消息数
if (getApp().globalData.customerNum != my) { disp.on("em.xmpp.unreadspot", function (message) {
me.getCustom() if (getApp().globalData.customerNum != my) {
} me.getCustom()
me.setData({ }
arr: me.getChatList(), me.setData({
unReadSpotNum: getApp().globalData.unReadMessageNum > 99 ? '99+' : getApp().globalData.unReadMessageNum, arr: me.getChatList(),
unReadSpotNum: getApp().globalData.unReadMessageNum > 99 ? '99+' : getApp().globalData.unReadMessageNum,
});
}); });
}); }
}, },
getCustom: function() { getCustom: function() {
let my = wx.getStorageSync("myUsername"); let my = wx.getStorageSync("myUsername");
......
// pages/tab/price/price.js // pages/tab/price/price.js
import { getData} from '../../../utils/util.js'; import { getData, judgeToken} from '../../../utils/util.js';
import { apis } from '../../../utils/api.js'; import { apis } from '../../../utils/api.js';
Page({ Page({
...@@ -19,7 +19,9 @@ Page({ ...@@ -19,7 +19,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.getData(); if (judgeToken(true)) {
this.getData();
}
}, },
getData:function(){ getData:function(){
let me = this; let me = this;
...@@ -67,7 +69,7 @@ Page({ ...@@ -67,7 +69,7 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
}, },
/** /**
......
...@@ -3,8 +3,7 @@ const so_url = 'http://soapi.icsales.cc'; ...@@ -3,8 +3,7 @@ const so_url = 'http://soapi.icsales.cc';
const offer_url = "http://offerapi.icsales.cc"; const offer_url = "http://offerapi.icsales.cc";
const user_url = 'http://userapi.icsales.cc'; const user_url = 'http://userapi.icsales.cc';
const goods_url = 'http://goodsapi.icsales.cc'; const goods_url = 'http://goodsapi.icsales.cc';
const inquiry_url = 'http://inquiryapi.icsales.cc'; const home_url = 'http://home.icsales.cc';
const index_url = 'http://www.icsales.cc';
const apis = { const apis = {
/** /**
...@@ -192,6 +191,11 @@ const apis = { ...@@ -192,6 +191,11 @@ const apis = {
* 环信通讯记录列表(最多显示30条最新的聊天记录) * 环信通讯记录列表(最多显示30条最新的聊天记录)
*/ */
listrecord: user_url + '/im/list/record', listrecord: user_url + '/im/list/record',
/***
* 获取热门搜索商品
*/
hotgoods: home_url + '/hotgoods',
} }
......
...@@ -12,10 +12,6 @@ let conn = { ...@@ -12,10 +12,6 @@ let conn = {
closed: false, closed: false,
curOpenOpt: {}, curOpenOpt: {},
open(opt) { open(opt) {
/* wx.showLoading({
title: '正在初始化客户端...',
mask: true
}) */
this.curOpenOpt = opt; this.curOpenOpt = opt;
WebIM.conn.open(opt); WebIM.conn.open(opt);
this.closed = false; this.closed = false;
...@@ -30,7 +26,7 @@ let conn = { ...@@ -30,7 +26,7 @@ let conn = {
const calcUnReadSpot = (message) => { const calcUnReadSpot = (message) => {
let myName = wx.getStorageSync("myUsername"); let myName = wx.getStorageSync("myUsername");
let allMembers = wx.getStorageSync("member") || []; //好友 let allMembers = wx.getStorageSync("member") || []; //好友
let count = allMembers.reduce(function(result, curMember, idx) { let count = allMembers.reduce(function (result, curMember, idx) {
let chatMsgs = wx.getStorageSync(curMember.toLowerCase() + myName.toLowerCase()) || []; let chatMsgs = wx.getStorageSync(curMember.toLowerCase() + myName.toLowerCase()) || [];
return result + chatMsgs.length; return result + chatMsgs.length;
}, 0); }, 0);
...@@ -51,7 +47,7 @@ const getImUser = () => { ...@@ -51,7 +47,7 @@ const getImUser = () => {
let token = wx.getStorageSync('access_token') || '' let token = wx.getStorageSync('access_token') || ''
getData(apis.authme, 'get', { getData(apis.authme, 'get', {
"token": token, "token": token,
}, function(res) { }, function (res) {
if (res.err_code == 0) { if (res.err_code == 0) {
wx.setStorageSync('user_id', res.data.user_id + ''); wx.setStorageSync('user_id', res.data.user_id + '');
wx.setStorageSync('avatar', res.data.avatar); wx.setStorageSync('avatar', res.data.avatar);
...@@ -76,10 +72,10 @@ const webimListen = () => { ...@@ -76,10 +72,10 @@ const webimListen = () => {
WebIM.conn.setPresence(); WebIM.conn.setPresence();
}, },
onReconnect() { onReconnect() {
wx.showToast({ // wx.showToast({
title: "重连中...", // title: "重连中...",
duration: 2000 // duration: 2000
}); // });
}, },
onSocketConnected() { onSocketConnected() {
/* wx.showToast({ /* wx.showToast({
...@@ -88,11 +84,11 @@ const webimListen = () => { ...@@ -88,11 +84,11 @@ const webimListen = () => {
}); */ }); */
}, },
onClosed() { onClosed() {
wx.showToast({ // wx.showToast({
title: "网络已断开", // title: "网络已断开",
icon: 'none', // icon: 'none',
duration: 2000 // duration: 2000
}); // });
me.conn.closed = true; me.conn.closed = true;
WebIM.conn.close(); WebIM.conn.close();
}, },
...@@ -106,11 +102,10 @@ const webimListen = () => { ...@@ -106,11 +102,10 @@ const webimListen = () => {
} }
}, },
onTextMessage(message) { onTextMessage(message) {
console.log('接受信息')
if (message) { if (message) {
if (onMessageError(message)) { if (onMessageError(message)) {
if (getApp().globalData.customerNum != message.from) { if (getApp().globalData.customerNum != message.from) {
getApp().addChatMember(message.from); getApp().addChatMemberStorage(message.from);
} }
msgStorage.saveReceiveMsg(message, msgType.TEXT); msgStorage.saveReceiveMsg(message, msgType.TEXT);
} }
...@@ -120,11 +115,10 @@ const webimListen = () => { ...@@ -120,11 +115,10 @@ const webimListen = () => {
}, },
onEmojiMessage(message) { onEmojiMessage(message) {
console.log("onEmojiMessage", message);
if (message) { if (message) {
if (onMessageError(message)) { if (onMessageError(message)) {
if (getApp().globalData.customerNum != message.from) { if (getApp().globalData.customerNum != message.from) {
getApp().addChatMember(message.from); getApp().addChatMemberStorage(message.from);
} }
msgStorage.saveReceiveMsg(message, msgType.EMOJI); msgStorage.saveReceiveMsg(message, msgType.EMOJI);
} }
...@@ -132,11 +126,10 @@ const webimListen = () => { ...@@ -132,11 +126,10 @@ const webimListen = () => {
} }
}, },
onPictureMessage(message) { onPictureMessage(message) {
console.log("onPictureMessage", message);
if (message) { if (message) {
if (onMessageError(message)) { if (onMessageError(message)) {
if (getApp().globalData.customerNum != message.from) { if (getApp().globalData.customerNum != message.from) {
getApp().addChatMember(message.from); getApp().addChatMemberStorage(message.from);
} }
msgStorage.saveReceiveMsg(message, msgType.IMAGE); msgStorage.saveReceiveMsg(message, msgType.IMAGE);
} }
...@@ -145,7 +138,19 @@ const webimListen = () => { ...@@ -145,7 +138,19 @@ const webimListen = () => {
}, },
// 各种异常 // 各种异常
onError(error) { onError(error) {
console.log(error) if (error.type == 8) {
wx.showModal({
title: '提示',
content: '您的聊天账号被迫下线!',
showCancel:false
})
} else {
wx.showModal({
title: '提示',
content: '聊天系统出现异常!',
showCancel: false
})
}
}, },
}); });
}; };
......
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