const app = getApp() Page({ data: { frameStyle: { useTop: true, name: '首页', leftArrow: false, useBar: true }, list: [ { status: 3, name: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', sign_end_time: '2022-08-05-21:00', start_time: '2022-08-06', end_time: '2022-08-06', address: '辽源市全民体育馆3楼' }, ] }, // 跳转菜单 tabPath(e) { let { route } = e.detail.detail; if (route) wx.redirectTo({ url: `/${route}` }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, // 监听用户是否登录 watchLogin: async function () { // 监听用户是否登录, wx.getStorage({ key: 'user', success: async res => { console.log('请求数据'); }, fail: async res => { // wx.redirectTo({ url: '/pages/index/index' }) } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { const that = this; // 监听用户是否登录 that.watchLogin(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })