const _Http = getApp().globalData.http; Page({ /** * 页面的初始数据 */ data: { user: {}, annunciateList: [], //通告列表 gridList: [{ name: "通告", path: "/pages/annunciate/index", icon: "icon-a-shouyejingangqutonggao", }, { name: "推广素材", path: "/pages/promotional/index", icon: "icon-a-shouyejingangqutuiguangsucai", }, { name: "商学院", path: "/pages/college/index", icon: "icon-a-shangxueyuanxuexi", }, { name: "提报", path: "/pages/submission/index", icon: "icon-a-tibaoguanlitibao", }] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.refreshData(wx.getStorageSync('userMsg')) this.setData({ //获取胶囊位置信息 capsule: wx.getMenuButtonBoundingClientRect() }) }, /* 查看通告详情 */ toAnnunciateDetails(e) { const { item } = e.currentTarget.dataset; wx.navigateTo({ url: '/pages/annunciate/details?id=' + item.sat_noticeid, }) }, /* 获取通告列表 */ queryNoticeList(i) { if (i == 5) return; _Http.basic({ "classname": "saletool.notice.notice", "method": "queryNoticeList", "content": { "pageNumber": 1, "pageSize": 3 } }).then(res => { console.log("通告列表", res) if (res.msg != '成功') return this.queryNoticeList(i + 1); this.setData({ annunciateList: res.data }) }) }, /* 更新站点信息 */ refreshData(item) { this.setData({ user: item }) this.queryNoticeList(0); //获取通告列表 }, /* 宫格区域应用程序 */ applications(e) { const { name } = e.currentTarget.dataset; /* switch (name) { case "通告": wx.navigateTo({ url: '/pages/annunciate/index' }) break; default: break; } */ }, /* 去通告 */ toAnnunciate() { wx.navigateTo({ url: '/pages/annunciate/index' }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { this.getTabBar().init(); }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })