diff --git a/page/begin/begin.js b/page/begin/begin.js index d2b90c7..567cc16 100644 --- a/page/begin/begin.js +++ b/page/begin/begin.js @@ -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: { diff --git a/page/constitutionAnalyse/constitutionAnalyse.js b/page/constitutionAnalyse/constitutionAnalyse.js index f63a38f..4d4adb6 100644 --- a/page/constitutionAnalyse/constitutionAnalyse.js +++ b/page/constitutionAnalyse/constitutionAnalyse.js @@ -149,8 +149,8 @@ Page({ var getuser = wx.getStorageSync("userInfo"); if(getuser){ this.data.user_id = getuser.id; - }else if(app.globalData.userInfo){ - this.data.user_id = app.globalData.userInfo.id; + }else if(wx.getStorageSync("userInfo")){ + this.data.user_id = wx.getStorageSync("userInfo").id; }else{ wx.navigateTo({ url: '/page/login/login',