From d06d21fe00922a7361d2a2720c4c72fb203ae837 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Mon, 14 Oct 2019 16:38:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B6=E6=94=BFhome=E9=A1=B5=E7=9A=84666?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/mcenter/mcenter.js | 72 ++++------------------------------------ 1 file changed, 6 insertions(+), 66 deletions(-) diff --git a/pages/mcenter/mcenter.js b/pages/mcenter/mcenter.js index 09d3864..2fbeb62 100644 --- a/pages/mcenter/mcenter.js +++ b/pages/mcenter/mcenter.js @@ -45,70 +45,7 @@ Page({ }, onLoad: function () { - // this.setData({ - // sessionId: wx.getStorageSync('sessionId') - // }) - // let that = this; - // wx.request({ - // url: app.gw.hostUrl + '/mall/wxa/user/baseinfo', - // data: {}, - // header: { - // "Content-Type": "application/json", - // 'sessionId': wx.getStorageSync('sessionId') - // }, - // method: 'GET', - // dataType: 'json', - // responseType: 'text', - // success: function (res) { - // var data = res.data; - // var status = data.code; - // if (status != 0) { - // wx.showToast({ - // title: data.msg, - // icon: 'none', - // duration: 3000 - // }); - // return; - // } - // that.setData({ - // items2: res.data.response - // }) - // }, - // fail: function (res) { - // wx.showToast({ - // title: '网络异常!err:authlogin', - // icon: 'none', - // duration: 2000 - // }); - // }, - // complete: function (res) { }, - // }) - // if (app.globalData.userInfo) { - // this.setData({ - // userInfo: app.globalData.userInfo, - // hasUserInfo: true - // }) - // } else if (this.data.canIUse) { - // // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 - // // 所以此处加入 callback 以防止这种情况 - // app.userInfoReadyCallback = res => { - // this.setData({ - // userInfo: res.userInfo, - // hasUserInfo: true - // }) - // } - // } else { - // // 在没有 open-type=getUserInfo 版本的兼容处理 - // wx.getUserInfo({ - // success: res => { - // app.globalData.userInfo = res.userInfo - // this.setData({ - // userInfo: res.userInfo, - // hasUserInfo: true - // }) - // } - // }) - // } + }, onShow: function(){ this.setData({ @@ -128,7 +65,11 @@ Page({ success: function (res) { var data = res.data; var status = data.code; - if (status != 0) { + if (status == 666){ + wx.removeStorageSync('sessionId') + this.setData({ sessionId: null }) + return + } else if (status != 0) { wx.showToast({ title: data.msg, icon: 'none', @@ -147,7 +88,6 @@ Page({ duration: 2000 }); }, - complete: function (res) { }, }) if (app.globalData.userInfo) { this.setData({