yuesuo.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. //index.js
  2. //获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. lastX: 0, //滑动开始x轴位置
  7. lastY: 0, //滑动开始y轴位置
  8. text: "没有滑动",
  9. currentGesture: 0, //标识手势
  10. animationData: {},
  11. loaddisplay: 'none',
  12. showCoverImg: true,
  13. headUrl: undefined,
  14. headBUrl: undefined,
  15. videoUrl: undefined,
  16. checkUrl: undefined,
  17. servicesUrl1: undefined,
  18. servicesUrl2: undefined,
  19. servicesUrl3: undefined,
  20. moonpackagesUrltl1: undefined,
  21. moonpackagesUrltr1: undefined,
  22. moonpackagesUrltr2: undefined,
  23. moonpackagesUrlbl: undefined,
  24. moonpackagesUrlbc: undefined,
  25. moonpackagesUrlbr: undefined,
  26. praise: [],
  27. navData: [{
  28. name: "首页", //文本
  29. current: 0, //是否是当前页,0不是 1是
  30. style: 0, //样式
  31. typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/home.png", //不同图标
  32. typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/homec.png",
  33. fn: 'index' //对应处理函数
  34. }, {
  35. name: "套餐",
  36. current: 0,
  37. style: 0,
  38. typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/packages.png", //不同图标
  39. typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/packagesc.png",
  40. fn: 'packages'
  41. }, {
  42. name: "悦所",
  43. current: 1,
  44. style: 2,
  45. ico: ''
  46. }, {
  47. name: "活动",
  48. current: 0,
  49. style: 0,
  50. typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/promotion.png", //不同图标
  51. typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/promotionc.png",
  52. fn: 'promotion'
  53. }, {
  54. name: "我的",
  55. current: 0,
  56. style: 0,
  57. typea: "https://yuesuo.yueguanjia.com/MiniProgram/images/mine.png", //不同图标
  58. typec: "https://yuesuo.yueguanjia.com/MiniProgram/images/minec.png",
  59. fn: 'mine'
  60. }, ]
  61. },
  62. index: function() {
  63. app.gopage("/pages/index/index");
  64. },
  65. promotion: function() {
  66. app.gopage("/pages/promotion/promotion");
  67. },
  68. yuesuo: function() {
  69. app.gopage("/pages/yuesuo/yuesuo");
  70. },
  71. packages: function() {
  72. app.gopage("/pages/packages/packages");
  73. },
  74. mine: function() {
  75. app.gopage("/pages/mine/mine");
  76. },
  77. onReady: function(res) {
  78. this.videoContext = wx.createVideoContext('myVideo')
  79. },
  80. calling: function() {
  81. wx.makePhoneCall({
  82. phoneNumber: '400-002-2699',
  83. success: function() {
  84. },
  85. fail: function() {
  86. }
  87. })
  88. },
  89. finish: function() {
  90. this.setData({
  91. loaddisplay: 'none'
  92. })
  93. },
  94. onLoad() {
  95. let _this = this;
  96. _this.setData({
  97. navH: app.globalData.navHeight
  98. })
  99. },
  100. // onLoad: function () {
  101. // this.setData({
  102. // loaddisplay: true
  103. // })
  104. // var that = this
  105. // var praiselist = [];
  106. // wx.request({
  107. // url: app.globalData.url + '/getYueSuo',
  108. // method: 'get',
  109. // success: function (res) {
  110. // for (var i = 0; i < res.data.length; i++) {
  111. // if (res.data[i].wy_type == 1) {
  112. // that.setData({
  113. // headUrl: res.data[i].wy_url
  114. // })
  115. // }
  116. // if (res.data[i].wy_type == 2) {
  117. // that.setData({
  118. // videoUrl: res.data[i].wy_url
  119. // })
  120. // }
  121. // if (res.data[i].wy_type == 3) {
  122. // that.setData({
  123. // checkUrl: res.data[i].wy_url
  124. // })
  125. // }
  126. // if (res.data[i].wy_type == 4) {
  127. // if (res.data[i].wy_seq ==1) {
  128. // that.setData({
  129. // servicesUrl1: res.data[i].wy_url
  130. // })
  131. // }
  132. // if (res.data[i].wy_seq == 2) {
  133. // that.setData({
  134. // servicesUrl2: res.data[i].wy_url
  135. // })
  136. // }
  137. // if (res.data[i].wy_seq == 3) {
  138. // that.setData({
  139. // servicesUrl3: res.data[i].wy_url
  140. // })
  141. // }
  142. // }
  143. // if (res.data[i].wy_type == 5) {
  144. // if (res.data[i].wy_position == 'tl1'){
  145. // that.setData({
  146. // moonpackagesUrltl1: res.data[i].wy_url
  147. // })
  148. // }
  149. // if (res.data[i].wy_position == 'tr1') {
  150. // that.setData({
  151. // moonpackagesUrltr1: res.data[i].wy_url
  152. // })
  153. // }
  154. // if (res.data[i].wy_position == 'tr2') {
  155. // that.setData({
  156. // moonpackagesUrltr2: res.data[i].wy_url
  157. // })
  158. // }
  159. // if (res.data[i].wy_position == 'bl') {
  160. // that.setData({
  161. // moonpackagesUrlbl: res.data[i].wy_url
  162. // })
  163. // }
  164. // if (res.data[i].wy_position == 'bc') {
  165. // that.setData({
  166. // moonpackagesUrlbc: res.data[i].wy_url
  167. // })
  168. // }
  169. // if (res.data[i].wy_position == 'br') {
  170. // that.setData({
  171. // moonpackagesUrlbr: res.data[i].wy_url
  172. // })
  173. // }
  174. // }
  175. // if (res.data[i].wy_type == 7) {
  176. // that.setData({
  177. // headBUrl: res.data[i].wy_url
  178. // })
  179. // }
  180. // if (res.data[i].wy_type == 6) {
  181. // praiselist.push(res.data[i].wy_url)
  182. // }
  183. // }
  184. // that.setData({
  185. // praise: praiselist
  186. // })
  187. // }
  188. // })
  189. // },
  190. play: function() {
  191. this.setData({
  192. showCoverImg: false
  193. })
  194. },
  195. playbutton: function() {
  196. this.videoContext = wx.createVideoContext('myVideo');
  197. this.videoContext.play();
  198. },
  199. onShareAppMessage: function() {
  200. return {
  201. title: '悦所-您的私家月嫂服务',
  202. path: '/pages/index/index?skip=1&path=/pages/yuesuo/yuesuo'
  203. }
  204. },
  205. handletouchmove: function(event) {
  206. var currentX = event.touches[0].pageX
  207. var currentY = event.touches[0].pageY
  208. var tx = currentX - this.data.lastX
  209. var ty = currentY - this.data.lastY
  210. var text = ""
  211. //左右方向滑动
  212. if (Math.abs(tx) > Math.abs(ty)) {}
  213. //上下方向滑动
  214. else {
  215. // 向上滑动
  216. var animation = wx.createAnimation({
  217. duration: 500,
  218. timingFunction: 'linear',
  219. })
  220. this.animation = animation
  221. animation.opacity(0).step()
  222. this.setData({
  223. animationData: animation.export()
  224. })
  225. }
  226. //将当前坐标进行保存以进行下一次计算
  227. this.data.lastX = currentX
  228. this.data.lastY = currentY
  229. },
  230. handletouchtart: function(event) {
  231. this.data.lastX = event.touches[0].pageX
  232. this.data.lastY = event.touches[0].pageY
  233. },
  234. //滑动结束事件
  235. handletouchend: function(event) {
  236. this.data.currentGesture = 0;
  237. //滑动结束
  238. var animation = wx.createAnimation({
  239. delay: 500,
  240. duration: 500,
  241. timingFunction: 'linear',
  242. })
  243. this.animation = animation
  244. animation.opacity(1).step()
  245. this.setData({
  246. animationData: animation.export()
  247. })
  248. }
  249. })