meeting-cover.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. // pages/meeting-cover/meeting-cover.js
  2. const app = getApp();
  3. const util = require('../../utils/util.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. imgPath: app.globalData.imgPath,
  10. location: '重庆市城市管理局会议厅1楼105会议室',
  11. title: '',
  12. receptionTime: '',
  13. showPart1: true,
  14. showPart2: false,
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. let that = this;
  21. console.info(options)
  22. if (options) {
  23. that.setData({
  24. id: options.id
  25. });
  26. }
  27. util.get({
  28. url: '/api/meeting/info/getByIdNotAuth?id=' + options.id,
  29. success: (res) => {
  30. wx.hideLoading();
  31. console.info('res', res);
  32. // util.toast(JSON.stringify(res))
  33. let datas = res.data.data;
  34. that.setData({
  35. title: datas.title,
  36. receptionTime: util.formatDate(datas.receptionTime, 'yyyy年MM月dd日 HH:mm'),
  37. receptionContent: datas.receptionContent
  38. });
  39. }
  40. });
  41. },
  42. /**
  43. * 生命周期函数--监听页面初次渲染完成
  44. */
  45. onReady: function () {
  46. },
  47. /**
  48. * 生命周期函数--监听页面显示
  49. */
  50. onShow: function () {
  51. },
  52. /**
  53. * 生命周期函数--监听页面隐藏
  54. */
  55. onHide: function () {
  56. },
  57. /**
  58. * 生命周期函数--监听页面卸载
  59. */
  60. onUnload: function () {
  61. },
  62. /**
  63. * 页面相关事件处理函数--监听用户下拉动作
  64. */
  65. onPullDownRefresh: function () {
  66. },
  67. /**
  68. * 页面上拉触底事件的处理函数
  69. */
  70. onReachBottom: function () {
  71. },
  72. /**
  73. * 用户点击右上角分享
  74. */
  75. onShareAppMessage: function () {
  76. // util.toast('点击分享');
  77. let that = this;
  78. that.setData({
  79. showBack: false
  80. });
  81. setTimeout(() => {
  82. that.setData({
  83. showBack: true
  84. });
  85. }, 10000);
  86. return {
  87. title: '会议分享',
  88. path: '/pages/meeting-cover/meeting-cover?id=' + that.data.id,
  89. // imageUrl: '/images/call2x.png'
  90. }
  91. },
  92. /**
  93. * 触摸开始事件
  94. */
  95. touchStart: function (e) {
  96. this.setData({
  97. moveFlag: true,
  98. startY: e.touches[0].pageY,
  99. });
  100. },
  101. /**
  102. * 触摸移动事件
  103. */
  104. touchMove: function (e) {
  105. let that = this;
  106. let endY = e.touches[0].pageY;
  107. let startY = that.data.startY;
  108. if (that.data.moveFlag) {
  109. // 下滑
  110. if (endY - startY > 50) {
  111. console.log("pullDown")
  112. that.setData({
  113. moveFlag: false,
  114. });
  115. if (that.data.showPart1 && that.data.showPart2) {
  116. let ani = wx.createAnimation({
  117. delay: 0,
  118. duration: 800,
  119. });
  120. let ani2 = wx.createAnimation({
  121. delay: 0,
  122. duration: 800,
  123. });
  124. ani.translateY(0).step();
  125. ani2.translateY(0).step();
  126. that.setData({
  127. ani: ani.export(),
  128. ani2: ani2.export(),
  129. });
  130. setTimeout(() => {
  131. that.setData({
  132. showPart1: true,
  133. showPart2: false,
  134. });
  135. }, 1000);
  136. }
  137. }
  138. // 上滑
  139. if (startY - endY > 50) {
  140. console.log("pullup")
  141. that.setData({
  142. moveFlag: false,
  143. });
  144. if (that.data.showPart1 && !that.data.showPart2) {
  145. that.setData({
  146. showPart2: true,
  147. });
  148. let ani = wx.createAnimation({
  149. delay: 0,
  150. duration: 800,
  151. });
  152. let ani2 = wx.createAnimation({
  153. delay: 0,
  154. duration: 800,
  155. });
  156. let windowInfo = wx.getWindowInfo();
  157. // console.info(windowInfo.screenHeight);
  158. ani.translateY(-windowInfo.screenHeight).step();
  159. ani2.translateY(-windowInfo.screenHeight).step();
  160. that.setData({
  161. ani: ani.export(),
  162. ani2: ani2.export(),
  163. });
  164. }
  165. }
  166. }
  167. },
  168. /**
  169. * 触摸结束事件
  170. */
  171. touchEnd: function (e) {
  172. this.setData({
  173. moveFlag: true,
  174. });
  175. },
  176. })