examine.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. // pages/login/login.js
  2. import WxValidate from '../../utils/wxValidate'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. ids: '',
  10. src: '/image/adimges.jpg',
  11. src1: '/image/head1.png',
  12. frameStyle: { useTop: false, name: '团队详情', leftArrow: true, useBar: false },
  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. // 监听用户是否登录
  62. watchLogin: function () {
  63. var that = this;
  64. let id = that.ids
  65. wx.getStorage({
  66. key: 'token',
  67. success: res => {
  68. //查询数据
  69. wx.request({
  70. url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id, //接口地址
  71. method: 'get',
  72. data: '',
  73. success(res) {
  74. if (res.data.errcode == 0) {
  75. let datas = res.data.data
  76. console.log('团队详情', datas);
  77. that.setData({
  78. list: datas,
  79. });
  80. } else {
  81. wx.showToast({
  82. title: res.data.errmsg,
  83. icon: 'none',
  84. duration: 2000
  85. })
  86. }
  87. }
  88. })
  89. //参赛历史
  90. var that = this;
  91. var list = that.data.list;
  92. var match_id = that.ids;
  93. var match_name = list.name;
  94. wx.request({
  95. url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
  96. method: 'get',
  97. data: {
  98. "match_id": match_id,
  99. "match_name": match_name,
  100. },
  101. success(res) {
  102. if (res.data.errcode == 0) {
  103. let datas = res.data.data
  104. console.log('参赛历史', datas);
  105. that.setData({
  106. listend: datas,
  107. });
  108. } else {
  109. wx.showToast({
  110. title: res.data.errmsg,
  111. icon: 'none',
  112. duration: 2000
  113. })
  114. }
  115. }
  116. })
  117. },
  118. fail: res => {
  119. return wx.redirectTo({ url: '/pages/login/index', })
  120. }
  121. })
  122. },
  123. back: function () {
  124. wx.navigateBack({ url: '/pages/home/index' })
  125. },
  126. /**
  127. * 生命周期函数--监听页面加载
  128. */
  129. onLoad: function (options) {
  130. // 计算高度
  131. this.searchHeight()
  132. this.ids = options.id;
  133. // 监听用户是否登录
  134. this.watchLogin();
  135. },
  136. // 计算高度
  137. searchHeight: function () {
  138. let frameStyle = this.data.frameStyle;
  139. let client = app.globalData.client;
  140. // 减去状态栏
  141. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  142. // 是否减去底部菜单
  143. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  144. if (infoHeight) this.setData({ infoHeight: infoHeight })
  145. },
  146. /**
  147. * 生命周期函数--监听页面初次渲染完成
  148. */
  149. onReady: function () {
  150. },
  151. /**
  152. * 生命周期函数--监听页面显示
  153. */
  154. onShow: function () {
  155. },
  156. /**
  157. * 生命周期函数--监听页面隐藏
  158. */
  159. onHide: function () {
  160. },
  161. /**
  162. * 生命周期函数--监听页面卸载
  163. */
  164. onUnload: function () {
  165. },
  166. /**
  167. * 页面相关事件处理函数--监听用户下拉动作
  168. */
  169. onPullDownRefresh: function () {
  170. },
  171. /**
  172. * 页面上拉触底事件的处理函数
  173. */
  174. onReachBottom: function () {
  175. },
  176. /**
  177. * 用户点击右上角分享
  178. */
  179. onShareAppMessage: function () {
  180. }
  181. })