index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. frameStyle: { useTop: true, name: '我的赛事', leftArrow: true, useBar: false },
  8. dialog: { title: '详细信息', show: false, type: '1' },
  9. // 选项卡
  10. tabs: {
  11. active: 'a',
  12. list: [
  13. { title: '小组赛', name: 'a' },
  14. { title: '淘汰赛', name: 'b' },
  15. ],
  16. },
  17. list: [
  18. {
  19. match_time: '比赛时间',
  20. match_name: '比赛名称',
  21. grouping_name: '赛事组别',
  22. project_name: '组内项目',
  23. ground_name: '比赛场地',
  24. },
  25. {
  26. match_time: '比赛时间',
  27. match_name: '比赛名称',
  28. grouping_name: '赛事组别',
  29. project_name: '组内项目',
  30. ground_name: '比赛场地',
  31. },
  32. {
  33. match_time: '比赛时间',
  34. match_name: '比赛名称',
  35. grouping_name: '赛事组别',
  36. project_name: '组内项目',
  37. ground_name: '比赛场地',
  38. },
  39. {
  40. match_time: '比赛时间',
  41. match_name: '比赛名称',
  42. grouping_name: '赛事组别',
  43. project_name: '组内项目',
  44. ground_name: '比赛场地',
  45. },
  46. {
  47. match_time: '比赛时间',
  48. match_name: '比赛名称',
  49. grouping_name: '赛事组别',
  50. project_name: '组内项目',
  51. ground_name: '比赛场地',
  52. },
  53. {
  54. match_time: '比赛时间',
  55. match_name: '比赛名称',
  56. grouping_name: '赛事组别',
  57. project_name: '组内项目',
  58. ground_name: '比赛场地',
  59. },
  60. {
  61. match_time: '比赛时间',
  62. match_name: '比赛名称',
  63. grouping_name: '赛事组别',
  64. project_name: '组内项目',
  65. ground_name: '比赛场地',
  66. },
  67. {
  68. match_time: '比赛时间',
  69. match_name: '比赛名称',
  70. grouping_name: '赛事组别',
  71. project_name: '组内项目',
  72. ground_name: '比赛场地',
  73. },
  74. {
  75. match_time: '比赛时间',
  76. match_name: '比赛名称',
  77. grouping_name: '赛事组别',
  78. project_name: '组内项目',
  79. ground_name: '比赛场地',
  80. }, {
  81. match_time: '比赛时间',
  82. match_name: '比赛名称',
  83. grouping_name: '赛事组别',
  84. project_name: '组内项目',
  85. ground_name: '比赛场地',
  86. },
  87. {
  88. match_time: '比赛时间',
  89. match_name: '比赛名称',
  90. grouping_name: '赛事组别',
  91. project_name: '组内项目',
  92. ground_name: '比赛场地',
  93. },
  94. ],
  95. // 详细信息
  96. info: {},
  97. },
  98. // 跳转菜单
  99. back(e) {
  100. wx.navigateBack({ delta: 1 })
  101. },
  102. // 选项卡
  103. tabsChange: function (e) {
  104. const that = this;
  105. const { name } = e.detail;
  106. that.setData({ 'tabs.active': name });
  107. },
  108. // 详细信息
  109. toView: async function (e) {
  110. const { item } = e.currentTarget.dataset;
  111. const that = this;
  112. that.setData({ info: item })
  113. that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  114. },
  115. // 关闭弹框
  116. toClose: function () {
  117. const that = this;
  118. that.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
  119. },
  120. /**
  121. * 生命周期函数--监听页面加载
  122. */
  123. onLoad: function (options) {
  124. const that = this;
  125. that.watchLogin();
  126. },
  127. // 监听用户是否登录
  128. watchLogin: async function () {
  129. const that = this;
  130. wx.getStorage({
  131. key: 'user',
  132. success: async res => {
  133. console.log(res);
  134. },
  135. fail: res => {
  136. wx.redirectTo({ url: '/pages/index/index', })
  137. }
  138. })
  139. },
  140. /**
  141. * 生命周期函数--监听页面初次渲染完成
  142. */
  143. onReady: function () {
  144. },
  145. /**
  146. * 生命周期函数--监听页面显示
  147. */
  148. onShow: function () {
  149. },
  150. /**
  151. * 生命周期函数--监听页面隐藏
  152. */
  153. onHide: function () {
  154. },
  155. /**
  156. * 生命周期函数--监听页面卸载
  157. */
  158. onUnload: function () {
  159. },
  160. /**
  161. * 页面相关事件处理函数--监听用户下拉动作
  162. */
  163. onPullDownRefresh: function () {
  164. },
  165. /**
  166. * 页面上拉触底事件的处理函数
  167. */
  168. onReachBottom: function () {
  169. },
  170. /**
  171. * 用户点击右上角分享
  172. */
  173. onShareAppMessage: function () {
  174. }
  175. })