index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. User1List:[]
  23. },
  24. lifetimes: {
  25. detached: function () {
  26. // 在组件实例被从页面节点树移除时执行
  27. },
  28. attached: async function () {
  29. // 在组件实例进入页面节点树时执行
  30. // 计算
  31. const systemInfo = wx.getSystemInfoSync();
  32. const statusBarHeight = systemInfo.statusBarHeight || 0;
  33. const screenHeight = systemInfo.screenHeight || 0;
  34. const custom = wx.getMenuButtonBoundingClientRect();
  35. const customHeight = custom.height + 10 + 2 || 0;
  36. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  37. const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
  38. const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  39. this.setData({
  40. statusBarHeight,
  41. screenHeight,
  42. customHeight,
  43. bottomNavHeight,
  44. contentHeight,
  45. contentpadding
  46. });
  47. this.getcircle()
  48. this.getname()
  49. },
  50. },
  51. /**
  52. * 组件的方法列表
  53. */
  54. methods: {
  55. gourl(e) {
  56. const url = e.currentTarget.dataset.url
  57. wx.navigateTo({
  58. url: `${url}` // 目标页面的路径
  59. });
  60. },
  61. //查全部朋友圈
  62. async getcircle() {
  63. const currentUser = Parse.User.current();
  64. let Profilequery2 = new Parse.Query('Profile');
  65. Profilequery2.equalTo('company', company);
  66. Profilequery2.equalTo('user', currentUser.id);
  67. Profilequery2.equalTo('isCheck', true);
  68. Profilequery2.notEqualTo('isDeleted', true)
  69. let P2 = await Profilequery2.find();
  70. let profile1List2 = P2.map(item => item.toJSON());
  71. let Profilequery = new Parse.Query('AIMoment');
  72. Profilequery.equalTo('company', company);
  73. Profilequery.equalTo('isVisible', true);
  74. Profilequery.notEqualTo('isDeleted', true)
  75. Profilequery.equalTo('profile', profile1List2[0].objectId);
  76. Profilequery.descending('createdAt');
  77. let count = await Profilequery.count();
  78. if (count) {
  79. this.setData({
  80. circlecount: count
  81. })
  82. }
  83. },
  84. //查看积分
  85. async getpoint(){
  86. },
  87. //获取头像名称
  88. async getname(){
  89. const currentUser = Parse.User.current();
  90. let Userquery = new Parse.Query('_User');
  91. Userquery.equalTo('company', company);
  92. Userquery.equalTo('objectId', currentUser.id);
  93. Userquery.notEqualTo('isDeleted', true)
  94. let P2 = await Userquery.find();
  95. let User1List = P2.map(item => item.toJSON());
  96. this.setData({
  97. User1List
  98. })
  99. console.log(this.data.User1List);
  100. },
  101. gourl(e) {
  102. const url = e.currentTarget.dataset.url
  103. wx.navigateTo({
  104. url: `${url}`// 目标页面的路径
  105. });
  106. },
  107. }
  108. })