index.js 926 B

123456789101112131415161718192021222324252627282930313233343536
  1. import {
  2. getMessageList
  3. } from '~/api/message'
  4. import event from '~/mixins/event'
  5. import reachBottom from '~/mixins/reachBottom'
  6. Page({
  7. behaviors: [reachBottom,event],
  8. data: {},
  9. onLoad(options) {
  10. this.resetData()
  11. getMessageList({}, 'put')
  12. },
  13. loadMore() {
  14. this.getData(this.getMessageList)
  15. },
  16. getMessageList(data) {
  17. return new Promise(async (reslove) => {
  18. let res = await getMessageList(data)
  19. res.list.forEach(item => {
  20. item.content = item.content.split('\n')
  21. })
  22. reslove(res)
  23. })
  24. },
  25. onReachBottom() {
  26. this.loadMore()
  27. },
  28. onShareAppMessage: function (res) {
  29. const user = wx.getStorageSync('uid');
  30. return {
  31. title: '自从用了它,家里朗朗书声,美妙极了!你家孩子也快来试试!',
  32. path: `/pages/index/index?uid=${user}`,
  33. imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-1.jpg'
  34. }
  35. },
  36. })