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) { check: function(cb) {
var that = this; var that = this;
if (app.globalData.userInfo) { if (wx.getStorageSync("userInfo")) {
wx.setStorageSync("userInfo", app.globalData.userInfo); // wx.setStorageSync("userInfo", app.globalData.userInfo);
typeof cb == "function" && cb(app.globalData.userInfo); // typeof cb == "function" && cb(app.globalData.userInfo);
typeof cb == "function" && cb(wx.getStorageSync("userInfo"));
} else { } else {
wx.getSetting({ wx.getSetting({
success: function(res) { success: function(res) {
@ -183,7 +184,7 @@ Page({
app.globalData.userInfo = response.data.userInfo; app.globalData.userInfo = response.data.userInfo;
wx.setStorageSync("userInfo", response.data.userInfo); wx.setStorageSync("userInfo", response.data.userInfo);
wx.setStorageSync('token', response.data.userInfo.token); 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) { showLoginModal: function(cb) {
var that = this; var that = this;
if (!app.globalData.userInfo) { if (!wx.getStorageSync("userInfo")) {
//获取用户信息 //获取用户信息
wx.getSetting({ wx.getSetting({
success: function(sres) { success: function(sres) {
@ -241,7 +242,7 @@ Page({
} }
}); });
} else { } else {
typeof cb == "function" && cb(app.globalData.userInfo); typeof cb == "function" && cb(wx.getStorageSync("userInfo"));
} }
}, },
globalData: { globalData: {

@ -149,8 +149,8 @@ Page({
var getuser = wx.getStorageSync("userInfo"); var getuser = wx.getStorageSync("userInfo");
if(getuser){ if(getuser){
this.data.user_id = getuser.id; this.data.user_id = getuser.id;
}else if(app.globalData.userInfo){ }else if(wx.getStorageSync("userInfo")){
this.data.user_id = app.globalData.userInfo.id; this.data.user_id = wx.getStorageSync("userInfo").id;
}else{ }else{
wx.navigateTo({ wx.navigateTo({
url: '/page/login/login', url: '/page/login/login',

Loading…
Cancel
Save