// app.js App({ onLaunch(){ var that =this wx.getSystemInfo({ success(res) { //获取屏幕的宽成功 that.globalData.screenWidth =res.screenWidth that.globalData.screenHeight=res.screenHeight }}) let user_storage=wx.getStorageSync("user_storage") || null let userInfo=wx.getStorageSync("userInfo") || null if(user_storage){ let token =user_storage.token let uid = user_storage.uid this.globalData.token=token this.globalData.uid=uid this.globalData.userInfo=userInfo } }, globalData: { userInfo: null,token: null, uid: null } })