index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import {
  2. getInviteRanking
  3. } from '~/api/global'
  4. import {
  5. getInviteList
  6. } from '~/api/user'
  7. import event from '~/mixins/event'
  8. Page({
  9. behaviors: [event],
  10. data: {
  11. userInfo: {},
  12. ranking: '',
  13. gap: '',
  14. myCount: '',
  15. userList: [],
  16. inviteList: []
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. async onLoad(options) {
  22. wx.setNavigationBarColor({
  23. frontColor: '#ffffff',
  24. backgroundColor: '#2DCE66'
  25. })
  26. this.setData({
  27. userInfo: getApp().globalData.userInfo
  28. })
  29. let {
  30. list
  31. } = await getInviteList({
  32. pageSize: 9999
  33. })
  34. let {
  35. userList,
  36. ranking,
  37. gap,
  38. myCount
  39. } = await getInviteRanking()
  40. this.setData({
  41. inviteList: list,
  42. userList,
  43. ranking,
  44. gap,
  45. myCount
  46. })
  47. },
  48. jumpIndex() {
  49. wx.switchTab({
  50. url: '/pages/index/index',
  51. })
  52. },
  53. jumpUserInfo({
  54. currentTarget
  55. }) {
  56. if (!currentTarget.dataset.uid) {
  57. return
  58. }
  59. wx.navigateTo({
  60. url: `/pages/personal/index?uid=${currentTarget.dataset.uid}`,
  61. })
  62. },
  63. showTranscript() {
  64. this.selectComponent("#popUp").showModal()
  65. },
  66. closeTranscript() {
  67. this.selectComponent("#popUp").hideModal()
  68. },
  69. onShareAppMessage() {
  70. return {
  71. title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
  72. path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
  73. imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-2.jpg'
  74. }
  75. }
  76. })