问星数据小程序

index.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const app = getApp()
  2. Page({
  3. data: {
  4. show:false,
  5. conHeight: (wx.getMenuButtonBoundingClientRect().top +wx.getMenuButtonBoundingClientRect().height)*2 + 330,
  6. backgroundColor:app.data.backgroundColor,
  7. isShow: true,
  8. notice: '公告:“-”代表该视频号预估粉丝增量数据获取异常,对您造成的不便尽请谅解.',
  9. buttonTop: wx.getMenuButtonBoundingClientRect().top,
  10. infoList: [],
  11. isIpx: app.data.systemInfo.isIpx ? true : false, //底部按钮适配Iphone X
  12. rankType:3,
  13. statusNavBarHeight:app.data.statusNavBarHeight,
  14. safeAreaTop:0,//距离上面的安全距离
  15. authorTypeList:[{
  16. id:'',
  17. top_label:'全部'
  18. }],
  19. },
  20. onLoad: function (options) {
  21. this.setData({safeAreaTop:app.data.safeAreaTop})
  22. if (app.globalData.checkLogin){
  23. this.setData({show:true})
  24. this.getAuthorType()
  25. }else{
  26. app.checkLoginReadyCallback = res => {
  27. this.setData({show:true})
  28. this.getAuthorType()
  29. };
  30. }
  31. },
  32. rankTypeClick(e){//头部榜单type
  33. var data = e.currentTarget.dataset
  34. if(this.data.rankType == data.type){
  35. return;
  36. }
  37. this.setData({
  38. rankType: data.type,
  39. })
  40. app.data.sph_type = this.data.rankType
  41. },
  42. getAuthorType(){//获取作者类别
  43. app.func.req('/api/sphUserList/labelList', 'get', {
  44. }, (res) => {
  45. if(res && res.errno == 0){
  46. var arr = [{
  47. id:'',
  48. top_label:'全部'
  49. }]
  50. this.setData({
  51. authorTypeList:arr.concat(res.rst)
  52. })
  53. }else{
  54. wx.showToast({
  55. title: res.err,
  56. icon: 'none',
  57. duration: 2000
  58. })
  59. }
  60. },()=>{
  61. })
  62. },
  63. goSearch() {
  64. wx.navigateTo({
  65. url: '/pages/search/search',
  66. })
  67. },
  68. /**
  69. * 用户点击右上角分享
  70. */
  71. onShareAppMessage: function (res) {
  72. return {
  73. title:'【免费】视频号分析平台,盘点不同分类下互动最好的视频号',
  74. }
  75. }
  76. })