achieve.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. frameStyle: { useTop: true, name: '赛事信息', leftArrow: true, useBar: false },
  8. tabs: {
  9. active: 'a',
  10. list: [
  11. { title: '小组赛', name: 'a' },
  12. { title: '淘汰赛', name: 'b' },
  13. { title: '名次', name: 'c' },
  14. { title: '个人积分', name: 'd' },
  15. { title: '团体积分', name: 'e' },
  16. ],
  17. },
  18. options: {},
  19. info: {}
  20. },
  21. // 跳转菜单
  22. back(e) {
  23. wx.navigateBack({ delta: 1 })
  24. },
  25. // 选项卡
  26. tabsChange: function (e) {
  27. const that = this;
  28. const { name } = e.detail;
  29. that.setData({ 'tabs.active': name });
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. const that = this;
  36. that.setData({ options: { match_id: options.match_id || '62e388d4fd61d871861b80af', grouping_id: options.grouping_id || '62e601db2dc7343e137fff76', project_id: options.project_id || '62e5ffba2dc7343e137ffee9' } })
  37. that.search()
  38. },
  39. search: async function () {
  40. const that = this;
  41. const options = that.data.options;
  42. let arr;
  43. arr = await app.$get(`/newCourt/api/match/${options.match_id}`);
  44. if (arr.errcode == '') { that.setData({ info: arr.data }) }
  45. },
  46. /**
  47. * 生命周期函数--监听页面初次渲染完成
  48. */
  49. onReady: function () {
  50. },
  51. /**
  52. * 生命周期函数--监听页面显示
  53. */
  54. onShow: function () {
  55. },
  56. /**
  57. * 生命周期函数--监听页面隐藏
  58. */
  59. onHide: function () {
  60. },
  61. /**
  62. * 生命周期函数--监听页面卸载
  63. */
  64. onUnload: function () {
  65. },
  66. /**
  67. * 页面相关事件处理函数--监听用户下拉动作
  68. */
  69. onPullDownRefresh: function () {
  70. },
  71. /**
  72. * 页面上拉触底事件的处理函数
  73. */
  74. onReachBottom: function () {
  75. },
  76. /**
  77. * 用户点击右上角分享
  78. */
  79. onShareAppMessage: function () {
  80. }
  81. })