shareDetails.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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, {
  31. }, 'GET').then(res=> {
  32. console.log(res.data);
  33. if (res.errno === 0) {
  34. this.setData({
  35. zzyAllWorker:util.forMatTime(res.data.zzyAllWorker),
  36. zzyCurrDayWorker:util.forMatTime(res.data.zzyCurrDayWorker),
  37. zzyMonthWorker:util.forMatTime(res.data.zzyMonthWorker),
  38. zzyCount:res.data.zzyCount,
  39. detailList:util.forMatTime(res.data.zzyAllWorker)
  40. })
  41. // console.log(this.data.zzyCurrDayWorker);
  42. // console.log("222",this.data.detailList);
  43. }else{
  44. wx.showToast({
  45. title: res.errmsg,
  46. icon:'none'
  47. })
  48. }
  49. });
  50. },
  51. /**
  52. * 生命周期函数--监听页面隐藏
  53. */
  54. onHide() {
  55. },
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload() {
  60. },
  61. /**
  62. * 页面相关事件处理函数--监听用户下拉动作
  63. */
  64. onPullDownRefresh() {
  65. },
  66. /**
  67. * 页面上拉触底事件的处理函数
  68. */
  69. onReachBottom() {
  70. },
  71. /**
  72. * 用户点击右上角分享
  73. */
  74. onShareAppMessage() {
  75. },
  76. onTabChange(e){
  77. this.setData({
  78. showType:e.currentTarget.dataset.tab
  79. })
  80. if(e.currentTarget.dataset.tab==0){
  81. this.setData({
  82. detailList:this.data.zzyAllWorker
  83. })
  84. }else if(e.currentTarget.dataset.tab==1){
  85. this.setData({
  86. detailList:this.data.zzyMonthWorker
  87. })
  88. }else if(e.currentTarget.dataset.tab==2) {
  89. this.setData({
  90. detailList:this.data.zzyCurrDayWorker
  91. })
  92. }
  93. },
  94. goPoster(){
  95. wx.navigateTo({
  96. url: '/pages/master/poster/poster?rid='+this.data.rid,
  97. })
  98. }
  99. })