packageslist.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //index.js
  2. //获取应用实例
  3. const app = getApp()
  4. var util = require("../../../utils/util.js")
  5. Page({
  6. data: {
  7. lastX: 0, //滑动开始x轴位置
  8. lastY: 0, //滑动开始y轴位置
  9. text: "没有滑动",
  10. currentGesture: 0, //标识手势
  11. animationData: {},
  12. arr: [],
  13. loaddisplay: true
  14. },
  15. onLoad: function(option) {
  16. console.log(option)
  17. let _this = this;
  18. let branche_code = wx.getStorageSync('branche_code');
  19. util.postData(`/getPackageLists?p_branches=${branche_code}&p_type=${option.id}`).then(res => {
  20. _this.setData({
  21. arr: res,
  22. loaddisplay: 'none'
  23. })
  24. })
  25. _this.setData({
  26. navH: app.globalData.navHeight
  27. })
  28. },
  29. hrefPackagedetail: function(e) {
  30. wx.navigateTo({
  31. url: '/pages/packages/packagedetail/packagedetail?p_id=' + e.currentTarget.dataset.id + '&para=' + e.currentTarget
  32. .dataset.pcode
  33. })
  34. },
  35. onShareAppMessage: function() {
  36. return {
  37. title: '悦所-套餐列表',
  38. path: '/pages/index/index?skip=1&path=/pages/packages/packages'
  39. }
  40. },
  41. handletouchmove: function(event) {
  42. // var currentX = event.touches[0].pageX
  43. // var currentY = event.touches[0].pageY
  44. // var tx = currentX - this.data.lastX
  45. // var ty = currentY - this.data.lastY
  46. // var text = ""
  47. // //左右方向滑动
  48. // if (Math.abs(tx) > Math.abs(ty)) {}
  49. // //上下方向滑动
  50. // else {
  51. // // 向上滑动
  52. //
  53. // var animation = wx.createAnimation({
  54. // duration: 500,
  55. // timingFunction: 'linear',
  56. // })
  57. // this.animation = animation
  58. // animation.opacity(0).step()
  59. // this.setData({
  60. // animationData: animation.export()
  61. // })
  62. // }
  63. // //将当前坐标进行保存以进行下一次计算
  64. // this.data.lastX = currentX
  65. // this.data.lastY = currentY
  66. },
  67. handletouchtart: function(event) {
  68. // this.data.lastX = event.touches[0].pageX
  69. // this.data.lastY = event.touches[0].pageY
  70. },
  71. hrefDiff: function(event) {
  72. wx.navigateTo({
  73. url: '/pages/packages/diffpackagedetail/diffpackagedetail?pid=' + event.currentTarget.dataset.pcode
  74. })
  75. },
  76. //滑动结束事件
  77. handletouchend: function(event) {
  78. // this.data.currentGesture = 0;
  79. // //滑动结束
  80. // var animation = wx.createAnimation({
  81. // delay: 500,
  82. // duration: 500,
  83. // timingFunction: 'linear',
  84. // })
  85. // this.animation = animation
  86. // animation.opacity(1).step()
  87. // this.setData({
  88. // animationData: animation.export()
  89. // })
  90. }
  91. })