index.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. menbers: [],
  15. id: ''
  16. },
  17. back: function () {
  18. wx.navigateBack({ url: '/pages/me/index' })
  19. },
  20. //通过
  21. adopt: function (e) {
  22. const that = this;
  23. let id = e.currentTarget.dataset.id;
  24. //修改状态-加入团队修改
  25. wx.request({
  26. url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply/${id}`, 
  27. method: "post",
  28. data: { status: '1' },
  29. header: {},
  30. success: res => {
  31. if (res.data.errcode == 0) {
  32. wx.showToast({
  33. title: '已通过',
  34. icon: 'success',
  35. duration: 2000
  36. })
  37. }
  38. },
  39. error: err => {
  40. }
  41. })
  42. //用户详情
  43. let id1 = e.currentTarget.dataset.id1;
  44. wx.request({
  45. url: `${app.globalData.publicUrl}/courtAdmin/api/user/${id1}`, //接口地址
  46. method: "get",
  47. data: {},
  48. header: {},
  49. success: res => {
  50. let id_1 = this.data.id
  51. let members = [];
  52. members.push({ id: res.data.data.id, nickname: res.data.data.nickname, icon: res.data.data.icon })
  53. that.setData({ members: members })
  54. wx.request({
  55. url: `${app.globalData.publicUrl}/courtAdmin/api/team/${id_1}`, 
  56. method: "post",
  57. data: { members: members },
  58. header: {},
  59. success: res => {
  60. if (res.data.errcode == 0) {
  61. wx.showToast({
  62. title: '已通过',
  63. icon: 'success',
  64. duration: 2000
  65. })
  66. }
  67. },
  68. error: err => {
  69. }
  70. })
  71. },
  72. error: err => {
  73. }
  74. })
  75. },
  76. //驳回
  77. reject: function (e) {
  78. let { id } = e.currentTarget.dataset;
  79. wx.request({
  80. url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply/${id}`, 
  81. method: "post",
  82. data: { status: '-1' },
  83. header: {},
  84. success: res => {
  85. if (res.data.errcode == 0) {
  86. wx.showToast({
  87. title: '已驳回',
  88. icon: 'success',
  89. duration: 2000
  90. })
  91. }
  92. },
  93. error: err => {
  94. }
  95. })
  96. },
  97. /**
  98. * 生命周期函数--监听页面加载
  99. */
  100. onLoad: function (options) {
  101. this.setData({ id: options.id })
  102. // 计算高度
  103. this.searchHeight();
  104. // 监听用户是否登录
  105. this.watchLogin();
  106. },
  107. // 监听用户是否登录
  108. watchLogin: function () {
  109. const that = this;
  110. var id = that.data.id;
  111. wx.getStorage({
  112. key: 'token',
  113. success: res => {
  114. wx.request({
  115. url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply`,
  116. method: "get",
  117. data: { team_id: id },
  118. header: {},
  119. success: res => {
  120. that.setData({ list: res.data.data })
  121. },
  122. error: err => {
  123. }
  124. })
  125. },
  126. fail: res => {
  127. wx.redirectTo({ url: '/pages/login/index', })
  128. }
  129. })
  130. },
  131. // 计算高度
  132. searchHeight: function () {
  133. let frameStyle = this.data.frameStyle;
  134. let client = app.globalData.client;
  135. let infoHeight = client.windowHeight;
  136. // 是否去掉状态栏
  137. if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  138. // 是否减去底部菜单
  139. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  140. if (infoHeight) this.setData({ infoHeight: infoHeight })
  141. },
  142. /**
  143. * 生命周期函数--监听页面初次渲染完成
  144. */
  145. onReady: function () {
  146. },
  147. /**
  148. * 生命周期函数--监听页面显示
  149. */
  150. onShow: function () {
  151. },
  152. /**
  153. * 生命周期函数--监听页面隐藏
  154. */
  155. onHide: function () {
  156. },
  157. /**
  158. * 生命周期函数--监听页面卸载
  159. */
  160. onUnload: function () {
  161. },
  162. /**
  163. * 页面相关事件处理函数--监听用户下拉动作
  164. */
  165. onPullDownRefresh: function () {
  166. },
  167. /**
  168. * 页面上拉触底事件的处理函数
  169. */
  170. onReachBottom: function () {
  171. },
  172. /**
  173. * 用户点击右上角分享
  174. */
  175. onShareAppMessage: function () {
  176. }
  177. })