微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 年之前
3 年之前
3 年之前
3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. //跳转收入登记
  17. swichInCome:function(e){
  18. console.log(e.currentTarget.dataset.current);
  19. // let cur = e.currentTarget.dataset.current;
  20. // if (this.data.currentTaB == cur) {
  21. // return false;
  22. // }else{
  23. // wx.navigateTo({
  24. // url: '../inCome/index?id=' + id,
  25. // })
  26. // }
  27. wx.navigateTo({
  28. url: '../inCome/inCome?',
  29. })
  30. },
  31. //跳转支出申请
  32. swichPayment:function(e){
  33. console.log(e.currentTarget.dataset.current);
  34. // let cur = e.currentTarget.dataset.current;
  35. // if (this.data.currentTaB == cur) {
  36. // return false;
  37. // }else{
  38. // wx.navigateTo({
  39. // url: '../inCome/index?id=' + id,
  40. // })
  41. // }
  42. wx.navigateTo({
  43. url: '../apply/index?',
  44. })
  45. },
  46. //跳转个人设置
  47. swichSettle:function(e){
  48. console.log(e.currentTarget.dataset.current);
  49. // let cur = e.currentTarget.dataset.current;
  50. // if (this.data.currentTaB == cur) {
  51. // return false;
  52. // }else{
  53. // wx.navigateTo({
  54. // url: '../inCome/index?id=' + id,
  55. // })
  56. // }
  57. wx.navigateTo({
  58. url: 'settle/index?',
  59. })
  60. },
  61. /* 计算bar 高度*/
  62. computeBarLocation() {
  63. var that = this;
  64. let CustomMenuButton = wx.getMenuButtonBoundingClientRect();
  65. let CustomWidows = wx.getSystemInfoSync();
  66. // 根据文档,先创建一个SelectorQuery对象实例
  67. let query = wx.createSelectorQuery().in(this);
  68. query.select('.top_title').boundingClientRect();
  69. query.select('.information_header').boundingClientRect();
  70. query.select('.navList_main').boundingClientRect();
  71. query.select('.child_function').boundingClientRect();
  72. query.select('.work_plan').boundingClientRect();
  73. query.exec((res) => {
  74. let wrokScrollHeight = CustomWidows.windowHeight;
  75. res.forEach((v)=>{
  76. wrokScrollHeight = wrokScrollHeight - v.height;
  77. })
  78. wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15;
  79. that.setData({
  80. wrokScrollHeight: wrokScrollHeight,
  81. });
  82. })
  83. that.setData({
  84. CustomMenuButton: CustomMenuButton,
  85. });
  86. },
  87. /* 获取用户信息*/
  88. getUserInfo(){
  89. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  90. success: (res) => {
  91. if (res.code == API.SUCCESS_CODE) {
  92. this.setData({userInfoObj:res.user})
  93. }
  94. }
  95. })
  96. }
  97. })