group.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. const app = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. frameStyle: { useTop: true, name: '小组赛管理', leftArrow: true, useBar: false },
  8. searchInfo: {},
  9. list: []
  10. },
  11. // 跳转菜单
  12. back(e) {
  13. wx.navigateBack({ delta: 1 })
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. const that = this;
  20. },
  21. /**
  22. * 生命周期函数--监听页面初次渲染完成
  23. */
  24. onReady: function () {
  25. },
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow: function () {
  30. const that = this;
  31. that.watchLogin()
  32. },
  33. watchLogin: function () {
  34. const that = this;
  35. let searchInfo = that.data.searchInfo;
  36. wx.getStorage({
  37. key: 'user',
  38. success: async (res) => {
  39. let info = { skip: 0, limit: 1000, referee_id: res.data.opneid || 'oH0y05QJCvBQQpoobbtHTkpL4z4I' };
  40. // if (searchInfo && searchInfo.name) info.name = searchInfo.name;
  41. const arr = await app.$get(`/newCourt/api/race`, { ...info });
  42. if (arr.errcode == '0') {
  43. that.setData({ list: arr.data })
  44. } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
  45. },
  46. fail: async (res) => {
  47. wx.redirectTo({ url: '/pages/index/index' });
  48. },
  49. });
  50. },
  51. /**
  52. * 生命周期函数--监听页面隐藏
  53. */
  54. onHide: function () {
  55. },
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload: function () {
  60. },
  61. /**
  62. * 页面相关事件处理函数--监听用户下拉动作
  63. */
  64. onPullDownRefresh: function () {
  65. },
  66. /**
  67. * 页面上拉触底事件的处理函数
  68. */
  69. onReachBottom: function () {
  70. },
  71. /**
  72. * 用户点击右上角分享
  73. */
  74. onShareAppMessage: function () {
  75. }
  76. })