tempDetails.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. tempLine:[],
  8. pageSize:20
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad: function (options) {
  14. const {chainId,searchTag} = options;
  15. this.getTempLine({chainId,searchTag})
  16. },
  17. getTempLine(params={}){
  18. app.requestP({
  19. url:'/chain/tempLine',
  20. method:'post',
  21. contentType: ' application/json',
  22. data:{
  23. ...params
  24. }
  25. }).then(res=>{
  26. this.setData({
  27. tempLine:res.data.data.temps,
  28. tempLineConcat:res.data.data.temps.slice(0,40)
  29. })
  30. })
  31. },
  32. /**
  33. * 生命周期函数--监听页面初次渲染完成
  34. */
  35. onReady: function () {
  36. },
  37. /**
  38. * 生命周期函数--监听页面显示
  39. */
  40. onShow: function () {
  41. },
  42. /**
  43. * 生命周期函数--监听页面隐藏
  44. */
  45. onHide: function () {
  46. },
  47. /**
  48. * 生命周期函数--监听页面卸载
  49. */
  50. onUnload: function () {
  51. },
  52. /**
  53. * 页面相关事件处理函数--监听用户下拉动作
  54. */
  55. onPullDownRefresh: function () {
  56. },
  57. /**
  58. * 页面上拉触底事件的处理函数
  59. */
  60. onReachBottom: function () {
  61. var that = this;
  62. var pageSize = this.data.pageSize;
  63. if(pageSize >= that.data.tempLine)return;
  64. var temp = that.data.tempLine.slice(0,pageSize+20)
  65. this.setData({
  66. pageSize:pageSize+20,
  67. },()=>{
  68. that.setData({
  69. tempLineConcat:temp
  70. })
  71. })
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage: function () {
  77. }
  78. })