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 +})