shareDetails.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // pages/master/shareDetails/shaerDetails.js
  2. const util = require("../../../utils/util");
  3. const api = require('../../../api/api.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. detailList: [],
  10. showType: 0,
  11. zzyAllWorker: [],
  12. zzyCurrDayWorker: [],
  13. zzyMonthWorker: [],
  14. zzyCount: {}
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad(options) {
  20. },
  21. /**
  22. * 生命周期函数--监听页面初次渲染完成
  23. */
  24. onReady() {
  25. },
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow() {
  30. util.request(api.zzyDetail, {}, 'GET').then(res => {
  31. if (res.errno === 0) {
  32. this.setData({
  33. zzyAllWorker: util.forMatTime(res.data.zzyAllWorker),
  34. zzyCurrDayWorker: util.forMatTime(res.data.zzyCurrDayWorker),
  35. zzyMonthWorker: util.forMatTime(res.data.zzyMonthWorker),
  36. zzyCount: res.data.zzyCount,
  37. detailList: util.forMatTime(res.data.zzyAllWorker)
  38. })
  39. } else {
  40. wx.showToast({
  41. title: res.data,
  42. icon: 'none'
  43. })
  44. }
  45. });
  46. },
  47. /**
  48. * 生命周期函数--监听页面隐藏
  49. */
  50. onHide() {
  51. },
  52. /**
  53. * 生命周期函数--监听页面卸载
  54. */
  55. onUnload() {
  56. },
  57. /**
  58. * 页面相关事件处理函数--监听用户下拉动作
  59. */
  60. onPullDownRefresh() {
  61. },
  62. /**
  63. * 页面上拉触底事件的处理函数
  64. */
  65. onReachBottom() {
  66. },
  67. /**
  68. * 用户点击右上角分享
  69. */
  70. onShareAppMessage() {
  71. },
  72. onTabChange(e) {
  73. this.setData({
  74. showType: e.currentTarget.dataset.tab
  75. })
  76. if (e.currentTarget.dataset.tab == 0) {
  77. this.setData({
  78. detailList: this.data.zzyAllWorker
  79. })
  80. } else if (e.currentTarget.dataset.tab == 1) {
  81. this.setData({
  82. detailList: this.data.zzyMonthWorker
  83. })
  84. } else if (e.currentTarget.dataset.tab == 2) {
  85. this.setData({
  86. detailList: this.data.zzyCurrDayWorker
  87. })
  88. }
  89. },
  90. goPoster() {
  91. wx.navigateTo({
  92. url: '/pages/master/poster/poster?rid=' + this.data.rid,
  93. })
  94. }
  95. })