index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // pages/login/login.js
  2. import WxValidate from '../../utils/wxValidate'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. // 主体高度
  10. infoHeight: '',
  11. frameStyle: { useTop: true, name: '审核队员', leftArrow: true, useBar: false },
  12. //加入团队列表
  13. list: [],
  14. id: ''
  15. },
  16. back: function () {
  17. wx.navigateBack({ url: '/pages/me/index' })
  18. },
  19. //通过
  20. adopt: function (e) {
  21. let { id } = e.currentTarget.dataset;
  22. wx.request({
  23. url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply/${id}`, //接口地址
  24. method: "post",
  25. data: { status: '1' },
  26. header: {},
  27. success: res => {
  28. },
  29. error: err => {
  30. }
  31. })
  32. },
  33. //驳回
  34. reject: function (e) {
  35. let { id } = e.currentTarget.dataset;
  36. wx.request({
  37. url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply/${id}`, //接口地址
  38. method: "post",
  39. data: { status: '-1' },
  40. header: {},
  41. success: res => {
  42. },
  43. error: err => {
  44. }
  45. })
  46. },
  47. /**
  48. * 生命周期函数--监听页面加载
  49. */
  50. onLoad: function (options) {
  51. this.setData({ id: options.id })
  52. // 计算高度
  53. this.searchHeight();
  54. // 监听用户是否登录
  55. this.watchLogin();
  56. },
  57. // 监听用户是否登录
  58. watchLogin: function () {
  59. const that = this;
  60. var id = that.data.id;
  61. wx.getStorage({
  62. key: 'token',
  63. success: res => {
  64. //数据请求
  65. wx.request({
  66. url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply`, //接口地址
  67. method: "get",
  68. data: { team_id: id },
  69. header: {},
  70. success: res => {
  71. that.setData({ list: res.data.data })
  72. console.log(res.data.data);
  73. },
  74. error: err => {
  75. }
  76. })
  77. },
  78. fail: res => {
  79. wx.redirectTo({ url: '/pages/login/index', })
  80. }
  81. })
  82. },
  83. // 计算高度
  84. searchHeight: function () {
  85. let frameStyle = this.data.frameStyle;
  86. let client = app.globalData.client;
  87. // 减去状态栏
  88. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  89. // 是否减去底部菜单
  90. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  91. if (infoHeight) this.setData({ infoHeight: infoHeight })
  92. },
  93. /**
  94. * 生命周期函数--监听页面初次渲染完成
  95. */
  96. onReady: function () {
  97. },
  98. /**
  99. * 生命周期函数--监听页面显示
  100. */
  101. onShow: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面隐藏
  105. */
  106. onHide: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面卸载
  110. */
  111. onUnload: function () {
  112. },
  113. /**
  114. * 页面相关事件处理函数--监听用户下拉动作
  115. */
  116. onPullDownRefresh: function () {
  117. },
  118. /**
  119. * 页面上拉触底事件的处理函数
  120. */
  121. onReachBottom: function () {
  122. },
  123. /**
  124. * 用户点击右上角分享
  125. */
  126. onShareAppMessage: function () {
  127. }
  128. })