index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // nova-werun/components/my/index.js
  2. const Parse = getApp().Parse;
  3. const company = getApp().globalData.company;
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. //屏幕高度
  15. statusBarHeight: 0, // 状态栏高度
  16. screenHeight: 0, // 屏幕高度
  17. customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
  18. bottomNavHeight: 0, // 底部导航栏高度
  19. contentHeight: 0, // 可用内容高度
  20. contentpadding: 0, //顶部padding高度
  21. circlecount: 0
  22. },
  23. lifetimes: {
  24. detached: function () {
  25. // 在组件实例被从页面节点树移除时执行
  26. },
  27. attached: async function () {
  28. // 在组件实例进入页面节点树时执行
  29. // 计算
  30. const systemInfo = wx.getSystemInfoSync();
  31. const statusBarHeight = systemInfo.statusBarHeight || 0;
  32. const screenHeight = systemInfo.screenHeight || 0;
  33. const custom = wx.getMenuButtonBoundingClientRect();
  34. const customHeight = custom.height + 10 + 2 || 0;
  35. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  36. const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
  37. const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  38. this.setData({
  39. statusBarHeight,
  40. screenHeight,
  41. customHeight,
  42. bottomNavHeight,
  43. contentHeight,
  44. contentpadding
  45. });
  46. this.getcircle()
  47. },
  48. },
  49. /**
  50. * 组件的方法列表
  51. */
  52. methods: {
  53. gourl(e) {
  54. const url = e.currentTarget.dataset.url
  55. wx.navigateTo({
  56. url: `${url}` // 目标页面的路径
  57. });
  58. },
  59. //查全部朋友圈
  60. async getcircle() {
  61. const currentUser = Parse.User.current();
  62. let Profilequery2 = new Parse.Query('Profile');
  63. Profilequery2.equalTo('company', company);
  64. Profilequery2.equalTo('user', currentUser.id);
  65. Profilequery2.equalTo('isCheck', true);
  66. Profilequery2.notEqualTo('isDeleted', true)
  67. let P2 = await Profilequery2.find();
  68. let profile1List2 = P2.map(item => item.toJSON());
  69. let Profilequery = new Parse.Query('AIMoment');
  70. Profilequery.equalTo('company', company);
  71. Profilequery.equalTo('isVisible', true);
  72. Profilequery.notEqualTo('isDeleted', true)
  73. Profilequery.equalTo('profile', profile1List2[0].objectId);
  74. Profilequery.descending('createdAt');
  75. let count = await Profilequery.count();
  76. if (count) {
  77. this.setData({
  78. circlecount: count
  79. })
  80. }
  81. },
  82. //查看积分
  83. async getpoint(){
  84. }
  85. }
  86. })