eliminate.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. dialog: { title: '详细信息', show: false, type: '1' },
  11. info: {},
  12. },
  13. // 跳转菜单
  14. back(e) {
  15. wx.navigateBack({ delta: 1 })
  16. },
  17. // 查看
  18. toView: async function (e) {
  19. const that = this;
  20. const { item } = e.currentTarget.dataset;
  21. that.setData({ info: item })
  22. that.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  23. },
  24. // 关闭弹框
  25. toClose: function () {
  26. const that = this;
  27. that.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad: function (options) {
  33. const that = this;
  34. },
  35. /**
  36. * 生命周期函数--监听页面初次渲染完成
  37. */
  38. onReady: function () {
  39. },
  40. /**
  41. * 生命周期函数--监听页面显示
  42. */
  43. onShow: function () {
  44. const that = this;
  45. that.watchLogin()
  46. },
  47. watchLogin: function () {
  48. const that = this;
  49. let searchInfo = that.data.searchInfo;
  50. wx.getStorage({
  51. key: 'user',
  52. success: async (res) => {
  53. let info = { skip: 0, limit: 1000, referee_id: res.data.opneid || 'oH0y05QJCvBQQpoobbtHTkpL4z4I' };
  54. // if (searchInfo && searchInfo.name) info.name = searchInfo.name;
  55. const arr = await app.$get(`/newCourt/api/race`, { ...info });
  56. if (arr.errcode == '0') {
  57. that.setData({ list: arr.data })
  58. } else { wx.showToast({ title: `${res.errMsg}`, icon: 'fail', duration: 2000 }); }
  59. },
  60. fail: async (res) => {
  61. wx.redirectTo({ url: '/pages/index/index' });
  62. },
  63. });
  64. },
  65. /**
  66. * 生命周期函数--监听页面隐藏
  67. */
  68. onHide: function () {
  69. },
  70. /**
  71. * 生命周期函数--监听页面卸载
  72. */
  73. onUnload: function () {
  74. },
  75. /**
  76. * 页面相关事件处理函数--监听用户下拉动作
  77. */
  78. onPullDownRefresh: function () {
  79. },
  80. /**
  81. * 页面上拉触底事件的处理函数
  82. */
  83. onReachBottom: function () {
  84. },
  85. /**
  86. * 用户点击右上角分享
  87. */
  88. onShareAppMessage: function () {
  89. }
  90. })