text: var util = require('../../../utils/util.js');
  var api = require('../../../config/api.js');
  var user = require('../../../services/user.js');
  var app = getApp();
  
  Page({
    data: {
      userInfo: {},
      isLogin: false
    },
    onLoad: function(options) {
      // 页面初始化 options为页面跳转所带来的参数
      console.log(app.globalData)
  
    },
    onReady: function() {
  
    },
    onShow: function() {
  
      let userInfo = wx.getStorageSync('userInfo');
      let token = wx.getStorageSync('token');
  
    
      // 页面显示
      if (userInfo && token) {
        app.globalData.userInfo = userInfo;
        app.globalData.token = token;
        this.setData({
          isLogin: true
        });
      }
  
      this.setData({
        userInfo: app.globalData.userInfo,
      });
  
    },
    onHide: function() {
      // 页面隐藏
  
    },
    onUnload: function() {
      // 页面关闭
    },
    goLogin() {
  
      if (!this.data.isLogin) {
        wx.navigateTo({
          url: '/pages/auth/auth'
        })
      }else{
        wx.navigateTo({
          url: '/pages/user/user?userId=' + app.globalData.userInfo.openId,
        })
      }
    },
  })