From e63103fbf3bb6aea46a8be888fe14ad14b98d16b Mon Sep 17 00:00:00 2001 From: Ge Hao Date: Wed, 30 Nov 2016 14:12:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E6=B3=95=E7=99=BB=E5=87=BA=E7=9A=84bu?= =?UTF-8?q?g=EF=BC=9A=20=E8=AE=A9=20=E7=99=BB=E5=BD=95=E5=9C=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96wx=20user=20info=E4=B9=8B=E5=90=8E=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E5=BE=97=E5=88=B0=E6=9C=80=E6=96=B0=E7=9A=84code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/mine/mine.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pages/mine/mine.js b/pages/mine/mine.js index 0f6132f..56ea6c8 100644 --- a/pages/mine/mine.js +++ b/pages/mine/mine.js @@ -30,17 +30,19 @@ Page({ onLoad: function() { var that = this - if (app.globalData.token) { - profile.getCustomerInfo({}, that.infoCallback) - } else { - var token = wx.getStorageSync('userToken') - if (token) { - app.globalData.token = token - profile.getCustomerInfo({}, that.infoCallback) - } - } + app.getUserInfo(function(userInfo){ that.setData({userInfo: userInfo}) + + if (app.globalData.token) { + profile.getCustomerInfo({}, that.infoCallback) + } else { + var token = wx.getStorageSync('userToken') + if (token) { + app.globalData.token = token + profile.getCustomerInfo({}, that.infoCallback) + } + } }) },