index.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // pages/login/login.js
  2. import WxValidate from '../../utils/wxValidate'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. frameStyle: { useTop: true, name: '用户管理', leftArrow: true, useBar: false },
  10. // 主体高度
  11. infoHeight: '',
  12. },
  13. back: function () {
  14. wx.navigateBack({ url: '/pages/home/index' })
  15. },
  16. // 添加用户
  17. toAdd: function () {
  18. console.log('1');
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad: function (options) {
  24. // 计算高度
  25. this.searchHeight()
  26. },
  27. // 计算高度
  28. searchHeight: function () {
  29. let frameStyle = this.data.frameStyle;
  30. let client = app.globalData.client;
  31. let infoHeight = client.windowHeight;
  32. // 是否去掉状态栏
  33. if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  34. // 是否减去底部菜单
  35. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  36. if (infoHeight) this.setData({ infoHeight: infoHeight })
  37. },
  38. /**
  39. * 生命周期函数--监听页面初次渲染完成
  40. */
  41. onReady: function () {
  42. },
  43. /**
  44. * 生命周期函数--监听页面显示
  45. */
  46. onShow: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面隐藏
  50. */
  51. onHide: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面卸载
  55. */
  56. onUnload: function () {
  57. },
  58. /**
  59. * 页面相关事件处理函数--监听用户下拉动作
  60. */
  61. onPullDownRefresh: function () {
  62. },
  63. /**
  64. * 页面上拉触底事件的处理函数
  65. */
  66. onReachBottom: function () {
  67. },
  68. /**
  69. * 用户点击右上角分享
  70. */
  71. onShareAppMessage: function () {
  72. }
  73. })