lessonsDetail.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // pages/lessonsDetail/lessonsDetail.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. source: null,
  11. target: null,
  12. lessonsList: [],
  13. stayList: [],
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. let o = JSON.parse(options.data)
  20. let s = o.source
  21. let t = o.target
  22. if (t == null || t == undefined) {
  23. const urls = urlDef.urls;
  24. t = {}
  25. this.setData({ lessonsList: [s], target: t })
  26. util.apiPost(urls.makeup_detail + '&q.attenceStudentId=' + s.makeupId).then((rs) => {
  27. t = rs[0]
  28. if (t.beginTime) {
  29. t.beginTime = t.beginTime.replace('T', ' ').substring(0, 16)
  30. }
  31. this.setData({ target: t, stayList: [t] })
  32. });
  33. } else {
  34. if (t.beginTime) {
  35. t.beginTime = t.beginTime.replace('T', ' ').substring(0, 16)
  36. }
  37. this.setData({ target: t, stayList: [t] })
  38. }
  39. },
  40. /**
  41. * 生命周期函数--监听页面初次渲染完成
  42. */
  43. onReady: function () {
  44. },
  45. /**
  46. * 生命周期函数--监听页面显示
  47. */
  48. onShow: function () {
  49. },
  50. /**
  51. * 生命周期函数--监听页面隐藏
  52. */
  53. onHide: function () {
  54. },
  55. /**
  56. * 生命周期函数--监听页面卸载
  57. */
  58. onUnload: function () {
  59. },
  60. /**
  61. * 页面相关事件处理函数--监听用户下拉动作
  62. */
  63. onPullDownRefresh: function () {
  64. },
  65. /**
  66. * 页面上拉触底事件的处理函数
  67. */
  68. onReachBottom: function () {
  69. },
  70. /**
  71. * 用户点击右上角分享
  72. */
  73. onShareAppMessage: function () {
  74. }
  75. })