searchRecords.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. // pages/searchRecords/searchRecords.js
  2. const api = require('../../api/index')
  3. const app = getApp()
  4. import { $startWuxRefresher, $stopWuxRefresher,$stopWuxLoader} from '../../miniprogram_npm/wux-weapp/index'
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. tableData:[],
  11. queryParams:{
  12. current:1,
  13. size:10
  14. },
  15. total:0,
  16. loading:false,
  17. imgHttp:app.globalData.imgHttp
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad(options) {
  23. this.init()
  24. },
  25. /**
  26. * 生命周期函数--监听页面初次渲染完成
  27. */
  28. onReady() {
  29. },
  30. /**
  31. * 生命周期函数--监听页面显示
  32. */
  33. onShow() {
  34. },
  35. /**
  36. * 页面功能
  37. */
  38. //初始化加载
  39. init(){
  40. var params = {
  41. current:1,
  42. size:10
  43. }
  44. this.setData(
  45. {
  46. queryParams:params,
  47. total:0,
  48. tableData:[]
  49. }
  50. )
  51. this.getSearchRecords()
  52. },
  53. //下拉
  54. onPulling() {
  55. console.log('onPulling')
  56. },
  57. //下拉刷新
  58. onRefresh() {
  59. console.log('onRefresh')
  60. this.init()
  61. },
  62. //查看图片
  63. previewImage(e) {
  64. const { current,imglist } = e.currentTarget.dataset
  65. var imgs = []
  66. for(var i =0;i<imglist.length;i++){
  67. imgs.push(this.data.imgHttp + imglist[i].guid)
  68. }
  69. current = this.data.imgHttp + current
  70. wx.previewImage({
  71. current,
  72. urls:imgs,
  73. })
  74. },
  75. //获取检索记录
  76. getSearchRecords(){
  77. },
  78. //加载更多
  79. loadMore(){
  80. var current = this.data.queryParams.current
  81. this.setData(
  82. {
  83. ['queryParams.current']:current+1
  84. }
  85. )
  86. this.getSearchRecords()
  87. },
  88. /**
  89. * 生命周期函数--监听页面隐藏
  90. */
  91. onHide() {
  92. },
  93. /**
  94. * 生命周期函数--监听页面卸载
  95. */
  96. onUnload() {
  97. },
  98. /**
  99. * 页面相关事件处理函数--监听用户下拉动作
  100. */
  101. onPullDownRefresh() {
  102. },
  103. /**
  104. * 页面上拉触底事件的处理函数
  105. */
  106. onReachBottom() {
  107. },
  108. /**
  109. * 用户点击右上角分享
  110. */
  111. onShareAppMessage() {
  112. }
  113. })