compete.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // pages/login/login.js
  2. import WxValidate from '../../utils/wxValidate'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. frameStyle: { useTop: false, name: '团队审核', leftArrow: true, useBar: false },
  10. team_id: '',
  11. ids: '',
  12. src: '/image/adimges.jpg',
  13. src1: '/image/head1.png',
  14. // 主体高度
  15. infoHeight: '',
  16. teamlist: [],
  17. from: [],
  18. },
  19. back: function () {
  20. wx.navigateBack({ url: '/pages/home/index' })
  21. },
  22. //点击驳回
  23. hui: function () {
  24. var that = this;
  25. let id = that.team_id
  26. wx.request({
  27. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam/` + id, //接口地址
  28. method: 'post',
  29. data: {
  30. "status": "-1"
  31. },
  32. success(res) {
  33. if (res.data.errcode == 0) {
  34. wx.showToast({ title: `团队状态拒绝`, icon: 'success', duration: 2000 }) //创建成功提示
  35. // return wx.redirectTo({ url: '/pages/manage/index' })// 跳转页面
  36. } else {
  37. wx.showToast({
  38. title: res.data.errmsg,
  39. icon: 'none',
  40. duration: 2000
  41. })
  42. }
  43. }
  44. })
  45. },
  46. //点击通过
  47. out: function () {
  48. var that = this;
  49. let id = that.team_id
  50. wx.showModal({
  51. title: '',
  52. content: '是否确认解散团队',
  53. success(res) {
  54. if (res.confirm) {
  55. wx.request({
  56. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam/` + id, //接口地址
  57. method: 'post',
  58. data: {
  59. "status": "1"
  60. },
  61. success(res) {
  62. if (res.data.errcode == 0) {
  63. wx.showToast({ title: `团队状态成功`, icon: 'success', duration: 2000 }) //创建成功提示
  64. // return wx.redirectTo({ url: '/pages/manage/index' })// 跳转页面
  65. } else {
  66. wx.showToast({
  67. title: res.data.errmsg,
  68. icon: 'none',
  69. duration: 2000
  70. })
  71. }
  72. }
  73. })
  74. } else if (res.cancel) {
  75. }
  76. }
  77. })
  78. },
  79. /**
  80. * 生命周期函数--监听页面加载
  81. */
  82. onLoad: function (options) {
  83. var myObject = JSON.parse(decodeURIComponent(options.obj));
  84. this.ids = myObject.name;
  85. this.team_id = myObject.id;
  86. // 计算高度
  87. this.searchHeight()
  88. // 监听用户是否登录
  89. this.watchLogin();
  90. },
  91. //验证用户是否登录
  92. watchLogin: function () {
  93. var that = this;
  94. let ids = that.team_id;
  95. wx.getStorage({
  96. key: 'token',
  97. success: res => {
  98. //查询数据
  99. wx.request({
  100. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam/` + ids, //接口地址
  101. method: 'get',
  102. data: '',
  103. success(res) {
  104. if (res.data.errcode == 0) {
  105. let datas = res.data.data
  106. that.setData({
  107. teamlist: datas,
  108. });
  109. } else {
  110. wx.showToast({
  111. title: res.data.errmsg,
  112. icon: 'none',
  113. duration: 2000
  114. })
  115. }
  116. }
  117. })
  118. },
  119. fail: res => {
  120. return wx.redirectTo({ url: '/pages/login/index', })
  121. }
  122. })
  123. },
  124. // 计算高度
  125. searchHeight: function () {
  126. let frameStyle = this.data.frameStyle;
  127. let client = app.globalData.client;
  128. let infoHeight = client.windowHeight;
  129. // 是否去掉状态栏
  130. if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  131. // 是否减去底部菜单
  132. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  133. if (infoHeight) this.setData({ infoHeight: infoHeight })
  134. },
  135. /**
  136. * 生命周期函数--监听页面初次渲染完成
  137. */
  138. onReady: function () {
  139. },
  140. /**
  141. * 生命周期函数--监听页面显示
  142. */
  143. onShow: function () {
  144. },
  145. /**
  146. * 生命周期函数--监听页面隐藏
  147. */
  148. onHide: function () {
  149. },
  150. /**
  151. * 生命周期函数--监听页面卸载
  152. */
  153. onUnload: function () {
  154. },
  155. /**
  156. * 页面相关事件处理函数--监听用户下拉动作
  157. */
  158. onPullDownRefresh: function () {
  159. },
  160. /**
  161. * 页面上拉触底事件的处理函数
  162. */
  163. onReachBottom: function () {
  164. },
  165. /**
  166. * 用户点击右上角分享
  167. */
  168. onShareAppMessage: function () {
  169. }
  170. })