examine.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. ids: '',
  11. src: '/image/adimges.jpg',
  12. src1: '/image/head1.png',
  13. // 主体高度
  14. infoHeight: '',
  15. list: [
  16. {
  17. id: '1', time: '08:30', date: '2022.01.15', Founder: 'XXX', group: '哈拉海队', person: '10'
  18. }
  19. ],
  20. listend: [
  21. {
  22. id: '1', name: '经开区足球比赛', state: '已结束', mark: '团队获得第4名', num: '20'
  23. },
  24. {
  25. id: '1', name: '经开区足球比赛', state: '已结束', mark: '团队获得第4名', num: '20'
  26. },
  27. {
  28. id: '1', name: '经开区足球比赛', state: '已结束', mark: '团队获得第4名', num: '20'
  29. }
  30. ],
  31. lists: [
  32. {
  33. id: '1', name: '老头1', head: '/image/tou.png'
  34. },
  35. {
  36. id: '1', name: '老头2', head: '/image/tou.png'
  37. },
  38. {
  39. id: '1', name: '老头3', head: '/image/tou.png'
  40. },
  41. {
  42. id: '1', name: '老头4', head: '/image/tou.png'
  43. },
  44. {
  45. id: '1', name: '老头5', head: '/image/tou.png'
  46. },
  47. {
  48. id: '1', name: '老头6', head: '/image/tou.png'
  49. },
  50. {
  51. id: '1', name: '老头7', head: '/image/tou.png'
  52. },
  53. {
  54. id: '1', name: '老头8', head: '/image/tou.png'
  55. },
  56. {
  57. id: '1', name: '老头9', head: '/image/tou.png'
  58. },
  59. ],
  60. },
  61. back: function () {
  62. wx.navigateBack({ url: '/pages/home/index' })
  63. },
  64. /**
  65. * 生命周期函数--监听页面加载
  66. */
  67. onLoad: function (options) {
  68. // 计算高度
  69. this.searchHeight()
  70. this.ids = options.id;
  71. // 监听用户是否登录
  72. this.watchLogin();
  73. },
  74. // 监听用户是否登录
  75. watchLogin: function () {
  76. var that = this;
  77. let id = that.ids
  78. wx.getStorage({
  79. key: 'token',
  80. success: res => {
  81. //查询数据
  82. wx.request({
  83. url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id, //接口地址
  84. method: 'get',
  85. data: '',
  86. success(res) {
  87. if (res.data.errcode == 0) {
  88. let datas = res.data.data
  89. that.setData({
  90. list: datas,
  91. });
  92. } else {
  93. wx.showToast({
  94. title: res.data.errmsg,
  95. icon: 'none',
  96. duration: 2000
  97. })
  98. }
  99. }
  100. })
  101. //参赛历史
  102. var that = this;
  103. var list = that.data.list;
  104. var match_id = that.ids;
  105. var match_name = list.name;
  106. wx.request({
  107. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
  108. method: 'get',
  109. data: {
  110. "match_id": match_id,
  111. "match_name": match_name,
  112. },
  113. success(res) {
  114. if (res.data.errcode == 0) {
  115. let datas = res.data.data
  116. that.setData({
  117. listend: datas,
  118. });
  119. } else {
  120. wx.showToast({
  121. title: res.data.errmsg,
  122. icon: 'none',
  123. duration: 2000
  124. })
  125. }
  126. }
  127. })
  128. },
  129. fail: res => {
  130. return wx.redirectTo({ url: '/pages/login/index', })
  131. }
  132. })
  133. },
  134. // 计算高度
  135. searchHeight: function () {
  136. let frameStyle = this.data.frameStyle;
  137. let client = app.globalData.client;
  138. // 减去状态栏
  139. let infoHeight = client.windowHeight - (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. })