daofu-applet/pages/msg/push-index/index.js

119 lines
2.0 KiB
JavaScript
Raw Permalink Normal View History

2024-01-29 17:42:38 +08:00
// pages/msg/push-index/index.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
topBarH: app.globalData.CustomBar,
page: 1,
pageSize: 10,
list: [],
TypeData: ['检查', '任务', '政策', '学习', '预警', '系统']
},
/**
* 刷新
*/
refresh: function (params) {
this.data.page = 1;
this.getList();
},
/**
* 获取企业列表
*/
getList: function () {
const params = {
userId: app.globalData.userInfo.userId,
page: this.data.page,
pageSize: this.data.pageSize
}
app.axios('GET', 'app', '/notice/getGovNoticePage', params, false).then(res => {
this.data.freshIng = false;
if (res.code == 1) {
if (this.data.page == 1) this.data.list = res.data.rows;
else this.data.list = [...this.data.list, ...res.data.rows]
if (res.data.rows.length > 0) this.data.page = res.data.pageNum + 1
this.setData(this.data)
}
})
},
/**
* 跳转通知详情
*/
toDetail: function (params) {
const item = params.currentTarget.dataset.item;
wx.navigateTo({
url: `/pages/msg/push/index?uuid=${item.govNoticeId}`,
})
},
/**
* 发布通知
*/
push: function (params) {
wx.navigateTo({
url: '/pages/msg/push/index',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.refresh();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})