//app.js const utils = require('utils/util.js'); wx.cloud.init(); wx.u = utils App({ onLaunch: function () { const that = this; wx.showLoading(); wx.cloud.callFunction({ name: "quickstartFunctions", data: { type: "getUser" } }).then(res => { if(res.result.code !== 0) return wx.showToast({ title: '网络繁忙', icon: "none" }) that.globalData.userInfo = res.result.data; if(that.haveUserInfo) that.haveUserInfo(); wx.hideLoading(); }).catch(err => { console.log(err) wx.showToast({ title: '服务走丢了~', icon: "none" }) wx.hideLoading(); }) }, globalData: { userInfo: null } }) /** * tab * { "text": "答题", "iconPath": "images/answer.png", "selectedIconPath": "images/answer-select.png", "pagePath": "pages/problemPage/index" }, { "text": "排名", "iconPath": "images/sort.png", "selectedIconPath": "images/sort-select.png", "pagePath": "pages/rank/index" }, { "text": "我的", "iconPath": "images/my.png", "selectedIconPath": "images/my-select.png", "pagePath": "pages/my/index" } */