From 94e300fedadbf9ea5c26403865f721ee13a0358b Mon Sep 17 00:00:00 2001 From: Ge Hao Date: Wed, 14 Dec 2016 10:55:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E5=BE=AE=E4=BF=A1=E7=9A=84=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=88=86=E7=A6=BB=E5=88=B0=E6=89=93=E5=BC=80=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 2 ++ pages/mine/mine.js | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app.js b/app.js index 4da0bd4..66843f2 100644 --- a/app.js +++ b/app.js @@ -6,6 +6,8 @@ App({ this.store = new(jsonApi.JsonApiDataStore) this.jsonModel = jsonApi.JsonApiDataStoreModel this.globalData.code = wx.getStorageSync('code') + + this.getUserInfo() }, getUserInfo: function (cb) { diff --git a/pages/mine/mine.js b/pages/mine/mine.js index afb5843..88fb542 100644 --- a/pages/mine/mine.js +++ b/pages/mine/mine.js @@ -24,20 +24,18 @@ Page({ onLoad: function() { var that = this + that.setData({userInfo: app.globalData.userInfo}) - app.getUserInfo(function(userInfo){ - that.setData({userInfo: userInfo}) - - if (app.globalData.token) { + if (app.globalData.token) { + profile.getCustomerInfo({}, that.infoCallback) + } else { + var token = wx.getStorageSync('userToken') + if (token) { + app.globalData.token = token profile.getCustomerInfo({}, that.infoCallback) - } else { - var token = wx.getStorageSync('userToken') - if (token) { - app.globalData.token = token - profile.getCustomerInfo({}, that.infoCallback) - } } - }) + } + }, bindGetPassCode: function(e) { @@ -133,5 +131,4 @@ Page({ }) }) } - -}) \ No newline at end of file +})