美甲小程序
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

142 satır
2.7 KiB

  1. // pages/pageSerchDetail/pageSerchDetail.js
  2. const utils = require('../../utils/serve')
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. searchData: [],
  9. paginate: null,
  10. p: 1,
  11. total: 0,
  12. },
  13. skipSearch: function () {
  14. wx.navigateTo({
  15. url: '/pages/pageSearch/pageSearch',
  16. })
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad: function (options) {
  22. this.data.finData = (JSON.parse(options.param))
  23. this.init()
  24. wx.setNavigationBarTitle({
  25. title: JSON.parse(options.param).name
  26. })
  27. },
  28. init: function () {
  29. utils.http({
  30. url: '/manicureApi/Index/finishedProduct',
  31. method: 'GET',
  32. data: {
  33. color_id: this.data.finData.id,
  34. p: this.data.p,
  35. limit: 40,
  36. }
  37. }).then(res => {
  38. if (this.data.p >= 2) {
  39. this.setData({
  40. searchData: this.data.searchData.concat(res.data.lists),
  41. }, () => {
  42. this.data.paginate = res.data.paginate
  43. })
  44. } else {
  45. this.setData({
  46. searchData: res.data.lists,
  47. total: res.data.paginate.total
  48. }, () => {
  49. this.data.paginate = res.data.paginate
  50. })
  51. }
  52. })
  53. },
  54. skipDetail: function (ev) {
  55. let param = ev.currentTarget.dataset.param
  56. let obj = {
  57. param: param,
  58. searchData: this.data.searchData,
  59. paginate: this.data.paginate,
  60. finData: this.data.finData
  61. }
  62. wx.navigateTo({
  63. url: '/pages/detailContent/detailContent?obj=' + JSON.stringify(obj),
  64. // success: res => {
  65. // // console.log(res, 123)
  66. // // // 通过eventChannel向被打开页面传送数据
  67. // // res.eventChannel.emit('acceptDataFromOpenerPage', param, this.data.searchData, this.data.paginate, this.data.finData)
  68. // }
  69. })
  70. },
  71. /**
  72. * 生命周期函数--监听页面初次渲染完成
  73. */
  74. onReady: function () {
  75. },
  76. /**
  77. * 生命周期函数--监听页面显示
  78. */
  79. onShow: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面隐藏
  83. */
  84. onHide: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面卸载
  88. */
  89. onUnload: function () {
  90. },
  91. /**
  92. * 页面相关事件处理函数--监听用户下拉动作
  93. */
  94. onPullDownRefresh: function () {
  95. },
  96. /**
  97. * 页面上拉触底事件的处理函数
  98. */
  99. onReachBottom: function () {
  100. if (this.data.searchData.length < this.data.total ) {
  101. this.data.p ++
  102. this.init()
  103. } else {
  104. wx.showToast({
  105. title: '已经到底了~',
  106. duration: 2000,
  107. icon: 'none',
  108. })
  109. }
  110. },
  111. /**
  112. * 用户点击右上角分享
  113. */
  114. onShareAppMessage: function () {
  115. }
  116. })