const app = getApp(); Page({ data: { frameStyle: { useTop: true, name: '赛事赛程', leftArrow: true, useBar: false }, // 选项卡 tabs: { active: 'a', menu: [ { title: '小组赛', active: 'a' }, { title: '淘汰赛', active: 'b' }, ], }, // 小组赛 groupList: [ { match_id_name: '赛事名称', group_id_name: '赛事组别', project_id_name: '组内项目', address_id_name: '场地名称', smgroup_name: '小组名称', player_one_name: '选手一', player_one_score: '10', match_time: '2022-02-02 01:00:00', player_two_name: '选手二', player_two_score: '5', }, { match_id_name: '赛事名称', group_id_name: '赛事组别', project_id_name: '组内项目', address_id_name: '场地名称', smgroup_name: '小组名称', player_one_name: '选手一', player_one_score: '10', match_time: '2022-02-02 01:00:00', player_two_name: '选手二', player_two_score: '5', }, ], // 淘汰赛 eliminatelist: [ { match_id_name: '赛事名称', group_id_name: '赛事组别', project_id_name: '组内项目', address_id_name: '场地名称', player_one_name: '选手一', player_one_score: '10', match_time: '2022-02-02 01:00:00', player_two_name: '选手二', player_two_score: '5', } ], }, // 返回 back: function () { wx.navigateBack({ delta: 1 }) }, // 选项卡 tabsChange: function (e) { const that = this; that.setData({ 'tabs.active': e.detail.active }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { const that = this; // 监听用户是否登录 that.watchLogin(); }, // 监听用户是否登录 watchLogin: async function () { const that = this; wx.getStorage({ key: 'user', success: async res => { }, fail: async res => { wx.redirectTo({ url: '/pages/index/index' }) } }) }, /** * 页面上拉触底事件的处理函数 */ /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })