meeting-cover.js 5.0 KB

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