From 67b386deeb0bb039e49ac968881d950cecd0b3d5 Mon Sep 17 00:00:00 2001 From: Junling Bu Date: Sat, 31 Mar 2018 21:53:32 +0800 Subject: [PATCH] =?UTF-8?q?fix[litemall-wx]:=20=E5=BD=93=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=BF=94=E5=9B=9E=E6=9C=AA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=B6=EF=BC=8C=E6=B8=85=E9=99=A4=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=9A=84=E7=99=BB=E5=BD=95=E7=9B=B8=E5=85=B3=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litemall-wx/utils/util.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/litemall-wx/utils/util.js b/litemall-wx/utils/util.js index 9ccff630..019c521a 100644 --- a/litemall-wx/utils/util.js +++ b/litemall-wx/utils/util.js @@ -1,4 +1,5 @@ var api = require('../config/api.js'); +var app = getApp(); function formatTime(date) { var year = date.getFullYear() @@ -36,7 +37,16 @@ function request(url, data = {}, method = "GET") { if (res.statusCode == 200) { if (res.data.errno == 401) { - //需要登录后才可以操作 + // 清除登录相关内容 + try { + wx.removeStorageSync('userInfo'); + wx.removeStorageSync('token'); + } catch (e) { + // Do something when catch error + } + // 重置app的未登录状态 + app.globalData.hasLogin = false; + // 切换到登录页面 wx.navigateTo({ url: '/pages/auth/login/login' });