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

3 年前
3 年前
3 年前
3 年前
3 年前
3 年前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. this.computeBarLocation();
  12. //获取用户信息
  13. this.getUserInfo()
  14. },
  15. /* 计算bar 高度*/
  16. computeBarLocation() {
  17. var that = this;
  18. let CustomMenuButton = wx.getMenuButtonBoundingClientRect();
  19. let CustomWidows = wx.getSystemInfoSync();
  20. // 根据文档,先创建一个SelectorQuery对象实例
  21. let query = wx.createSelectorQuery().in(this);
  22. query.select('.top_title').boundingClientRect();
  23. query.select('.information_header').boundingClientRect();
  24. query.select('.navList_main').boundingClientRect();
  25. query.select('.child_function').boundingClientRect();
  26. query.select('.work_plan').boundingClientRect();
  27. query.exec((res) => {
  28. let wrokScrollHeight = CustomWidows.windowHeight;
  29. res.forEach((v)=>{
  30. wrokScrollHeight = wrokScrollHeight - v.height;
  31. })
  32. wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15;
  33. that.setData({
  34. wrokScrollHeight: wrokScrollHeight,
  35. });
  36. })
  37. that.setData({
  38. CustomMenuButton: CustomMenuButton,
  39. });
  40. },
  41. /* 获取用户信息*/
  42. getUserInfo(){
  43. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  44. success: (res) => {
  45. if (res.code == API.SUCCESS_CODE) {
  46. this.setData({userInfoObj:res.user})
  47. }
  48. }
  49. })
  50. }
  51. })