const app = getApp() import { news_type } from '../../utils/dict'; Page({ data: { frameStyle: { useTop: true, name: '资讯', leftArrow: false, useBar: true }, //查询条件 searchInfo: {}, typeList: news_type, tabs: { active: '0', list: [ { title: '推荐', name: '0' }, { title: '羽毛球', name: '1' }, ], }, list: [ { title: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', type: 1, brief: '辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛辽源市第一届青少年羽毛球公开赛暨“小虎杯”羽毛球争霸赛', origin: '网络', src: '/image/lingdang.png' }, ] }, // 跳转菜单 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 => { // if (res.data) wx.redirectTo({ url: '/pages/home/index' }) }, fail: async res => { // wx.redirectTo({ url: '/pages/home/index' }) } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { const that = this; // 监听用户是否登录 that.watchLogin(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })