app.js 625 B

12345678910111213141516171819202122232425
  1. var util = require('./utils/util.js');
  2. var api = require('./config/api.js');
  3. var user = require('./services/user.js');
  4. App({
  5. onLaunch: function () {
  6. //获取用户的登录信息
  7. user.checkLogin().then(res => {
  8. console.log('app login')
  9. this.globalData.userInfo = wx.getStorageSync('userInfo');
  10. this.globalData.token = wx.getStorageSync('token');
  11. }).catch(() => {
  12. });
  13. },
  14. globalData: {
  15. userInfo: {
  16. nickname: 'Hi,游客',
  17. username: '点击去登录',
  18. avatar: 'http://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png'
  19. },
  20. token: '',
  21. }
  22. })