signRecord.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // pages/signFor/record.js
  2. const app=getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. content:[],
  9. pageindex: 1
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. this.getData()
  16. },
  17. getData:function(){
  18. var that=this
  19. app.api.useApi(app.globalData.baseAppUrl + "api/admin/SignFor", {
  20. page: that.data.pageindex
  21. }, "get").then(function (res) {
  22. console.log(res);
  23. if (res.code != 200) {
  24. wx.showLoading({
  25. title: '数据获取失败',
  26. })
  27. that.setData({pageindex: that.data.pageindex -= 1})
  28. setTimeout(function () {
  29. wx.hideLoading();
  30. }, 1000);
  31. } else {
  32. wx.hideLoading();
  33. if (that.data.pageindex == 1) {
  34. that.setData({content: []})
  35. }
  36. if (res.message.data.length > 0) {
  37. that.setData({content: that.data.content.concat(res.message.data)})
  38. } else {
  39. that.setData({pageindex: that.data.pageindex -= 1})
  40. }
  41. }
  42. }).catch(function (err) {
  43. console.log(222);
  44. })
  45. },
  46. /**
  47. * 生命周期函数--监听页面初次渲染完成
  48. */
  49. onReady: function () {
  50. },
  51. /**
  52. * 生命周期函数--监听页面显示
  53. */
  54. onShow: function () {
  55. },
  56. /**
  57. * 生命周期函数--监听页面隐藏
  58. */
  59. onHide: function () {
  60. },
  61. /**
  62. * 生命周期函数--监听页面卸载
  63. */
  64. onUnload: function () {
  65. },
  66. /**
  67. * 页面相关事件处理函数--监听用户下拉动作
  68. */
  69. onPullDownRefresh: function () {
  70. },
  71. /**
  72. * 页面上拉触底事件的处理函数
  73. */
  74. onReachBottom: function () {
  75. this.setData({pageindex:this.data.pageindex+=1})
  76. this.getData()
  77. },
  78. /**
  79. * 用户点击右上角分享
  80. */
  81. onShareAppMessage: function () {
  82. }
  83. })