index.js 752 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //index.js
  2. //获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. spinShow: false,
  7. groups: [],
  8. pushPaper: [],
  9. timeLimitPaper: [],
  10. taskList: []
  11. },
  12. onLoad: function() {
  13. this.setData({
  14. spinShow: true
  15. });
  16. app.checkLogin( this.indexLoad)
  17. },
  18. onPullDownRefresh() {
  19. this.setData({
  20. spinShow: true
  21. });
  22. if (!this.loading) {
  23. this.indexLoad()
  24. }
  25. },
  26. indexLoad: function() {
  27. let _this = this
  28. app.formPost('Exam.index', {}).then(res => {
  29. _this.setData({
  30. spinShow: false
  31. });
  32. wx.stopPullDownRefresh()
  33. if (res.code === 200) {
  34. console.log( res.data )
  35. _this.setData({
  36. groups: res.data.groups
  37. });
  38. }
  39. })
  40. }
  41. })