index.js 858 B

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