Commit 964ac899 by 施宇

sy

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