index.js 3.5 KB

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