|
|
|
@ -105,9 +105,10 @@ Page({ |
|
|
|
|
}, |
|
|
|
|
check: function(cb) { |
|
|
|
|
var that = this; |
|
|
|
|
if (app.globalData.userInfo) { |
|
|
|
|
wx.setStorageSync("userInfo", app.globalData.userInfo); |
|
|
|
|
typeof cb == "function" && cb(app.globalData.userInfo); |
|
|
|
|
if (wx.getStorageSync("userInfo")) { |
|
|
|
|
// wx.setStorageSync("userInfo", app.globalData.userInfo);
|
|
|
|
|
// typeof cb == "function" && cb(app.globalData.userInfo);
|
|
|
|
|
typeof cb == "function" && cb(wx.getStorageSync("userInfo")); |
|
|
|
|
} else { |
|
|
|
|
wx.getSetting({ |
|
|
|
|
success: function(res) { |
|
|
|
@ -183,7 +184,7 @@ Page({ |
|
|
|
|
app.globalData.userInfo = response.data.userInfo; |
|
|
|
|
wx.setStorageSync("userInfo", response.data.userInfo); |
|
|
|
|
wx.setStorageSync('token', response.data.userInfo.token); |
|
|
|
|
typeof cb == "function" && cb(app.globalData.userInfo); |
|
|
|
|
typeof cb == "function" && cb(wx.getStorageSync("userInfo")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -192,7 +193,7 @@ Page({ |
|
|
|
|
//显示登录或授权提示
|
|
|
|
|
showLoginModal: function(cb) {
|
|
|
|
|
var that = this; |
|
|
|
|
if (!app.globalData.userInfo) { |
|
|
|
|
if (!wx.getStorageSync("userInfo")) { |
|
|
|
|
//获取用户信息
|
|
|
|
|
wx.getSetting({ |
|
|
|
|
success: function(sres) { |
|
|
|
@ -241,7 +242,7 @@ Page({ |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
typeof cb == "function" && cb(app.globalData.userInfo); |
|
|
|
|
typeof cb == "function" && cb(wx.getStorageSync("userInfo")); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
globalData: { |
|
|
|
|