import {login} from './api/user'; import { FETCH_AND_FORMAT_USER_INFO } from './utils/util.js' App({ onLaunch() { // 登录 wx.login({ success: async ret => { const res = await login({code:ret.code}); wx.setStorageSync('token', res.data.token_type + ' ' + res.data.access_token); this.globalData.userInfo = await FETCH_AND_FORMAT_USER_INFO(); } }) }, globalData: { userInfo: null, programConfig:null } })