evaluation.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // pages/evaluation/evaluation.js
  2. const app = getApp()
  3. const util = require("../../utils/util")
  4. const urlDef = require("../../utils/urls")
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. beginDate: null,
  11. endDate: null,
  12. flag: 0,
  13. list: [
  14. ],
  15. loading: '上拉加载',
  16. flag: 0,
  17. pageNum: 0,
  18. hasNextPage: true,
  19. },
  20. getMore: function (e) {
  21. let id = e.currentTarget.dataset.id;
  22. let item = this.data.list.filter(o => o.id == id)[0]
  23. wx.navigateTo({
  24. url: '/pages/evaluationDetail/evaluationDetail?item=' + JSON.stringify(item)
  25. })
  26. },
  27. /**
  28. * 生命周期函数--监听页面加载
  29. */
  30. onLoad: function (options) {
  31. let now = new Date();
  32. // 显示近7天的预约记录
  33. let ed = util.formatTime(now).substring(0, 10).replace(/\//g, '-')
  34. let bd = ed.substring(0, 5) + '01-01'
  35. const date = new Date()
  36. this.setData({ beginDate: date.getFullYear() + '-01'+"-01", endDate: ed, list: [] });
  37. this.queryList()
  38. },
  39. /**
  40. * 生命周期函数--监听页面初次渲染完成
  41. */
  42. onReady: function () {
  43. },
  44. /**
  45. * 生命周期函数--监听页面显示
  46. */
  47. onShow: function () {
  48. },
  49. /**
  50. * 生命周期函数--监听页面隐藏
  51. */
  52. onHide: function () {
  53. },
  54. /**
  55. * 生命周期函数--监听页面卸载
  56. */
  57. onUnload: function () {
  58. },
  59. /**
  60. * 页面相关事件处理函数--监听用户下拉动作
  61. */
  62. onPullDownRefresh: function () {
  63. },
  64. /**
  65. * 页面上拉触底事件的处理函数
  66. */
  67. onReachBottom: function () {
  68. if (this.data.hasNextPage) {
  69. let pn = this.data.pageNum
  70. this.setData({ loading: '加载中', 'pageNum': ++pn })
  71. this.queryList()
  72. }
  73. },
  74. /**
  75. * 用户点击右上角分享
  76. */
  77. onShareAppMessage: function () {
  78. },
  79. getDates: function (e) {
  80. this.setData({
  81. list: [],
  82. pageNum: 0,
  83. beginDate: e.detail[0],
  84. endDate: e.detail[1],
  85. loading: '加载中'
  86. })
  87. this.queryList()
  88. },
  89. queryList: function () {
  90. const urls = urlDef.urls;
  91. let stu = wx.getStorageSync('student')
  92. let params = { 'q.beginDate': this.data.beginDate, 'q.endDate': this.data.endDate, 'q.studentId': stu.studentId, 'q.orgId': stu.orgId }
  93. params.pageNum = this.data.pageNum
  94. util.apiPost(urls.get_student_comment, params).then(rs => {
  95. let list = rs.list
  96. list.map(o => {
  97. if (o.attendTime) {
  98. o.attendTime = o.attendTime.substring(0, 10)
  99. }
  100. if (o.beginTime) {
  101. o.beginTime = o.beginTime.substring(11, 17)
  102. }
  103. if (o.endTime) {
  104. o.endTime = o.endTime.substring(11, 17)
  105. }
  106. })
  107. this.setData({
  108. 'hasNextPage': rs.hasNextPage,
  109. 'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',
  110. 'list': this.data.list.concat(list)
  111. })
  112. })
  113. }
  114. })