tlb.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // pages/hotuser/hotuser.js
  2. const $api = require('../../utils/api.js').API;
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. list:[],
  9. total:0,
  10. page:1,
  11. date:'',
  12. cur:'win'
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad(options) {
  18. $api.getDate().then(res=>{
  19. this.setData({
  20. date:res.data.data,
  21. id:options.match_id
  22. })
  23. this.getData()
  24. })
  25. },
  26. tab(e){
  27. this.setData({
  28. cur:e.target.dataset.id,
  29. list:[],
  30. page:1
  31. })
  32. this.getData()
  33. },
  34. getData:function(){
  35. wx.showNavigationBarLoading()
  36. var list = this.data.list
  37. $api.getTLBlist({match_id:this.data.id,type:this.data.cur,page:this.data.page,page_size:20,stock_date:this.data.date}).then(res=>{
  38. wx.hideNavigationBarLoading()
  39. res.data.data.list.forEach(item => {
  40. list.push(item)
  41. })
  42. this.setData({
  43. list: list,
  44. total: res.data.data.total
  45. })
  46. })
  47. },
  48. next: function () {
  49. if (this.data.list.length < this.data.total) {
  50. const page = this.data.page + 1
  51. this.setData({
  52. page: page
  53. })
  54. this.getData()
  55. }
  56. },
  57. pushHome(e){
  58. if($api.checkUserRole()){
  59. wx.navigateTo({
  60. url: '../homepage/homepage?id=' + e.currentTarget.dataset.match_id + '&user_id=' + e.currentTarget.dataset.user_id,
  61. })
  62. }
  63. },
  64. /**
  65. * 生命周期函数--监听页面初次渲染完成
  66. */
  67. onReady() {
  68. },
  69. /**
  70. * 生命周期函数--监听页面显示
  71. */
  72. onShow() {
  73. },
  74. /**
  75. * 生命周期函数--监听页面隐藏
  76. */
  77. onHide() {
  78. },
  79. /**
  80. * 生命周期函数--监听页面卸载
  81. */
  82. onUnload() {
  83. },
  84. /**
  85. * 页面相关事件处理函数--监听用户下拉动作
  86. */
  87. onPullDownRefresh() {
  88. },
  89. /**
  90. * 页面上拉触底事件的处理函数
  91. */
  92. onReachBottom() {
  93. },
  94. /**
  95. * 用户点击右上角分享
  96. */
  97. onShareAppMessage() {
  98. }
  99. })