Commit 964ac899 by 施宇

sy

parent 6ca1f1fa
......@@ -18,9 +18,11 @@ App({
customerNum: "001",
customerName: "IC助手客服",
isRelogin: true, //登入环信失败后是否重新登入,只允许重新登入一次
bus: bus
bus: bus,
imBoolean:false,
},
getImUser: chat.getImUser,
conn: chat.conn,
addChatMember: function(id, userId) { //id为环信id userId为账户id
let token = wx.getStorageSync('access_token') || '';
......@@ -56,12 +58,12 @@ App({
// url: '/pages/tab/home/home'
// });
} else {
wx.redirectTo({
wx.reLaunch({
url: '/pages/person/login/index'
});
}
} else {
wx.redirectTo({
wx.reLaunch({
url: '/pages/person/auth/index'
});
}
......
......@@ -46,7 +46,6 @@ Component({
url: "/pages/list/xj/index?type=1&inquiryItemsId=" + inquiryItemsId
})
} else if (type == 2) {
console.log(111)
wx.navigateTo({
url: "/pages/list/xj/index?type=2&inquiryItemsId=" + inquiryItemsId + '&offerId=' + offerId
})
......
......@@ -140,7 +140,7 @@
<text class="address ellipsis">备注:{{item.remark||'--'}}</text>
</view>
</view>
</block>
</block>
<!-- 商品管理 -->
<block wx:if="{{priceType == 5}}">
<view class="price-item good-item" wx:for="{{priceList}}" wx:key="{{index}}" bindtap="emitevent" data-goodid="{{item.goods_id}}" data-pricetype="5">
......
......@@ -84,11 +84,18 @@ Page({
if (res.confirm) {
http.getData(apis.authLogout, 'POST', null, (res) => {
if (res.errcode === 0) {
wx.switchTab({
url: '/pages/tab/home/home'
// wx.switchTab({
// url: '/pages/tab/home/home'
// });
wx.reLaunch({
url: '/pages/person/auth/index',
});
wx.removeStorageSync('access_token');
wx.removeStorageSync('user_id');
wx.removeStorageSync('myUsername');
wx.removeStorageSync('myPassword');
wx.removeStorageSync('auth');
} else {
wx.showToast({
title: res.errmsg,
......
......@@ -26,11 +26,11 @@ Page({
*/
onLoad: function (options) {
let me = this;
wx.removeStorageSync('homeToken')
// wx.removeStorageSync('homeToken')
this.getData();
if (!judgeToken()) {
wx.setStorageSync('homeToken', 1)
};
// if (!judgeToken()) {
// wx.setStorageSync('homeToken', 1)
// };
getApp().globalData.bus.on('addXj', () => {
if(me.data.xb == 1){
me.getData();
......@@ -135,13 +135,13 @@ Page({
*/
onShow: function () {
this.getTopData();
if (judgeToken()) {
if (wx.getStorageSync('homeToken')) {
this.getData();
wx.removeStorageSync('homeToken')
}
// if (judgeToken()) {
// if (wx.getStorageSync('homeToken')) {
// this.getData();
// wx.removeStorageSync('homeToken')
// }
}
// }
},
......
......@@ -155,7 +155,6 @@ Page({
onShow: function () {
let my = wx.getStorageSync("myUsername");
let token = wx.getStorageSync('access_token') || '';
let im = wx.getStorageSync('im') || '';
this.getSys(token) //获取系统消息
if (getApp().globalData.customerNum != my) {
this.getCustom();
......@@ -171,7 +170,7 @@ Page({
arr: this.getChatList(),
userId: wx.getStorageSync('user_id'),
});
if (wx.getStorageSync('im')) {
if (getApp().globalData.imBoolean) {
reloginIm()
}
......
......@@ -102,8 +102,7 @@ const webimListen = () => {
let my = wx.getStorageSync('myUsername') || '';
WebIM.conn.listen({
onOpened(message) {
let im = wx.getStorageSync('im');
wx.removeStorageSync('im');
let im = getApp().globalData.imBoolean;
if (im) {
wx.showToast({
title: "登录成功",
......@@ -130,7 +129,7 @@ const webimListen = () => {
// icon: 'none',
// duration: 2000
// });
me.conn.closed = true;
conn.closed = true;
WebIM.conn.close();
},
onCmdMessage(message) {
......@@ -177,14 +176,14 @@ const webimListen = () => {
},
// 各种异常
onError(error) {
if (error.type == 8) {
if (error.type == 8) {//异地登录
let pages = getCurrentPages();
let curPage = pages[pages.length - 1];
wx.setStorageSync('im', true);
getApp().globalData.imBoolean = true;
if (curPage.route == "pages/detail/chat/index" || curPage.route == 'pages/tab/message/message') {
reloginIm()
}
} else if (error.type == 1) {
} else if (error.type == 1) {//用户名或者账号错误
if (getApp().globalData.isRelogin) {
getApp().globalData.isRelogin = false;
registerIm()
......
......@@ -270,11 +270,11 @@ const judgeToken = (boolen) => {
} else {
if (boolen) {
if (wx.getStorageSync('auth')) {
wx.redirectTo({
wx.reLaunch({
url: '/pages/person/login/index'
})
} else {
wx.redirectTo({
wx.reLaunch({
url: '/pages/person/auth/index'
})
}
......@@ -321,10 +321,9 @@ const reloginIm = ()=>{
confirmText: "重新登录",
success: function (res) {
if (res.confirm) {
wx.showLoading();
setTimeout(() => {
getApp().getImUser()
}, 1000)
wx.showLoading();
getApp().conn.closed = true;
getApp().conn.reopen();
} else if (res.cancel) {
wx.switchTab({
url: '/pages/tab/home/home'
......
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