微信小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

3 年前
3 年前
3 年前
3 年前
3 年前
3 年前
3 年前
3 年前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import * as UTIL from '../../utils/util.js';
  2. import * as API from '../../utils/API.js';
  3. Page({
  4. data: {
  5. //顶部胶囊按钮位置信息rect
  6. CustomMenuButton: null,
  7. wrokScrollHeight:0,
  8. userInfoObj:{} //用户信息
  9. },
  10. onLoad: function (options) {
  11. //获取用户信息
  12. this.getUserInfo()
  13. //获取滚动条高度
  14. this.computeBarLocation();
  15. },
  16. /* 计算bar 高度*/
  17. computeBarLocation() {
  18. var that = this;
  19. let CustomMenuButton = wx.getMenuButtonBoundingClientRect();
  20. let CustomWidows = wx.getSystemInfoSync();
  21. // 根据文档,先创建一个SelectorQuery对象实例
  22. let query = wx.createSelectorQuery().in(this);
  23. query.select('.top_title').boundingClientRect();
  24. query.select('.information_header').boundingClientRect();
  25. query.select('.navList_main').boundingClientRect();
  26. query.select('.child_function').boundingClientRect();
  27. query.select('.work_plan').boundingClientRect();
  28. query.exec((res) => {
  29. let wrokScrollHeight = CustomWidows.windowHeight;
  30. res.forEach((v)=>{
  31. wrokScrollHeight = wrokScrollHeight - v.height;
  32. })
  33. wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15;
  34. that.setData({
  35. wrokScrollHeight: wrokScrollHeight,
  36. });
  37. })
  38. that.setData({
  39. CustomMenuButton: CustomMenuButton,
  40. });
  41. },
  42. /* 获取用户信息*/
  43. getUserInfo(){
  44. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  45. success: (res) => {
  46. if (res.code == API.SUCCESS_CODE) {
  47. this.setData({userInfoObj:res.user})
  48. }
  49. }
  50. })
  51. }
  52. })