代码如下:
onPullDownRefresh: function () {
const that = this
db.collection('settings').doc('deadline').get().then(res => {
let { hours, minutes } = res.data
this.setData({ hours, minutes })
})
db.collection('users').doc(app.globalData.userInfo.id).get().then(res => {
console.log(res)
app.globalData.userInfo = res.data.userInfo
app.globalData.userInfo.id = res.data._id
that.setData({
checked: app.globalData.userInfo.last_checkin_at.toDateString() === new Date().toDateString(),
userInfo: res.data.userInfo
})
if (app.globalData.userInfo.type === '副院长') {
db.collection('classes').doc('class_set').get().then(res => {
let allClasses = []
for (let major of res.data.major[app.globalData.userInfo.department]) {
allClasses.push(...res.data.class_[major])
}
this.setData({ allClasses: allClasses.sort() })
})
}
}).catch(err => {
// 用户不存在
}).finally(res => {
wx.stopPullDownRefresh()
})
}
报错信息: