把微信的登录分离到打开应用时

wechat_user_type
Ge Hao 8 years ago
parent 188b11aa9d
commit 94e300feda
  1. 2
      app.js
  2. 23
      pages/mine/mine.js

@ -6,6 +6,8 @@ App({
this.store = new(jsonApi.JsonApiDataStore) this.store = new(jsonApi.JsonApiDataStore)
this.jsonModel = jsonApi.JsonApiDataStoreModel this.jsonModel = jsonApi.JsonApiDataStoreModel
this.globalData.code = wx.getStorageSync('code') this.globalData.code = wx.getStorageSync('code')
this.getUserInfo()
}, },
getUserInfo: function (cb) { getUserInfo: function (cb) {

@ -24,20 +24,18 @@ Page({
onLoad: function() { onLoad: function() {
var that = this var that = this
that.setData({userInfo: app.globalData.userInfo})
app.getUserInfo(function(userInfo){ if (app.globalData.token) {
that.setData({userInfo: userInfo}) profile.getCustomerInfo({}, that.infoCallback)
} else {
if (app.globalData.token) { var token = wx.getStorageSync('userToken')
if (token) {
app.globalData.token = token
profile.getCustomerInfo({}, that.infoCallback) profile.getCustomerInfo({}, that.infoCallback)
} else {
var token = wx.getStorageSync('userToken')
if (token) {
app.globalData.token = token
profile.getCustomerInfo({}, that.infoCallback)
}
} }
}) }
}, },
bindGetPassCode: function(e) { bindGetPassCode: function(e) {
@ -133,5 +131,4 @@ Page({
}) })
}) })
} }
})
})

Loading…
Cancel
Save