compete.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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.showModal({
  27. title: '',
  28. content: '是否驳回',
  29. success(res) {
  30. if (res.confirm) {
  31. wx.request({
  32. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam/` + id, //接口地址
  33. method: 'post',
  34. data: {
  35. "status": "-1"
  36. },
  37. success(res) {
  38. if (res.data.errcode == 0) {
  39. wx.showToast({ title: `团队状态拒绝`, icon: 'success', duration: 2000 }) //创建成功提示
  40. // return wx.redirectTo({ url: '/pages/manage/index' })// 跳转页面
  41. } else {
  42. wx.showToast({
  43. title: res.data.errmsg,
  44. icon: 'none',
  45. duration: 2000
  46. })
  47. }
  48. }
  49. })
  50. } else if (res.cancel) {
  51. }
  52. }
  53. })
  54. },
  55. //点击通过
  56. out: function () {
  57. var that = this;
  58. let id = that.team_id
  59. wx.showModal({
  60. title: '',
  61. content: '是否确认',
  62. success(res) {
  63. if (res.confirm) {
  64. wx.request({
  65. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam/` + id, //接口地址
  66. method: 'post',
  67. data: {
  68. "status": "1"
  69. },
  70. success(res) {
  71. if (res.data.errcode == 0) {
  72. wx.showToast({ title: `团队状态成功`, icon: 'success', duration: 2000 }) //创建成功提示
  73. // return wx.redirectTo({ url: '/pages/manage/index' })// 跳转页面
  74. } else {
  75. wx.showToast({
  76. title: res.data.errmsg,
  77. icon: 'none',
  78. duration: 2000
  79. })
  80. }
  81. }
  82. })
  83. } else if (res.cancel) {
  84. }
  85. }
  86. })
  87. },
  88. /**
  89. * 生命周期函数--监听页面加载
  90. */
  91. onLoad: function (options) {
  92. var myObject = JSON.parse(decodeURIComponent(options.obj));
  93. this.ids = myObject.name;
  94. this.team_id = myObject.id;
  95. // 计算高度
  96. this.searchHeight()
  97. // 监听用户是否登录
  98. this.watchLogin();
  99. },
  100. //验证用户是否登录
  101. watchLogin: function () {
  102. var that = this;
  103. let ids = that.team_id;
  104. wx.getStorage({
  105. key: 'token',
  106. success: res => {
  107. //查询数据
  108. wx.request({
  109. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam/` + ids, //接口地址
  110. method: 'get',
  111. data: '',
  112. success(res) {
  113. if (res.data.errcode == 0) {
  114. let datas = res.data.data
  115. that.setData({
  116. teamlist: datas,
  117. });
  118. } else {
  119. wx.showToast({
  120. title: res.data.errmsg,
  121. icon: 'none',
  122. duration: 2000
  123. })
  124. }
  125. }
  126. })
  127. },
  128. fail: res => {
  129. return 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. })