index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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/me/index' })
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. // 计算高度
  21. this.searchHeight();
  22. // 监听用户是否登录
  23. this.watchLogin();
  24. },
  25. // 监听用户是否登录
  26. watchLogin: function () {
  27. const that = this;
  28. wx.getStorage({
  29. key: 'token',
  30. success: async res => {
  31. const arr = await app.$get(`/courtAdmin/api/joinapply`, { apply_id: res.data._id });
  32. if (arr.errcode == '0') that.setData({ list: arr.data })
  33. },
  34. fail: res => {
  35. wx.redirectTo({ url: '/pages/login/index', })
  36. }
  37. })
  38. },
  39. // 计算高度
  40. searchHeight: function () {
  41. let frameStyle = this.data.frameStyle;
  42. let client = app.globalData.client;
  43. let infoHeight = client.windowHeight;
  44. // 是否去掉状态栏
  45. if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  46. // 是否减去底部菜单
  47. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  48. if (infoHeight) this.setData({ infoHeight: infoHeight })
  49. },
  50. /**
  51. * 生命周期函数--监听页面初次渲染完成
  52. */
  53. onReady: function () {
  54. },
  55. /**
  56. * 生命周期函数--监听页面显示
  57. */
  58. onShow: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面隐藏
  62. */
  63. onHide: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面卸载
  67. */
  68. onUnload: function () {
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. onPullDownRefresh: function () {
  74. },
  75. /**
  76. * 页面上拉触底事件的处理函数
  77. */
  78. onReachBottom: function () {
  79. },
  80. /**
  81. * 用户点击右上角分享
  82. */
  83. onShareAppMessage: function () {
  84. }
  85. })