index.js 5.3 KB

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