v3.0.6
This commit is contained in:
65
source/wx/xzs-student/pages/index/index.js
Normal file
65
source/wx/xzs-student/pages/index/index.js
Normal file
@@ -0,0 +1,65 @@
|
||||
//index.js
|
||||
//获取应用实例
|
||||
const app = getApp()
|
||||
|
||||
Page({
|
||||
data: {
|
||||
spinShow: false,
|
||||
fixedPaper: [],
|
||||
pushPaper: [],
|
||||
timeLimitPaper: [],
|
||||
taskList: []
|
||||
},
|
||||
onLoad: function() {
|
||||
this.setData({
|
||||
spinShow: true
|
||||
});
|
||||
this.indexLoad()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
spinShow: true
|
||||
});
|
||||
if (!this.loading) {
|
||||
this.indexLoad()
|
||||
}
|
||||
},
|
||||
indexLoad: function() {
|
||||
let _this = this
|
||||
app.formPost('/api/wx/student/dashboard/index', null).then(res => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
wx.stopPullDownRefresh()
|
||||
if (res.code === 1) {
|
||||
_this.setData({
|
||||
fixedPaper: res.response.fixedPaper,
|
||||
timeLimitPaper: res.response.timeLimitPaper,
|
||||
pushPaper: res.response.pushPaper
|
||||
});
|
||||
}
|
||||
}).catch(e => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
app.message(e, 'error')
|
||||
})
|
||||
|
||||
app.formPost('/api/wx/student/dashboard/task', null).then(res => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
wx.stopPullDownRefresh()
|
||||
if (res.code === 1) {
|
||||
_this.setData({
|
||||
taskList: res.response,
|
||||
});
|
||||
}
|
||||
}).catch(e => {
|
||||
_this.setData({
|
||||
spinShow: false
|
||||
});
|
||||
app.message(e, 'error')
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user