index.js 5.6 KB

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