compete.js 4.7 KB

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