index.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. // #if MP
  71. return {
  72. title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
  73. path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
  74. imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-2.jpg'
  75. }
  76. // #elif ANDROID
  77. return {
  78. title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
  79. userName: 'gh_50f61361ad1d',
  80. path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
  81. imagePath: '/static/375-300-2.jpg',
  82. webpageUrl: 'http://www.efunbox.cn',
  83. withShareTicket: true,
  84. miniprogramType: 1,
  85. scene: 0,
  86. }
  87. // #endif
  88. }
  89. })