more.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // pages/member/more.js
  2. import api from '../../utils/api'
  3. import util from '../../utils/util'
  4. const app = getApp()
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. userInfo: {},
  11. memberInfo: {},
  12. sharePath: 'pages/share/share',
  13. shareInfo: {},
  14. more: true,
  15. moreAnimation: {},
  16. top: true,
  17. mpType: app.globalData.mpType
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad: function (options) {
  23. api.getUserInfo().then(res => {
  24. this.setData({
  25. userInfo: res.data
  26. })
  27. }, err => {
  28. console.log(err)
  29. })
  30. api.getMemberList({
  31. offset: 9999
  32. }).then(res => {
  33. this.setData({
  34. memberInfo: res.data
  35. })
  36. }, err => {
  37. console.log(err)
  38. })
  39. this.getShareInfo()
  40. let animation = wx.createAnimation({})
  41. setInterval(() => {
  42. let top = this.data.top ? '-145rpx' : '-125rpx'
  43. animation.top(top).step()
  44. this.setData({
  45. moreAnimation: animation.export(),
  46. top: !this.data.top
  47. })
  48. }, 500)
  49. },
  50. /**
  51. * 生命周期函数--监听页面初次渲染完成
  52. */
  53. onReady: function () {
  54. },
  55. /**
  56. * 生命周期函数--监听页面显示
  57. */
  58. onShow: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面隐藏
  62. */
  63. onHide: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面卸载
  67. */
  68. onUnload: function () {
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. onPullDownRefresh: function () {
  74. },
  75. /**
  76. * 页面上拉触底事件的处理函数
  77. */
  78. onReachBottom: function () {
  79. },
  80. getShareInfo: function () {
  81. api.getShareInfo({
  82. data: {
  83. path: this.data.sharePath
  84. }
  85. }).then(res => {
  86. this.setData({
  87. shareInfo: res.data
  88. })
  89. }).catch(err => {
  90. console.log('getShare', err)
  91. })
  92. },
  93. shareTo: function () {
  94. this.setData({
  95. more: false
  96. })
  97. }
  98. })