liudan 1 year ago
parent 204dfd8965
commit f1b8d5dc2e
  1. 13
      page/begin/begin.js
  2. 4
      page/constitutionAnalyse/constitutionAnalyse.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: {

@ -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',

Loading…
Cancel
Save