index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // nova-werun/pages/my-circle/index.js
  2. const Parse = getApp().Parse;
  3. const company = getApp().globalData.company;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. //屏幕高度
  10. statusBarHeight: 0, // 状态栏高度
  11. screenHeight: 0, // 屏幕高度
  12. customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
  13. bottomNavHeight: 0, // 底部导航栏高度
  14. contentHeight: 0, // 可用内容高度
  15. contentpadding: 0, //顶部padding高度
  16. //朋友圈
  17. cardList: [],
  18. },
  19. /**
  20. * 生命周期函数--监听页面加载
  21. */
  22. onLoad: function (options) {
  23. // 计算
  24. const systemInfo = wx.getSystemInfoSync();
  25. const statusBarHeight = systemInfo.statusBarHeight || 0;
  26. const screenHeight = systemInfo.screenHeight || 0;
  27. const custom = wx.getMenuButtonBoundingClientRect();
  28. const customHeight = custom.height + 10 + 2 || 0;
  29. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  30. const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  31. this.setData({
  32. statusBarHeight,
  33. screenHeight,
  34. customHeight,
  35. bottomNavHeight,
  36. contentHeight
  37. });
  38. console.log('123', contentHeight);
  39. this.getcircle()
  40. },
  41. /**
  42. * 生命周期函数--监听页面初次渲染完成
  43. */
  44. onReady: function () {
  45. },
  46. /**
  47. * 生命周期函数--监听页面显示
  48. */
  49. onShow: function () {
  50. },
  51. /**
  52. * 生命周期函数--监听页面隐藏
  53. */
  54. onHide: function () {
  55. },
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload: function () {
  60. },
  61. /**
  62. * 页面相关事件处理函数--监听用户下拉动作
  63. */
  64. onPullDownRefresh: function () {
  65. },
  66. /**
  67. * 页面上拉触底事件的处理函数
  68. */
  69. onReachBottom: function () {
  70. },
  71. /**
  72. * 用户点击右上角分享
  73. */
  74. onShareAppMessage: function () {
  75. },
  76. //查全部朋友圈
  77. async getcircle() {
  78. const currentUser = Parse.User.current();
  79. let Profilequery2 = new Parse.Query('Profile');
  80. Profilequery2.equalTo('company', company);
  81. Profilequery2.equalTo('user', currentUser.id);
  82. Profilequery2.equalTo('isCheck', true);
  83. Profilequery2.notEqualTo('isDeleted', true)
  84. let P2 = await Profilequery2.find();
  85. let profile1List2 = P2.map(item => item.toJSON());
  86. let Profilequery = new Parse.Query('AIMoment');
  87. Profilequery.equalTo('company', company);
  88. Profilequery.equalTo('isVisible', true);
  89. Profilequery.notEqualTo('isDeleted', true)
  90. Profilequery.equalTo('profile', profile1List2[0].objectId);
  91. let P = await Profilequery.find();
  92. let profile1List = P.map(item => item.toJSON());
  93. profile1List.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
  94. console.log(profile1List);
  95. this.setData({
  96. cardList: profile1List
  97. })
  98. console.log(this.data.cardList);
  99. },
  100. })